Skip to content
Merged
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
88 changes: 0 additions & 88 deletions .circleci/config.yml

This file was deleted.

103 changes: 103 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
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 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: make
- run: git diff --exit-code

integration:
name: Integration tests (Consul ${{ matrix.consul_version }})
runs-on: ubuntu-latest
container:
# Whenever the Go version is updated here, .promu.yml should also be
# updated.
image: quay.io/prometheus/golang-builder:1.26-base
strategy:
matrix:
consul_version: ["1.18", "1.21", "1.22"]
services:
consul:
image: hashicorp/consul:${{ matrix.consul_version }}
env:
CONSUL_LOCAL_CONFIG: '{"node_name":"test"}'
env:
CONSUL_SERVER: "consul:8500"
CONSUL_NODE_NAME: "test"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- run: |
until curl -sf http://consul:8500/v1/agent/self > /dev/null; do sleep 1; done
CONSUL_VERSION=$(curl -s http://consul:8500/v1/agent/self | jq -r '.Config.Version')
test -n "$CONSUL_VERSION"
echo "CONSUL_VERSION=$CONSUL_VERSION" >> $GITHUB_ENV
- run: make test GOOPTS=-v
- run: git diff --exit-code

build:
name: Build consul_exporter for all architectures
runs-on: ubuntu-latest
strategy:
matrix:
thread: [ 0, 1, 2, 3]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: prometheus/promci/build@9347e3d5e607933687d9db7af2f23504fe7f893a # v0.6.2
with:
parallelism: 4
thread: ${{ matrix.thread }}

publish_main:
name: Publish main branch artifacts
runs-on: ubuntu-latest
needs: [test_go, integration, build]
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@9347e3d5e607933687d9db7af2f23504fe7f893a # v0.6.2
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, integration, build]
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@9347e3d5e607933687d9db7af2f23504fe7f893a # v0.6.2
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 }}
6 changes: 3 additions & 3 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
go:
# Whenever the Go version is updated here, .circle/config.yml should also
# be updated.
version: 1.25
# Whenever the Go version is updated here, .github/workflows/ci.yml should
# also be updated.
version: 1.26
repository:
path: github.com/prometheus/consul_exporter
build:
Expand Down
3 changes: 2 additions & 1 deletion pkg/exporter/consul_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
consul_api "github.com/hashicorp/consul/api"
"github.com/prometheus/client_golang/prometheus/testutil"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
)

Expand Down Expand Up @@ -275,7 +276,7 @@ consul_service_tag{node="{{ .Node }}",service_id="foobar",tag="tag2"} 1

// Only check metrics that are explicitly listed above.
var (
tp expfmt.TextParser
tp = expfmt.NewTextParser(model.UTF8Validation)
metricNames []string
buf = bytes.NewReader(w.Bytes())
)
Expand Down