diff --git a/.github/workflows/fake-e2e-grafana.yaml b/.github/workflows/fake-e2e-grafana.yaml new file mode 100644 index 00000000000..1892d40bcd3 --- /dev/null +++ b/.github/workflows/fake-e2e-grafana.yaml @@ -0,0 +1,178 @@ +name: fake-e2e-metrics-demo + +on: + push: + branches: [gha_grafana_metrics] + workflow_dispatch: + +jobs: + run-and-push: + runs-on: ubuntu-latest + env: + PUSH_URL: ${{ secrets.GRAFANA_PUSH_URL }} # e.g., https://prometheus-us-central1.grafana.net/api/prom/push + PUSH_USER: ${{ secrets.GRAFANA_USERNAME }} # e.g., 787878 + PUSH_PASS: ${{ secrets.GRAFANA_PASSWORD }} # e.g., eyJrIjoxxxxxxxxxxxxxxyMX0= + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Simulate e2e run & emit JSON metrics + id: fake + run: | + cat >cpu.json < metrics.txt + + - name: Create Prometheus config + run: | + cat >prometheus.yml < http.log 2>&1 + + - name: Run Prometheus + run: | + docker run -d --name prometheus -v $(pwd):/etc/prometheus -p 9090:9090 --link http-server prom/prometheus:latest --config.file=/etc/prometheus/prometheus.yml --web.listen-address=:9090 > prom.log 2>&1 + sleep 60 + curl http://localhost:9090/api/v1/query?query=e2e_cpu_seconds_total + + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: logs + path: | + prom.log + http.log