Skip to content

Commit 6f38d38

Browse files
iQQBotroboquat
authored andcommitted
use new branch for integration test
1 parent be9b4eb commit 6f38d38

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

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

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ pod:
2020
valueFrom:
2121
fieldRef:
2222
fieldPath: spec.nodeName
23+
- name: ROBOQUAT_TOKEN
24+
valueFrom:
25+
secretKeyRef:
26+
name: github-roboquat-automatic-changelog
27+
key: token
2328
volumeMounts:
2429
- name: gcp-sa
2530
mountPath: /mnt/secrets/gcp-sa
@@ -33,54 +38,63 @@ pod:
3338
- |
3439
set -euo pipefail
3540
41+
BRANCH="inte-test/"$(date +%Y%m%d%H%M%S)
42+
3643
function cleanup ()
3744
{
38-
werft log phase "cleanup preview environment" "cleanup preview environment"
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)
40-
41-
echo "start cleanup preview environment, job name: ${BUILD_ID}" | werft log slice "cleanup"
42-
werft log result -d "cleanup job" url "https://werft.gitpod-dev.com/job/${BUILD_ID}"
43-
44-
werft job logs ${BUILD_ID} | werft log slice "cleanup"
45+
git push origin :$BRANCH
4546
}
4647
48+
source ./dev/preview/util/preview-name-from-branch.sh
49+
4750
echo "preparing config." | werft log slice prepare
4851
sudo chown -R gitpod:gitpod /workspace
4952
gcloud auth activate-service-account --key-file /mnt/secrets/gcp-sa/service-account.json
5053
export GOOGLE_APPLICATION_CREDENTIALS="/home/gitpod/.config/gcloud/legacy_credentials/[email protected]/adc.json"
54+
55+
git config --global user.name roboquat
56+
git config --global user.email [email protected]
57+
git remote set-url origin https://oauth2:[email protected]/gitpod-io/gitpod.git
58+
5159
echo "copied config..." | werft log slice prepare
5260
go install github.com/csweichel/oci-tool@latest 2>&1 | werft log slice prepare
5361
werft log slice prepare --done
5462
5563
werft log phase "build preview environment" "build preview environment"
56-
# this is because we don't want to increate gitpod-build-main number, we can choose a name
57-
cp .werft/build.yaml .werft/test.yaml
58-
# version is actual namespace that werft is build, --job-file should be same with above
59-
VERSION=$(werft run github -j .werft/test.yaml -a version=gitpod-test-main github.com/gitpod-io/gitpod:main)
60-
echo "start build preview environment, job name: ${VERSION}, this will take long time" | werft log slice "build test environment"
61-
werft log result -d "build job" url "https://werft.gitpod-dev.com/job/${VERSION}"
64+
echo integration test >> README.md
65+
git checkout -B $BRANCH
66+
git add README.md
67+
git commit -m "integration test"
68+
git push --set-upstream origin $BRANCH
69+
trap cleanup SIGINT SIGTERM EXIT
70+
71+
BUILD_ID=$(werft job list repo.ref==refs/heads/${BRANCH} -o yaml | yq r - "result[0].name")
72+
until [ "$BUILD_ID" != "" ]
73+
do
74+
sleep 1
75+
BUILD_ID=$(werft job list repo.ref==refs/heads/${BRANCH} -o yaml | yq r - "result[0].name")
76+
done
77+
echo "start build preview environment, job name: ${BUILD_ID}, this will take long time" | werft log slice "build test environment"
78+
werft log result -d "build job" url "https://werft.gitpod-dev.com/job/${BUILD_ID}"
6279
63-
if ! werft job logs ${VERSION} | werft log slice "build test environment";
80+
if ! werft job logs ${BUILD_ID} | werft log slice "build test environment";
6481
then
6582
echo "build failed" | werft log slice "build test environment"
6683
exit 1
6784
fi
6885
echo "build success" | werft log slice "build test environment"
6986
werft log slice "build test environment" --done
7087
71-
# clean preview environment when the script exits
72-
trap cleanup SIGINT SIGTERM EXIT
73-
7488
werft log phase "integration test" "integration test"
7589
# we need get integration-test version like: jp-run-integration-test.61
7690
77-
oci-tool fetch file eu.gcr.io/gitpod-core-dev/build/versions:gitpod-test-main versions.yaml
91+
oci-tool fetch file eu.gcr.io/gitpod-core-dev/build/versions:${BUILD_ID:13} versions.yaml
7892
INTEGRATION_VERSION=$(cat versions.yaml | yq r - 'components.integrationTest.version')
7993
8094
echo "using integration-test image: ${INTEGRATION_VERSION}" | werft log slice "test"
8195
82-
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.yaml -a testPattern=vscode.test github.com/gitpod-io/gitpod:main)
96+
NAMESPACE="$(preview-name-from-branch)"
97+
TEST_BUILD_ID=$(werft run github -a version=${INTEGRATION_VERSION} -a namespace=staging-${NAMESPACE} --remote-job-path .werft/ide-run-integration-tests.yaml -a testPattern=vscode.test)
8498
8599
echo "running integration, job name: ${TEST_BUILD_ID}" | werft log slice "test"
86100
werft log result -d "integration test job" url "https://werft.gitpod-dev.com/job/${TEST_BUILD_ID}"

0 commit comments

Comments
 (0)