Skip to content

Commit ce7f01c

Browse files
iQQBotroboquat
authored andcommitted
Improve IDE integration test process
1 parent 85dfa45 commit ce7f01c

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
/operations/observability/mixins/cross-teams @gitpod-io/engineering-workspace @gitpod-io/engineering-webapp @gitpod-io/engineering-ide @gitpod-io/platform
7777
/.werft/observability @gitpod-io/platform
7878
/.werft/delete-preview-environments @gitpod-io/platform
79+
/.werft/ide @gitpod-io/engineering-ide
7980

8081
#
8182
# Automation

.werft/integration-tests-startup.yaml renamed to .werft/ide/integration-tests-startup.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pod:
3636
function cleanup ()
3737
{
3838
werft log phase "cleanup preview environment" "cleanup preview environment"
39-
BUILD_ID=$(werft run github -a namespace=staging-gitpod-test-main -j .werft/wipe-devstaging.yaml github.com/gitpod-io/gitpod:main)
39+
BUILD_ID=$(werft run github -a namespace=staging-gitpod-test-main --remote-job-path .werft/wipe-devstaging.yaml github.com/gitpod-io/gitpod:main)
4040
4141
echo "start cleanup preview environment, job name: ${BUILD_ID}" | werft log slice "cleanup"
4242
werft log result -d "cleanup job" url "https://werft.gitpod-dev.com/job/${BUILD_ID}"
@@ -45,17 +45,18 @@ pod:
4545
}
4646
4747
echo "preparing config." | werft log slice prepare
48+
sudo chown -R gitpod:gitpod /workspace
4849
gcloud auth activate-service-account --key-file /mnt/secrets/gcp-sa/service-account.json
4950
export GOOGLE_APPLICATION_CREDENTIALS="/home/gitpod/.config/gcloud/legacy_credentials/[email protected]/adc.json"
50-
export DOCKER_HOST=tcp://$NODENAME:2375
5151
echo "copied config..." | werft log slice prepare
52+
go install github.com/csweichel/oci-tool@latest 2>&1 | werft log slice prepare
5253
werft log slice prepare --done
5354
5455
werft log phase "build preview environment" "build preview environment"
5556
# this is because we don't want to increate gitpod-build-main number, we can choose a name
56-
sudo cp .werft/build.yaml .werft/test.yaml
57+
cp .werft/build.yaml .werft/test.yaml
5758
# version is actual namespace that werft is build, --job-file should be same with above
58-
VERSION=$(werft run github -j .werft/test.yaml -s .werft/test.yaml github.com/gitpod-io/gitpod:main)
59+
VERSION=$(werft run github -j .werft/test.yaml -a version=gitpod-test-main github.com/gitpod-io/gitpod:main)
5960
echo "start build preview environment, job name: ${VERSION}, this will take long time" | werft log slice "build test environment"
6061
werft log result -d "build job" url "https://werft.gitpod-dev.com/job/${VERSION}"
6162
@@ -72,12 +73,14 @@ pod:
7273
7374
werft log phase "integration test" "integration test"
7475
# we need get integration-test version like: jp-run-integration-test.61
75-
INTEGRATION_VERSION=$(docker run eu.gcr.io/gitpod-core-dev/build/versions:${VERSION} cat versions.yaml | yq r - 'components.integrationTest.version')
76+
77+
oci-tool fetch file eu.gcr.io/gitpod-core-dev/build/versions:gitpod-test-main versions.yaml
78+
INTEGRATION_VERSION=$(cat versions.yaml | yq r - 'components.integrationTest.version')
7679
7780
echo "using integration-test image: ${INTEGRATION_VERSION}" | werft log slice "test"
7881
7982
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)
83+
TEST_BUILD_ID=$(werft run github -a version=${INTEGRATION_VERSION} -a namespace=staging-gitpod-test-main --remote-job-path .werft/ide/run-integration-tests-ide.yaml -a testPattern=vscode.test github.com/gitpod-io/gitpod:main)
8184
8285
echo "running integration, job name: ${TEST_BUILD_ID}" | werft log slice "test"
8386
werft log result -d "integration test job" url "https://werft.gitpod-dev.com/job/${TEST_BUILD_ID}"

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,9 @@ pod:
8181
- /bin/bash
8282
- -c
8383
- |
84-
sleep 1
85-
set -Eeuo pipefail
84+
set -euo
8685
87-
printf '{{ toJson . }}' > context.json
86+
printf '{{ toJson .Annotations }}' > context.json
8887
8988
echo "[prep] receiving config..."
9089
export GOOGLE_APPLICATION_CREDENTIALS="/config/gcloud/legacy_credentials/[email protected]/adc.json"
@@ -108,21 +107,22 @@ pod:
108107
/entrypoint.sh "${args[@]}" 2>&1 | ts "[int-tests] "
109108
110109
RC=${PIPESTATUS[0]}
110+
context_name={{ .Name }}
111+
context_repo={{ .Repository.Repo }}
112+
werftJobUrl="https://werft.gitpod-dev.com/job/${context_name}"
113+
111114
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}"
115+
title=":X: *IDE integration test failure*"
119116
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-
125117
echo "[int-tests|FAIL]"
126118
else
119+
title=":white_check_mark: *IDE integration test success*";
120+
body="test success"
127121
echo "[int-tests|DONE]"
128122
fi
123+
title=$title"\n_Repo:_ ${context_repo}\n_Build:_ ${context_name}\n_TestPattern_: {{ .Annotations.testPattern }}";
124+
curl -X POST \
125+
-H 'Content-type: application/json' \
126+
-d "{\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"${title}\"},\"accessory\":{\"type\":\"button\",\"text\":{\"type\":\"plain_text\",\"text\":\":werft: Go to Werft\",\"emoji\":true},\"value\":\"click_me_123\",\"url\":\"${werftJobUrl}\",\"action_id\":\"button-action\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"\`\`\`\\n${body}\\n\`\`\`\"}}]}" \
127+
"https://hooks.slack.com/${SLACK_NOTIFICATION_PATH}"
128+
exit $RC

test/tests/ide/jetbrains/gateway_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ func TestJetBrainsGatewayWorkspace(t *testing.T) {
8282
t.Fatal(err)
8383
}
8484

85-
t.Logf("connecting to server...")
86-
server, err := api.GitpodServer(integration.WithGitpodUser(username))
85+
t.Logf("get or create user")
86+
_, err = api.CreateUser(username, userToken)
8787
if err != nil {
8888
t.Fatal(err)
8989
}
90-
t.Logf("connected to server")
9190

92-
t.Logf("get or create user")
93-
_, err = api.CreateUser(username, userToken)
91+
t.Logf("connecting to server...")
92+
server, err := api.GitpodServer(integration.WithGitpodUser(username))
9493
if err != nil {
9594
t.Fatal(err)
9695
}
96+
t.Logf("connected to server")
9797

9898
t.Logf("starting workspace")
9999
nfo, stopWs, err := integration.LaunchWorkspaceFromContextURL(ctx, "referrer:jetbrains-gateway:"+ideName+"/https://github.com/gitpod-io/spring-petclinic", username, api)

0 commit comments

Comments
 (0)