35
35
36
36
function cleanup ()
37
37
{
38
- werft run github -a namespace=staging-gitpod-test-main --remote-job-path .werft/wipe-devstaging.yaml github.com/gitpod-io/gitpod:main
39
- }
38
+ 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)
40
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
+ }
41
44
42
- echo "[prep] preparing config."
45
+ echo "preparing config." | werft log slice prepare
43
46
gcloud auth activate-service-account --key-file /mnt/secrets/gcp-sa/service-account.json
44
47
export GOOGLE_APPLICATION_CREDENTIALS="/home/gitpod/.config/gcloud/legacy_credentials/[email protected] /adc.json"
45
48
export DOCKER_HOST=tcp://$NODENAME:2375
46
- echo "[prep] copied config..."
47
- echo "[prep|DONE]"
49
+ echo "copied config..." | werft log slice prepare
50
+ werft log slice prepare --done
48
51
52
+ werft log phase "build preview environment" "build preview environment"
49
53
# this is because we don't want to increate gitpod-build-main number, we can choose a name
50
54
sudo cp .werft/build.yaml .werft/test.yaml
51
55
# version is actual namespace that werft is build, --job-file should be same with above
52
- VERSION=$(werft run github -j .werft/test.yaml github.com/gitpod-io/gitpod:main)
53
- echo "[build test environment] start ${VERSION}"
56
+ VERSION=$(werft run github -j .werft/test.yaml -s .werft/test.yaml github.com/gitpod-io/gitpod:main)
57
+ echo "start build preview environment, job name: ${VERSION}, this will take long time" | werft log slice "build test environment"
58
+ werft log result -d "build job" url "https://werft.gitpod-dev.com/job/${VERSION}"
54
59
55
- # clean preview environment when the script exits
56
- trap cleanup SIGINT SIGTERM EXIT
57
60
58
61
until werft job get ${VERSION} -o yaml | yq r - "phase" | grep '4' > /dev/null; do
59
- sleep 1
62
+ echo "continue waiting" | werft log slice "build test environment"
63
+ sleep 10
60
64
done
61
- echo "[build test environment] done"
62
- echo "[build test environment|DONE]"
63
65
64
- # we need get integration-test version like: jp-run-integration-test.61
66
+ if ! werft job get ${VERSION} -o yaml | yq r - "conditions.success" | grep "true" > /dev/null;
67
+ then
68
+ echo "build failed" | werft log slice "build test environment"
69
+ exit 1
70
+ fi
71
+ echo "build success" | werft log slice "build test environment"
72
+ werft log slice "build test environment" --done
65
73
74
+ # clean preview environment when the script exits
75
+ trap cleanup SIGINT SIGTERM EXIT
76
+
77
+ werft log phase "integration test" "integration test"
78
+ # we need get integration-test version like: jp-run-integration-test.61
66
79
# INTEGRATION_VERSION=$(docker run eu.gcr.io/gitpod-core-dev/build/versions:${VERSION} cat versions.yaml | yq r - 'components.integrationTest.version')
67
80
68
81
# only for test now
69
82
INTEGRATION_VERSION=jp-run-integration-test.80
70
- echo "[version] ${INTEGRATION_VERSION}"
83
+ echo "using integration-test image: ${INTEGRATION_VERSION}" | werft log slice "test"
84
+
71
85
72
86
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)
87
+
88
+ echo "running integration, job name: ${TEST_BUILD_ID}" | werft log slice "test"
89
+ werft log result -d "integration test job" url "https://werft.gitpod-dev.com/job/${TEST_BUILD_ID}"
73
90
until werft job get ${TEST_BUILD_ID} -o yaml | yq r - "phase" | grep '4' > /dev/null; do
74
91
sleep 1
75
92
done
76
93
77
- werft job get ${TEST_BUILD_ID} -o yaml | yq r - "conditions.success" > /dev/null | grep "true"
94
+
95
+ if ! werft job get ${TEST_BUILD_ID} -o yaml | yq r - "conditions.success" | grep "true" > /dev/null;
96
+ then
97
+ echo "ingetration test failed" | werft log slice "test"
98
+ exit 1
99
+ fi
100
+ echo "ingetration test success" | werft log slice "test"
0 commit comments