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