forked from camunda/camunda
-
Notifications
You must be signed in to change notification settings - Fork 1
172 lines (165 loc) · 7.01 KB
/
qa-testbench.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: QA Testbench run
on:
workflow_dispatch:
inputs:
generation:
description: 'Specifies the generation template which should be used by the testbench run'
required: false
default: 'Zeebe SNAPSHOT'
branch:
description: 'Specifies the branch, for which the QA Testbench run should be executed'
default: 'main'
required: false
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 23 * * *'
env:
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
jobs:
qa-testbench:
name: QA Testbench run
runs-on: ubuntu-latest
timeout-minutes: 45
env:
IMAGE: "gcr.io/zeebe-io/zeebe"
GENERATION_TEMPLATE: "${{ github.event.inputs.generation }}"
BRANCH_NAME: "${{ github.event.inputs.branch }}"
ZEEBE_AUTHORIZATION_SERVER_URL: 'https://login.cloud.ultrawombat.com/oauth/token'
ZEEBE_CLIENT_ID: 'S7GNoVCE6J-8L~OdFiI59kWM19P.wvKo'
steps:
# Dynamic environment variables are not supported by GHA
# https://brandur.org/fragments/github-actions-env-vars-in-env-vars
#
# Since we run the workflow either on demand or via schedule we need to assign some defaults
# Furthermore we have branches like stable/1.0 where we have to replace certain patterns, in order to use the branch name as docker image tag
- id: evaluate-inputs
name: Evaluate Inputs
run: |
branch=${BRANCH_NAME/\//-}
branch=${branch//\./-}
branch=${branch:-main}
echo "BRANCH_NAME=$branch" >> $GITHUB_ENV
echo "GENERATION_TEMPLATE=${GENERATION_TEMPLATE:-Zeebe SNAPSHOT}" >> $GITHUB_ENV
# We need to check out the evaluated branch and setup java (incl. maven), so we can retrieve the current project version
# The version is necessary, since CC Saas only accepts SemVer for docker image tags (need to start with a version tag)
- uses: actions/checkout@v3
with:
ref: "${{ github.event.inputs.branch }}"
- uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
# Set further environment variables, which are needed for the QA Testbench run
- id: set-env
name: Set environment variables
run: |
version=$(mvn help:evaluate -q -DforceStdout -D"expression=project.version")
tag="$version-$BRANCH_NAME-${GITHUB_SHA::8}"
echo "TAG=$tag" >> $GITHUB_ENV
echo "QA_RUN_VARIABLES={\"zeebeImage\": \"$IMAGE:$tag\", \"generationTemplate\": \"$GENERATION_TEMPLATE\", \"channel\": \"Internal Dev\", \"branch\": \"$BRANCH_NAME\", \"build\": \"$BUILD_URL\", \"businessKey\": \"$BUILD_URL\", \"processId\": \"qa-protocol\"}" >> $GITHUB_ENV
echo "BUSINESS_KEY=$BUILD_URL" >> $GITHUB_ENV
- name: Import Secrets
id: secrets
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
secrets: |
secret/data/products/zeebe/ci/zeebe ZEEBE_GCR_SERVICEACCOUNT_JSON;
secret/data/products/zeebe/ci/zeebe TESTBENCH_PROD_CLIENT_SECRET;
secret/data/products/zeebe/ci/zeebe TESTBENCH_PROD_CONTACT_POINT;
- name: Login to GCR
uses: docker/login-action@v2
with:
registry: gcr.io
username: _json_key
password: ${{ steps.secrets.outputs.ZEEBE_GCR_SERVICEACCOUNT_JSON }}
- uses: ./.github/actions/setup-zeebe
- uses: ./.github/actions/build-zeebe
id: build-zeebe
- uses: ./.github/actions/build-docker
with:
repository: ${{ env.IMAGE }}
version: ${{ env.TAG }}
push: true
distball: ${{ steps.build-zeebe.outputs.distball }}
# Executes the Testbench QA run and awaits the result
- name: Run Testbench QA
run: .ci/scripts/distribution/qa-testbench.sh
env:
ZEEBE_CLIENT_SECRET: ${{ steps.secrets.outputs.TESTBENCH_PROD_CLIENT_SECRET }}
ZEEBE_ADDRESS: ${{ steps.secrets.outputs.TESTBENCH_PROD_CONTACT_POINT }}
notify:
name: Send slack notification
runs-on: ubuntu-latest
needs: [qa-testbench]
if: ${{ always() }}
env:
GENERATION_TEMPLATE: "${{ github.event.inputs.generation }}"
BRANCH_NAME: "${{ github.event.inputs.branch }}"
steps:
# Sharing environment variables are not supported, so we have to do it here again
- id: evaluate-inputs
name: Evaluate Inputs
run: |
branch=${BRANCH_NAME:-main}
echo "BRANCH_NAME=$branch" >> $GITHUB_ENV
echo "GENERATION_TEMPLATE=${GENERATION_TEMPLATE:-Zeebe SNAPSHOT}" >> $GITHUB_ENV
- id: slack-failure-notify
name: Send failure slack notification
uses: slackapi/[email protected]
if: ${{ always() && needs.qa-testbench.result != 'success' }}
with:
payload: |
{
"text": ":alarm: QA run on `${{ env.BRANCH_NAME }}` with generation template `${{ env.GENERATION_TEMPLATE }}` failed! :alarm:\n ${{ env.BUILD_URL }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":alarm: QA run on `${{ env.BRANCH_NAME }}` with generation template `${{ env.GENERATION_TEMPLATE }}` failed! :alarm:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Please check: ${{ env.BUILD_URL }}\n \\cc @zeebe-medic"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- id: slack-success-notify
name: Send success slack notification
uses: slackapi/[email protected]
if: ${{ always() && needs.qa-testbench.result == 'success' }}
with:
payload: |
{
"text": ":tada: QA run succeeded on `${{ env.BRANCH_NAME }}` with generation template `${{ env.GENERATION_TEMPLATE }}`! :tada:\n ${{ env.BUILD_URL }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":tada: QA run succeeded on `${{ env.BRANCH_NAME }}` with generation template `${{ env.GENERATION_TEMPLATE }}`! :tada:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Nothing to check today. Good job! :clap:\n"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK