Skip to content

Commit af79008

Browse files
jeanp413roboquat
authored andcommitted
Send slack notification in IDE integration tests
1 parent 214f2ff commit af79008

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.werft/integration-tests-startup.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ pod:
7777
echo "using integration-test image: ${INTEGRATION_VERSION}" | werft log slice "test"
7878
7979
80-
TEST_BUILD_ID=$(werft run github -a version=${INTEGRATION_VERSION} -a namespace=staging-gitpod-test-main -j .werft/run-integration-tests-ide.yaml -a testPattern=ide.test github.com/gitpod-io/gitpod:main)
80+
TEST_BUILD_ID=$(werft run github -a version=${INTEGRATION_VERSION} -a namespace=staging-gitpod-test-main -j .werft/run-integration-tests-ide.yaml -a testPattern=vscode.test github.com/gitpod-io/gitpod:main)
8181
8282
echo "running integration, job name: ${TEST_BUILD_ID}" | werft log slice "test"
8383
werft log result -d "integration test job" url "https://werft.gitpod-dev.com/job/${TEST_BUILD_ID}"
8484
8585
if ! werft job logs ${TEST_BUILD_ID} | werft log slice "test";
8686
then
87-
echo "ingetration test failed" | werft log slice "test"
87+
echo "integration test failed" | werft log slice "test"
8888
exit 1
8989
fi
90-
echo "ingetration test success" | werft log slice "test"
90+
echo "integration test success" | werft log slice "test"

.werft/run-integration-tests-ide.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,19 @@ pod:
7272
secretKeyRef:
7373
name: github-roboquat-automatic-changelog
7474
key: token
75+
- name: SLACK_NOTIFICATION_PATH
76+
valueFrom:
77+
secretKeyRef:
78+
name: slack-webhook-urls
79+
key: ide_jobs
7580
command:
7681
- /bin/bash
7782
- -c
7883
- |
7984
sleep 1
8085
set -Eeuo pipefail
8186
82-
printf '{{ toJson .Annotations }}' > context.json
87+
printf '{{ toJson . }}' > context.json
8388
8489
echo "[prep] receiving config..."
8590
export GOOGLE_APPLICATION_CREDENTIALS="/config/gcloud/legacy_credentials/cd-gitpod-deployer@gitpod-core-dev.iam.gserviceaccount.com/adc.json"
@@ -104,6 +109,19 @@ pod:
104109
105110
RC=${PIPESTATUS[0]}
106111
if [ $RC -eq 1 ]; then
112+
context_name=$(jq -r '.Name' context.json)
113+
context_host=$(jq -r '.Repository.host' context.json)
114+
context_owner=$(jq -r '.Repository.owner' context.json)
115+
context_repo=$(jq -r '.Repository.repo' context.json)
116+
repo="${context_host}/${context_owner}/${context_repo}"
117+
title=":X: *IDE integration test failure*\n_Repo:_ ${context_repo}\n_Build:_ ${context_name}";
118+
werftJobUrl="https://werft.gitpod-dev.com/job/${context_name}"
119+
body="Some IDE integration test failed, please check the werf job logs and fix them"
120+
curl -X POST \
121+
-H 'Content-type: application/json' \
122+
-d "{\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"${title}\"},\"accessory\":{\"type\":\"button\",\"text\":{\"type\":\"plain_text\",\"text\":\"Go to Werft\",\"emoji\":true},\"value\":\"click_me_123\",\"url\":\"${werftJobUrl}\",\"action_id\":\"button-action\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"\`\`\`\\n${body}\\n\`\`\`\"}}]}" \
123+
"https://hooks.slack.com/${SLACK_NOTIFICATION_PATH}"
124+
107125
echo "[int-tests|FAIL]"
108126
else
109127
echo "[int-tests|DONE]"

test/leeway.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ RUN apk upgrade --no-cache \
99
&& apk add --no-cache \
1010
ca-certificates \
1111
coreutils \
12-
curl
12+
curl \
13+
jq
1314

1415
# convenience scripting tools
1516
RUN apk add --no-cache bash moreutils

0 commit comments

Comments
 (0)