Browse Source

Add GH actions (#5949)

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
pull/5950/head
Krasi Georgiev 5 years ago committed by GitHub
parent
commit
e4560e0d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      .github/workflows/funcbench.yml
  2. 49
      .github/workflows/prombench-cancel-benchmark.yml
  3. 71
      .github/workflows/prombench-start-benchmark.yml

19
.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<BRANCH>[^ B\.]+)? ?(?P<REGEX>\.|Bench.*|[^ ]+)? ?(?P<RACE>-no-race)?.*$" --no-verify-user'
- name: benchmark
uses: docker://prombench/funcbench:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

49
.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 }}

71
.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*(?P<RELEASE>master|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*(?P<RELEASE>master|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 }}
Loading…
Cancel
Save