From e4560e0d6407acf4ced5fa84fe3a857915110494 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com> Date: Mon, 26 Aug 2019 17:44:38 +0300 Subject: [PATCH] Add GH actions (#5949) Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com> --- .github/workflows/funcbench.yml | 19 +++++ .../workflows/prombench-cancel-benchmark.yml | 49 +++++++++++++ .../workflows/prombench-start-benchmark.yml | 71 +++++++++++++++++++ 3 files changed, 139 insertions(+) create mode 100644 .github/workflows/funcbench.yml create mode 100644 .github/workflows/prombench-cancel-benchmark.yml create mode 100644 .github/workflows/prombench-start-benchmark.yml diff --git a/.github/workflows/funcbench.yml b/.github/workflows/funcbench.yml new file mode 100644 index 000000000..ec7ae5b4e --- /dev/null +++ b/.github/workflows/funcbench.yml @@ -0,0 +1,19 @@ +on: issue_comment +name: Benchmark +jobs: + commentMonitor: + runs-on: ubuntu-latest + steps: + - name: commentMonitor + uses: docker://prombench/comment-monitor:latest + env: + COMMENT_TEMPLATE: 'The benchmark has started. We are comparing this PR agains + branch {{ index . "BRANCH" }}. You can run the same tests with command: `go + test -bench {{ index . "REGEX" }} -benchmem -race -v ./...` [Github Actions logs](https://github.com/{{ index . "GITHUB_REPOSITORY" }}/commit/{{ index . "GITHUB_SHA" }}/checks)' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: '"^/funcbench ?(?P[^ B\.]+)? ?(?P\.|Bench.*|[^ ]+)? ?(?P-no-race)?.*$" --no-verify-user' + - name: benchmark + uses: docker://prombench/funcbench:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/prombench-cancel-benchmark.yml b/.github/workflows/prombench-cancel-benchmark.yml new file mode 100644 index 000000000..28ba17187 --- /dev/null +++ b/.github/workflows/prombench-cancel-benchmark.yml @@ -0,0 +1,49 @@ +on: issue_comment +name: Prombench Cancel Benchmark +jobs: + pre_benchmark_cancel: + name: Pre Benchmark Cancel + runs-on: ubuntu-latest + steps: + - name: Validate comment + id: validate_comment + uses: docker://prombench/comment-monitor:0.0.1 + env: + COMMENT_TEMPLATE: | + Benchmark cancel is in progress + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: >- + "(?mi)^/prombench\s+cancel\s*$" + benchmark_cancel: + name: Benchmark Cancel + needs: pre_benchmark_cancel + runs-on: ubuntu-latest + steps: + - name: Extract arguments + id: extract_arguments + uses: docker://prombench/comment-monitor:0.0.1 + with: + args: >- + "(?mi)^/prombench\s+cancel\s*$" + - name: Delete StatefulSet to stop test + id: delete_test_ss + uses: docker://prombenchgeekodour/prombench:2.0.2 + env: + AUTH_FILE: ${{ secrets.AUTH_FILE }} + PROJECT_ID: prombench-gsoc + CLUSTER_NAME: ghaction-prom + ZONE: us-central1-a + TEST_INFRA_REPO: https://github.com/testpromorg/prombench.git + with: + args: >- + export PR_NUMBER=$(cat /github/home/commentMonitor/PR_NUMBER); + cd /prombench; + make delete_test_ss + - name: Post comment if delete_test_ss failed + id: fail_notification + if: failure() + uses: docker://prombench/comment-monitor:0.0.1 + env: + COMMENT_TEMPLATE: "prombench cancel failed" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/prombench-start-benchmark.yml b/.github/workflows/prombench-start-benchmark.yml new file mode 100644 index 000000000..6cde3d903 --- /dev/null +++ b/.github/workflows/prombench-start-benchmark.yml @@ -0,0 +1,71 @@ +on: issue_comment +name: Prombench Start Benchmark +jobs: + pre_benchmark_start: + name: Pre Benchmark Start + runs-on: ubuntu-latest + steps: + - name: Validate comment + id: validate_comment + uses: docker://prombench/comment-monitor:0.0.1 + env: + COMMENT_TEMPLATE: | + ⏱️ Welcome to Prometheus Benchmarking Tool. ⏱️ + + **Compared versions:** **`PR-{{ index . "PR_NUMBER" }}`** and **`{{ index . "RELEASE" }}`** + + **Test deployment logs:** [{{ index . "DOMAIN_NAME" }}/grafana/explore](http://{{ index . "DOMAIN_NAME" }}/grafana/explore?orgId=1&left=%5B%22now-6h%22,%22now%22,%22loki-meta%22,%7B%22expr%22:%22%7Bjob%3D%5C%22default%2Fprombench-test-{{ index . "PR_NUMBER" }}%5C%22%7D%22%7D,%7B%22mode%22:%22Logs%22%7D,%7B%22ui%22:%5Btrue,true,true,%22none%22%5D%7D%5D) + + After successful deployment, the benchmarking metrics can be viewed at: + + - [{{ index . "DOMAIN_NAME" }}/prometheus-meta](http://{{ index . "DOMAIN_NAME" }}/prometheus-meta/graph?g0.expr={namespace%3D"prombench-{{ index . "PR_NUMBER" }}"}&g0.tab=1) + - [{{ index . "DOMAIN_NAME" }}/grafana](http://{{ index . "DOMAIN_NAME" }}/grafana) + + The Prometheus servers being benchmarked : + - Prometheus [**PR** - \#{{ index . "PR_NUMBER" }} ](http://{{ index . "DOMAIN_NAME" }}/{{ index . "PR_NUMBER" }}/prometheus-pr) + - Prometheus [**RELEASE** - {{ index . "RELEASE" }}](http://{{ index . "DOMAIN_NAME" }}/{{ index . "PR_NUMBER" }}/prometheus-release) + + To stop comment `/prombench cancel`. + LABEL_NAME: prombench + DOMAIN_NAME: prombench.geekodour.xyz + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: >- + "(?mi)^/prombench\s*(?Pmaster|v[0-9]+\.[0-9]+\.[0-9]+\S*)\s*$" + benchmark_start: + name: Benchmark Start + needs: pre_benchmark_start + runs-on: ubuntu-latest + steps: + - name: Extract arguments + id: extract_arguments + uses: docker://prombench/comment-monitor:0.0.1 + with: + args: >- + "(?mi)^/prombench\s*(?Pmaster|v[0-9]+\.[0-9]+\.[0-9]+\S*)\s*$" + - name: Create StatefulSet to start test + id: create_test_ss + uses: docker://prombenchgeekodour/prombench:2.0.2 + env: + AUTH_FILE: ${{ secrets.AUTH_FILE }} + PROJECT_ID: prombench-gsoc + CLUSTER_NAME: ghaction-prom + ZONE: us-central1-a + DOMAIN_NAME: prombench.geekodour.xyz + TEST_INFRA_REPO: https://github.com/testpromorg/prombench.git + GITHUB_ORG: prometheus-community + GITHUB_REPO: prometheus + with: + args: >- + ls -la; + export RELEASE=$(cat /github/home/commentMonitor/RELEASE); + export PR_NUMBER=$(cat /github/home/commentMonitor/PR_NUMBER); + cd /prombench; + make create_test_ss + - name: Post comment if create_test_ss failed + id: fail_notification + if: failure() + uses: docker://prombench/comment-monitor:0.0.1 + env: + COMMENT_TEMPLATE: "prombench start failed" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file