Skip to content

Commit fec51d8

Browse files
committed
enable integration test for JetBrains nightly job
1 parent d972037 commit fec51d8

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
pod:
2+
serviceAccount: werft
3+
nodeSelector:
4+
dev/workload: builds
5+
imagePullSecrets:
6+
- name: eu-gcr-io-pull-secret
7+
volumes:
8+
- name: gcp-sa
9+
secret:
10+
secretName: gcp-sa-gitpod-dev-deployer
11+
- name: config
12+
emptyDir: {}
13+
containers:
14+
- name: gcloud
15+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:clu-yq4.1
16+
workingDir: /workspace
17+
imagePullPolicy: Always
18+
env:
19+
- name: NODENAME
20+
valueFrom:
21+
fieldRef:
22+
fieldPath: spec.nodeName
23+
- name: ROBOQUAT_TOKEN
24+
valueFrom:
25+
secretKeyRef:
26+
name: github-roboquat-automatic-changelog
27+
key: token
28+
volumeMounts:
29+
- name: gcp-sa
30+
mountPath: /mnt/secrets/gcp-sa
31+
readOnly: true
32+
- name: config
33+
mountPath: /config
34+
readOnly: false
35+
command:
36+
- bash
37+
- -c
38+
- |
39+
set -euo pipefail
40+
41+
BRANCH="inte-test/"$(date +%Y%m%d%H%M%S)
42+
43+
function cleanup ()
44+
{
45+
git push origin :$BRANCH
46+
}
47+
48+
source ./dev/preview/util/preview-name-from-branch.sh
49+
50+
echo "preparing config." | werft log slice prepare
51+
sudo chown -R gitpod:gitpod /workspace
52+
gcloud auth activate-service-account --key-file /mnt/secrets/gcp-sa/service-account.json
53+
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+
59+
echo "copied config..." | werft log slice prepare
60+
go install github.com/csweichel/oci-tool@latest 2>&1 | werft log slice prepare
61+
werft log slice prepare --done
62+
63+
werft log phase "build preview environment" "build preview environment"
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}"
79+
80+
if ! werft job logs ${BUILD_ID} | werft log slice "build test environment";
81+
then
82+
echo "build failed" | werft log slice "build test environment"
83+
exit 1
84+
fi
85+
echo "build success" | werft log slice "build test environment"
86+
werft log slice "build test environment" --done
87+
88+
werft log phase "integration test" "integration test"
89+
90+
oci-tool fetch file eu.gcr.io/gitpod-core-dev/build/versions:${BUILD_ID:13} versions.yaml
91+
INTEGRATION_VERSION=$(cat versions.yaml | yq r - 'components.integrationTest.version')
92+
93+
echo "using integration-test image: ${INTEGRATION_VERSION}" | werft log slice "test"
94+
95+
NAMESPACE="$(preview-name-from-branch)"
96+
97+
JETBRAINS_IDE_LIST=(goland intellij phpstorm pycharm)
98+
BUILD_ID_LIST=()
99+
100+
for IDE in "${JETBRAINS_IDE_LIST[@]}"
101+
do
102+
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=jetbrains.test -a jetbrains-ide=${IDE})
103+
echo "running integration for ${IDE}, job name: ${TEST_BUILD_ID}" | werft log slice "test-${IDE}"
104+
werft log result -d "integration test for ${IDE} job" url "https://werft.gitpod-dev.com/job/${TEST_BUILD_ID}"
105+
werft job logs ${TEST_BUILD_ID} | werft log slice "test-${IDE}" &
106+
BUILD_ID_LIST[${#BUILD_ID_LIST[@]}]=$TEST_BUILD_ID
107+
sleep 2
108+
done
109+
wait
110+
plugins:
111+
cron: "0 2 * * *"

0 commit comments

Comments
 (0)