Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 1 addition & 111 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,81 +17,8 @@ jobs:
test:
executor: golang
steps:
- prometheus/setup_environment
- run: go mod download
- run: make
- prometheus/store_artifact:
file: node_exporter
test-arm:
executor: arm
steps:
- prometheus/setup_environment
- run: uname -a
- run: make test-e2e
test_mixins:
executor: golang
steps:
- checkout
- run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
- run: make promtool
- run: make -C docs/node-mixin clean
- run: make -C docs/node-mixin jb_install
- run: make -C docs/node-mixin
- run: git diff --exit-code
build:
machine:
image: ubuntu-2404:current
parallelism: 3
steps:
- prometheus/setup_environment
- run: docker run --privileged linuxkit/binfmt:af88a591f9cc896a52ce596b9cf7ca26a061ef97
- run: promu crossbuild -v --parallelism $CIRCLE_NODE_TOTAL --parallelism-thread $CIRCLE_NODE_INDEX
- run: promu --config .promu-cgo.yml crossbuild -v --parallelism $CIRCLE_NODE_TOTAL --parallelism-thread $CIRCLE_NODE_INDEX
# sign the darwin build so it doesn't get SIGKILLed on start, see: https://github.com/prometheus/node_exporter/issues/2539
- run:
command: |
if [[ -f "$(pwd)/.build/darwin-arm64/node_exporter" ]]; then
promu codesign "$(pwd)/.build/darwin-arm64/node_exporter"
fi
- run: "true"

if [[ -f "$(pwd)/.build/darwin-amd64/node_exporter" ]]; then
promu codesign "$(pwd)/.build/darwin-amd64/node_exporter"
fi
- persist_to_workspace:
root: .
paths:
- .build
- store_artifacts:
path: .build
destination: /build
test_docker:
machine:
image: ubuntu-2404:current
environment:
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base
REPO_PATH: github.com/prometheus/node_exporter
steps:
- prometheus/setup_environment
- attach_workspace:
at: .
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
else
make docker
fi
- run: docker images
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
make test-docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
else
make test-docker
fi
workflows:
version: 2
node_exporter:
Expand All @@ -100,40 +27,3 @@ workflows:
filters:
tags:
only: /.*/
- test-arm:
filters:
tags:
only: /.*/
- build:
filters:
tags:
only: /.*/
- test_docker:
requires:
- test
- build
filters:
tags:
only: /.*/
- test_mixins:
filters:
tags:
only: /.*/
- prometheus/publish_master:
context: org-context
requires:
- test
- build
filters:
branches:
only: master
- prometheus/publish_release:
context: org-context
requires:
- test
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
4 changes: 2 additions & 2 deletions .github/workflows/bsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ jobs:
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo ">> building promu as it is not shipped for Solaris"
git clone https://github.com/prometheus/promu.git
cd promu
go build .
cd -
mkdir -p $(go env GOPATH)/bin
ln -s $(pwd)/promu/promu $(go env GOPATH)/bin/promu
export PATH=$(go env GOPATH)/bin:$PATH
Expand Down
147 changes: 147 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
name: CI
on:
pull_request:
push:
branches: [master, 'release-*']
tags: ['v*']

permissions:
contents: read

jobs:
test_go:
name: Go tests
runs-on: ubuntu-latest
container:
# Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml
# should also be updated.
image: quay.io/prometheus/golang-builder:1.26-base
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- run: go mod download
- run: make

test_go_arm:
name: Go ARM tests
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: 1.26.x
- run: uname -a
- run: make test-e2e

test_mixins:
name: Mixins tests
runs-on: ubuntu-latest
container:
# Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml
# should also be updated.
image: quay.io/prometheus/golang-builder:1.26-base
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
- run: make promtool
- run: make -C docs/node-mixin clean
- run: make -C docs/node-mixin jb_install
- run: make -C docs/node-mixin
- run: git diff --exit-code

build:
name: Build node_exporter for all architectures
runs-on: ubuntu-latest
strategy:
matrix:
thread: [ 0, 1, 2 ]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0
- name: Crossbuild
run: ~/go/bin/promu crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }}
- name: CGO crossbuild
run: ~/go/bin/promu --config .promu-cgo.yml crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }}
- name: Codesign darwin binaries
run: |
if [[ -f "$(pwd)/.build/darwin-arm64/node_exporter" ]]; then
~/go/bin/promu codesign "$(pwd)/.build/darwin-arm64/node_exporter"
fi
if [[ -f "$(pwd)/.build/darwin-amd64/node_exporter" ]]; then
~/go/bin/promu codesign "$(pwd)/.build/darwin-amd64/node_exporter"
fi
- uses: prometheus/promci-artifacts/save@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
with:
directory: .build

test_docker:
name: Test docker image
runs-on: ubuntu-latest
needs: [test_go, build_all]
env:
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base
REPO_PATH: github.com/prometheus/node_exporter
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
- name: Build docker image
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
make docker DOCKER_IMAGE_TAG=${{ github.ref_name }}
else
make docker
fi
- run: docker images
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
- name: Test docker image
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
make test-docker DOCKER_IMAGE_TAG=${{ github.ref_name }}
else
make test-docker
fi

publish_main:
name: Publish main branch artifacts
runs-on: ubuntu-latest
needs: [test_go, test_go_arm, build_all]
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: prometheus/promci/publish_main@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0
with:
docker_hub_login: ${{ secrets.docker_hub_login }}
docker_hub_password: ${{ secrets.docker_hub_password }}
quay_io_login: ${{ secrets.quay_io_login }}
quay_io_password: ${{ secrets.quay_io_password }}

publish_release:
name: Publish release artifacts
runs-on: ubuntu-latest
needs: [test_go, test_go_arm, build_all]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: prometheus/promci/publish_release@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0
with:
docker_hub_login: ${{ secrets.docker_hub_login }}
docker_hub_password: ${{ secrets.docker_hub_password }}
quay_io_login: ${{ secrets.quay_io_login }}
quay_io_password: ${{ secrets.quay_io_password }}
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}
Loading