From e77ecdd4c5cc28b6464ea0ba8688d09aa05b9e7b Mon Sep 17 00:00:00 2001
From: Yaroslav Lobankov <y.lobankov@tarantool.org>
Date: Tue, 26 Apr 2022 18:35:45 +0300
Subject: [PATCH] ci: add facility to run sysbench WF in debug mode

The perf_sysbench.yml workflow has the 'workflow_dispatch' trigger
that is often used to test some workflow changes. To not litter in
the InfluxDB prod bucket, MyTeam chat and mailing list, the special
option is added (Debug mode). When checking this option the InfluxDB
test bucket, MyTeam chat, and mailing list will be used.

NO_DOC=ci
NO_TEST=ci
NO_CHANGELOG=ci
---
 .github/workflows/perf_sysbench.yml | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/perf_sysbench.yml b/.github/workflows/perf_sysbench.yml
index aa798629cb..4aa12d681b 100644
--- a/.github/workflows/perf_sysbench.yml
+++ b/.github/workflows/perf_sysbench.yml
@@ -5,6 +5,13 @@ on:
     tags:
       - '*'
   workflow_dispatch:
+    inputs:
+      debug:
+        description: |
+          Debug mode (use InfluxDB test bucket, MyTeam chat, and mailing list)
+        default: false
+        required: false
+        type: boolean
   schedule:
     - cron: '0 1 * * *'
 
@@ -78,9 +85,11 @@ jobs:
       - name: Publish metrics to database
         env:
           INFLUXDB_ORG: tarantool
-          INFLUXDB_BUCKET: perf
+          INFLUXDB_BUCKET: ${{ github.event.inputs.debug == 'true' &&
+            'perf-debug' || 'perf' }}
           INFLUXDB_URL: ${{ secrets.INFLUXDB_URL }}
-          INFLUXDB_TOKEN: ${{ secrets.INFLUXDB_TOKEN }}
+          INFLUXDB_TOKEN: ${{ github.event.inputs.debug == 'true' &&
+            secrets.INFLUXDB_TOKEN_DEBUG || secrets.INFLUXDB_TOKEN }}
         run: |
           ./bench-run/publishing/influxdb.py \
             --measurement sysbench \
@@ -102,7 +111,8 @@ jobs:
         env:
           MYTEAM_URL: ${{ secrets.MYTEAM_URL }}
           MYTEAM_TOKEN: ${{ secrets.MYTEAM_TOKEN }}
-          MYTEAM_CHAT_ID: ${{ secrets.MYTEAM_CHAT_ID }}
+          MYTEAM_CHAT_ID: ${{ github.event.inputs.debug == 'true' &&
+            secrets.MYTEAM_CHAT_ID_DEBUG || secrets.MYTEAM_CHAT_ID }}
         run: |
           ./bench-run/reporting/myteam.py \
             --message-file sysbench_result_table.txt \
@@ -122,7 +132,9 @@ jobs:
             Tarantool Perf Testing. Branch: ${{ github.ref_name }}.
             Build: ${{ steps.tarantool-version.outputs.value }}.
             Test: sysbench
-          to: ${{ secrets.PERF_EMAIL_RECIPIENTS }}
+          to: ${{ github.event.inputs.debug == 'true' &&
+            secrets.PERF_EMAIL_RECIPIENTS_DEBUG ||
+            secrets.PERF_EMAIL_RECIPIENTS }}
           from: ${{ secrets.PERF_EMAIL_SENDER }}
           html_body: file://sysbench_result_table.html
           ignore_cert: false
-- 
GitLab