-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
- Loading branch information
1 parent
cca6d12
commit a3f3ef2
Showing
4 changed files
with
143 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,33 @@ | ||
--- | ||
version: 2.1 | ||
# Prometheus has switched to GitHub action. | ||
# Circle CI is not disabled repository-wise so that previous pull requests | ||
# continue working. | ||
# This file does not generate any CircleCI workflow. | ||
|
||
orbs: | ||
prometheus: prometheus/prometheus@0.16.0 | ||
version: 2.1 | ||
|
||
executors: | ||
test: | ||
parameters: | ||
consul_version: | ||
type: string | ||
golang: | ||
docker: | ||
# Whenever the Go version is updated here, .promu.yml should also be updated. | ||
- image: cimg/go:1.19 | ||
- image: consul:<< parameters.consul_version >> | ||
name: consul | ||
environment: | ||
CONSUL_LOCAL_CONFIG: '{"node_name":"test"}' | ||
environment: | ||
CONSUL_SERVER: consul:8500 | ||
CONSUL_NODE_NAME: test | ||
- image: busybox | ||
|
||
jobs: | ||
test: | ||
parameters: | ||
exec: | ||
type: executor | ||
|
||
executor: << parameters.exec >> | ||
noopjob: | ||
executor: golang | ||
|
||
steps: | ||
- prometheus/setup_environment | ||
- run: go mod download | ||
- run: make | ||
- run: git diff --exit-code | ||
- prometheus/store_artifact: | ||
file: consul_exporter | ||
- store_test_results: | ||
path: test-results | ||
- run: | ||
command: "true" | ||
|
||
workflows: | ||
version: 2 | ||
prometheus: | ||
jobs: | ||
- test: | ||
name: test-penultimate | ||
exec: | ||
name: test | ||
consul_version: "1.7" | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- test: | ||
name: test-latest | ||
exec: | ||
name: test | ||
consul_version: "1.8" | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- prometheus/build: | ||
name: build | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- prometheus/publish_master: | ||
context: org-context | ||
requires: | ||
- test-penultimate | ||
- test-latest | ||
- build | ||
filters: | ||
branches: | ||
only: master | ||
- prometheus/publish_release: | ||
context: org-context | ||
requires: | ||
- test-penultimate | ||
- test-latest | ||
- build | ||
filters: | ||
tags: | ||
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ | ||
branches: | ||
ignore: /.*/ | ||
- noopjob | ||
triggers: | ||
- schedule: | ||
cron: "0 0 30 2 *" | ||
filters: | ||
branches: | ||
only: | ||
- main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Setup consul | ||
inputs: | ||
version: | ||
type: string | ||
description: Consul version | ||
runs: | ||
using: composite | ||
steps: | ||
- run: curl -Lo consul.zip https://releases.hashicorp.com/consul/${{ inputs.version }}/consul_${{ inputs.version }}_linux_amd64.zip | ||
shell: bash | ||
- run: unzip consul.zip | ||
shell: bash | ||
- run: ./consul agent -dev & | ||
shell: bash | ||
env: | ||
CONSUL_LOCAL_CONFIG: '{"node_name":"test"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Test | ||
inputs: | ||
consul_version: | ||
type: string | ||
description: Consul version | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: prometheus/promci@v0.0.2 | ||
- uses: ./.github/promci/actions/setup_environment | ||
- uses: ./.github/actions/setup_consul | ||
with: | ||
version: ${{ inputs.consul_version }} | ||
- run: make | ||
shell: bash | ||
env: | ||
CONSUL_SERVER: localhost:8500 | ||
CONSUL_NODE_NAME: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
name: CI | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
jobs: | ||
test_latest: | ||
name: Test with latest consul | ||
runs-on: ubuntu-latest | ||
# Whenever the Go version is updated here, .promu.yml | ||
# should also be updated. | ||
container: | ||
image: quay.io/prometheus/golang-builder:1.19-base | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/test | ||
with: | ||
consul_version: 1.14.3 | ||
test_older: | ||
name: Test with older consul | ||
runs-on: ubuntu-latest | ||
# Whenever the Go version is updated here, .promu.yml | ||
# should also be updated. | ||
container: | ||
image: quay.io/prometheus/golang-builder:1.19-base | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/test | ||
with: | ||
consul_version: 1.12.18 | ||
|
||
build: | ||
name: Build Consul Exporter | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
thread: [ 0, 1, 2, 3, 4, 5 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: prometheus/promci@v0.0.2 | ||
- uses: ./.github/promci/actions/build | ||
with: | ||
parallelism: 6 | ||
thread: ${{ matrix.thread }} | ||
|
||
golangci: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '<1.19' | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v3.2.0 | ||
with: | ||
version: v1.49.0 | ||
|
||
publish_main: | ||
name: Publish main branch artifacts | ||
runs-on: ubuntu-latest | ||
needs: [test_latest, test_older, build] | ||
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: prometheus/promci@v0.0.2 | ||
- uses: ./.github/promci/actions/publish_main | ||
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 arfefacts | ||
runs-on: ubuntu-latest | ||
needs: [test_latest, test_older, build] | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: prometheus/promci@v0.0.2 | ||
- uses: ./.github/promci/actions/publish_release | ||
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 }} |