Skip to content

Commit 1e99209

Browse files
committed
Migrate to PromCI
Migrate to PromCI GitHub Actions * Fixup end-to-end test to work with Actions services. * Update Go to 1.26.x. Signed-off-by: SuperQ <superq@gmail.com>
1 parent 84a17f7 commit 1e99209

7 files changed

Lines changed: 178 additions & 125 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
name: CI
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main, master, 'release-*']
7+
tags: ['v*']
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test_go:
14+
name: Go tests
15+
runs-on: ubuntu-latest
16+
container:
17+
# Whenever the Go version is updated here, .promu.yml
18+
# should also be updated.
19+
image: quay.io/prometheus/golang-builder:1.26-base
20+
steps:
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
- uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0
23+
- run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1
24+
25+
26+
build:
27+
name: Build
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
thread: [ 0, 1, 2, 3]
32+
steps:
33+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
34+
- uses: prometheus/promci/build@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0
35+
with:
36+
parallelism: 4
37+
thread: ${{ matrix.thread }}
38+
39+
integration:
40+
name: Integration test
41+
runs-on: ubuntu-latest
42+
needs: [test_go, build]
43+
container:
44+
# Whenever the Go version is updated here, .promu.yml
45+
# should also be updated.
46+
image: quay.io/prometheus/golang-builder:1.26-base
47+
services:
48+
node-exporter:
49+
image: quay.io/prometheus/node-exporter:latest
50+
prometheus:
51+
image: quay.io/prometheus/prometheus:latest
52+
command: |
53+
--config.file=/etc/prometheus/prometheus.yml
54+
--storage.tsdb.path=/prometheus
55+
--web.enable-lifecycle
56+
volumes:
57+
- ./end-to-end/:/etc/prometheus/
58+
env:
59+
NODE_EXPORTER_HOST: node-exporter
60+
PROMETHEUS_HOST: prometheus
61+
steps:
62+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
63+
- uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
64+
- run: cp -v .build/linux-amd64/pushprox-client ./
65+
- run: cp -v .build/linux-amd64/pushprox-proxy ./
66+
#- run: cp -v end-to-end/prometheus.yml promcfg/prometheus.yml
67+
- run: ls -l end-to-end/prometheus.yml
68+
- run: cat end-to-end/prometheus.yml
69+
- run: curl -X POST -v -f -L http://prometheus:9090/-/reload
70+
- run: ./end-to-end/test.sh
71+
72+
publish_main:
73+
name: Publish main branch artifacts
74+
runs-on: ubuntu-latest
75+
needs: [test_go, build]
76+
if: |
77+
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
78+
||
79+
(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
80+
steps:
81+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
82+
- uses: prometheus/promci/publish_main@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0
83+
with:
84+
docker_hub_organization: prometheuscommunity
85+
docker_hub_password: ${{ secrets.docker_hub_password }}
86+
quay_io_organization: prometheuscommunity
87+
quay_io_password: ${{ secrets.quay_io_password }}
88+
89+
publish_release:
90+
name: Publish release artefacts
91+
runs-on: ubuntu-latest
92+
needs: [test_go, build]
93+
if: |
94+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
95+
steps:
96+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
97+
- uses: prometheus/promci/publish_release@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0
98+
with:
99+
docker_hub_organization: prometheuscommunity
100+
docker_hub_password: ${{ secrets.docker_hub_password }}
101+
quay_io_organization: prometheuscommunity
102+
quay_io_password: ${{ secrets.quay_io_password }}
103+
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}

.promu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
go:
2-
# This must match .circle/config.yml.
3-
version: 1.25
2+
# This must match .github/workflows/ci.yml.
3+
version: 1.26
44
repository:
55
path: github.com/prometheus-community/pushprox
66
build:

end-to-end-test.sh

Lines changed: 0 additions & 51 deletions
This file was deleted.

end-to-end/prometheus.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
global:
2+
scrape_interval: 1s
3+
scrape_configs:
4+
- job_name: pushprox
5+
proxy_url: http://172.17.0.1:8080
6+
static_configs:
7+
- targets:
8+
- node-exporter:9100

end-to-end/test.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env bash
2+
3+
set -u -o pipefail
4+
5+
node_exporter_host=${NODE_EXPORTER_HOST:-localhost}
6+
prometheus_host=${PROMETHEUS_HOST:-localhost}
7+
8+
tmpdir=$(mktemp -d /tmp/pushprox_e2e_test.XXXXXX)
9+
10+
cleanup() {
11+
for f in "${tmpdir}"/*.pid ; do
12+
kill -9 "$(< $f)"
13+
done
14+
rm -r "${tmpdir}"
15+
}
16+
17+
trap cleanup EXIT
18+
19+
if type node_exporter > /dev/null 2>&1 ; then
20+
node_exporter &
21+
echo $! > "${tmpdir}/node_exporter.pid"
22+
fi
23+
while ! curl -s -f -L "http://${node_exporter_host}:9100" > /dev/null; do
24+
echo "Waiting for node_exporter host=${node_exporter_host}"
25+
sleep 2
26+
done
27+
28+
if [[ ! -f 'pushprox-proxy' ]] ; then
29+
echo 'ERROR: Missing pushprox-proxy binary'
30+
exit 1
31+
fi
32+
./pushprox-proxy --log.level=debug &
33+
echo $! > "${tmpdir}/proxy.pid"
34+
while ! curl -s -f -L http://localhost:8080/clients > /dev/null; do
35+
echo 'Waiting for proxy'
36+
sleep 2
37+
done
38+
39+
if [[ ! -f 'pushprox-client' ]] ; then
40+
echo 'ERROR: Missing pushprox-client binary'
41+
exit 1
42+
fi
43+
./pushprox-client --log.level=debug --proxy-url=http://localhost:8080 &
44+
echo $! > "${tmpdir}/client.pid"
45+
while [ "$(curl -s -L 'http://localhost:8080/clients' | jq 'length')" != '1' ] ; do
46+
echo 'Waiting for client'
47+
sleep 2
48+
done
49+
50+
if type prometheus > /dev/null 2>&1 ; then
51+
prometheus --config.file=end-to-end/prometheus.yml --log.level=debug &
52+
echo $! > "${tmpdir}/prometheus.pid"
53+
fi
54+
while ! curl -s -f -L "http://${prometheus_host}:9090/-/ready"; do
55+
echo "Waiting for Prometheus host=${prometheus_host}"
56+
sleep 2
57+
done
58+
sleep 15
59+
60+
query="http://${prometheus_host}:9090/api/v1/query?query=node_exporter_build_info"
61+
while [ $(curl -s -L "${query}" | jq '.data.result | length') != '1' ]; do
62+
echo 'Waiting for results'
63+
sleep 2
64+
done

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/prometheus-community/pushprox
22

3-
go 1.24.0
3+
go 1.25.0
44

55
require (
66
github.com/Showmax/go-fqdn v1.0.0

0 commit comments

Comments
 (0)