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
71 changes: 0 additions & 71 deletions .circleci/config.yml

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
name: CI
on:
pull_request:
push:
branches: [main, 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
- uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0
- run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1
- run: git diff --exit-code

build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
thread: [ 0, 1, 2, 3]
steps:
- uses: prometheus/promci/build@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2
with:
parallelism: 4
thread: ${{ matrix.thread }}

integration:
name: Integration test
runs-on: ubuntu-latest
needs: [test_go, build]
container:
# Whenever the Go version is updated here, .promu.yml
# should also be updated.
image: quay.io/prometheus/golang-builder:1.26-base
services:
node-exporter:
image: quay.io/prometheus/node-exporter:latest
env:
NODE_EXPORTER_HOST: node-exporter
PROMETHEUS_HOST: localhost
PROM_VERSION: 3.12.0
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
- run: cp -v .build/linux-amd64/pushprox-client ./
- run: cp -v .build/linux-amd64/pushprox-proxy ./
- run: curl -sSf -L https://github.com/prometheus/prometheus/releases/download/v${PROM_VERSION}/prometheus-${PROM_VERSION}.linux-amd64.tar.gz | tar xz
- run: echo ${PATH}
- run: cp -v prometheus-${PROM_VERSION}.linux-amd64/prometheus /bin/prometheus
- run: ./end-to-end/test.sh

publish_default:
name: Publish default branch artifacts
runs-on: ubuntu-latest
permissions:
packages: write
needs: [test_go, build]
if: |
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
||
(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
steps:
- uses: prometheus/promci/publish_main@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2
with:
docker_hub_organization: prometheuscommunity
docker_hub_password: ${{ secrets.docker_hub_password }}
ghcr_io_password: ${{ github.token }}
quay_io_organization: prometheuscommunity
quay_io_password: ${{ secrets.quay_io_password }}

publish_release:
name: Publish release artefacts
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
needs: [test_go, build]
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
steps:
- uses: prometheus/promci/publish_release@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2
with:
docker_hub_organization: prometheuscommunity
docker_hub_password: ${{ secrets.docker_hub_password }}
ghcr_io_password: ${{ github.token }}
quay_io_organization: prometheuscommunity
quay_io_password: ${{ secrets.quay_io_password }}
github_token: ${{ github.token }}
4 changes: 2 additions & 2 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
go:
# This must match .circle/config.yml.
version: 1.25
# This must match .github/workflows/ci.yml.
version: 1.26
repository:
path: github.com/prometheus-community/pushprox
build:
Expand Down
51 changes: 0 additions & 51 deletions end-to-end-test.sh

This file was deleted.

8 changes: 8 additions & 0 deletions end-to-end/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global:
scrape_interval: 1s
scrape_configs:
- job_name: pushprox
proxy_url: http://localhost:8080
static_configs:
- targets:
- node-exporter:9100
64 changes: 64 additions & 0 deletions end-to-end/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

set -u -o pipefail

node_exporter_host=${NODE_EXPORTER_HOST:-localhost}
prometheus_host=${PROMETHEUS_HOST:-localhost}

tmpdir=$(mktemp -d /tmp/pushprox_e2e_test.XXXXXX)

cleanup() {
for f in "${tmpdir}"/*.pid ; do
kill -9 "$(< $f)"
done
rm -r "${tmpdir}"
}

trap cleanup EXIT

if type node_exporter > /dev/null 2>&1 ; then
node_exporter &
echo $! > "${tmpdir}/node_exporter.pid"
fi
while ! curl -s -f -L "http://${node_exporter_host}:9100" > /dev/null; do
echo "Waiting for node_exporter host=${node_exporter_host}"
sleep 2
done

if [[ ! -f 'pushprox-proxy' ]] ; then
echo 'ERROR: Missing pushprox-proxy binary'
exit 1
fi
./pushprox-proxy --log.level=debug &
echo $! > "${tmpdir}/proxy.pid"
while ! curl -s -f -L http://localhost:8080/clients > /dev/null; do
echo 'Waiting for proxy'
sleep 2
done

if [[ ! -f 'pushprox-client' ]] ; then
echo 'ERROR: Missing pushprox-client binary'
exit 1
fi
./pushprox-client --log.level=debug --proxy-url=http://localhost:8080 &
echo $! > "${tmpdir}/client.pid"
while [ "$(curl -s -L 'http://localhost:8080/clients' | jq 'length')" != '1' ] ; do
echo 'Waiting for client'
sleep 2
done

if type prometheus > /dev/null 2>&1 ; then
prometheus --config.file=end-to-end/prometheus.yml --log.level=debug &
echo $! > "${tmpdir}/prometheus.pid"
fi
while ! curl -s -f -L "http://${prometheus_host}:9090/-/ready"; do
echo "Waiting for Prometheus host=${prometheus_host}"
sleep 2
done
sleep 15

query="http://${prometheus_host}:9090/api/v1/query?query=node_exporter_build_info"
while [ $(curl -s -L "${query}" | jq '.data.result | length') != '1' ]; do
echo 'Waiting for results'
sleep 2
done
Loading