Skip to content

Send slack notification when IDE integration tests fails #8673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .werft/integration-tests-startup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ pod:
echo "using integration-test image: ${INTEGRATION_VERSION}" | werft log slice "test"


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)
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)

echo "running integration, job name: ${TEST_BUILD_ID}" | werft log slice "test"
werft log result -d "integration test job" url "https://werft.gitpod-dev.com/job/${TEST_BUILD_ID}"

if ! werft job logs ${TEST_BUILD_ID} | werft log slice "test";
then
echo "ingetration test failed" | werft log slice "test"
echo "integration test failed" | werft log slice "test"
exit 1
fi
echo "ingetration test success" | werft log slice "test"
echo "integration test success" | werft log slice "test"
20 changes: 19 additions & 1 deletion .werft/run-integration-tests-ide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ pod:
secretKeyRef:
name: github-roboquat-automatic-changelog
key: token
- name: SLACK_NOTIFICATION_PATH
valueFrom:
secretKeyRef:
name: slack-webhook-urls
key: ide_jobs
command:
- /bin/bash
- -c
- |
sleep 1
set -Eeuo pipefail

printf '{{ toJson .Annotations }}' > context.json
printf '{{ toJson . }}' > context.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this broken JetBrains integration, but will fix in next PR


echo "[prep] receiving config..."
export GOOGLE_APPLICATION_CREDENTIALS="/config/gcloud/legacy_credentials/cd-gitpod-deployer@gitpod-core-dev.iam.gserviceaccount.com/adc.json"
Expand All @@ -104,6 +109,19 @@ pod:

RC=${PIPESTATUS[0]}
if [ $RC -eq 1 ]; then
context_name=$(jq -r '.Name' context.json)
context_host=$(jq -r '.Repository.host' context.json)
context_owner=$(jq -r '.Repository.owner' context.json)
context_repo=$(jq -r '.Repository.repo' context.json)
repo="${context_host}/${context_owner}/${context_repo}"
title=":X: *IDE integration test failure*\n_Repo:_ ${context_repo}\n_Build:_ ${context_name}";
werftJobUrl="https://werft.gitpod-dev.com/job/${context_name}"
body="Some IDE integration test failed, please check the werf job logs and fix them"
curl -X POST \
-H 'Content-type: application/json' \
-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\`\`\`\"}}]}" \
"https://hooks.slack.com/${SLACK_NOTIFICATION_PATH}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also send a notification of success?

echo "[int-tests|FAIL]"
else
echo "[int-tests|DONE]"
Expand Down
3 changes: 2 additions & 1 deletion test/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN apk upgrade --no-cache \
&& apk add --no-cache \
ca-certificates \
coreutils \
curl
curl \
jq

# convenience scripting tools
RUN apk add --no-cache bash moreutils
Expand Down