|
20 | 20 | valueFrom:
|
21 | 21 | fieldRef:
|
22 | 22 | fieldPath: spec.nodeName
|
| 23 | + - name: ROBOQUAT_TOKEN |
| 24 | + valueFrom: |
| 25 | + secretKeyRef: |
| 26 | + name: github-roboquat-automatic-changelog |
| 27 | + key: token |
23 | 28 | volumeMounts:
|
24 | 29 | - name: gcp-sa
|
25 | 30 | mountPath: /mnt/secrets/gcp-sa
|
|
33 | 38 | - |
|
34 | 39 | set -euo pipefail
|
35 | 40 |
|
| 41 | + BRANCH="inte-test/"$(date +%Y%m%d%H%M%S) |
| 42 | +
|
36 | 43 | function cleanup ()
|
37 | 44 | {
|
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 |
45 | 46 | }
|
46 | 47 |
|
| 48 | + source ./dev/preview/util/preview-name-from-branch.sh |
| 49 | +
|
47 | 50 | echo "preparing config." | werft log slice prepare
|
48 | 51 | sudo chown -R gitpod:gitpod /workspace
|
49 | 52 | gcloud auth activate-service-account --key-file /mnt/secrets/gcp-sa/service-account.json
|
50 | 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 | +
|
51 | 59 | echo "copied config..." | werft log slice prepare
|
52 | 60 | go install github.com/csweichel/oci-tool@latest 2>&1 | werft log slice prepare
|
53 | 61 | werft log slice prepare --done
|
54 | 62 |
|
55 | 63 | 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}" |
62 | 79 |
|
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"; |
64 | 81 | then
|
65 | 82 | echo "build failed" | werft log slice "build test environment"
|
66 | 83 | exit 1
|
67 | 84 | fi
|
68 | 85 | echo "build success" | werft log slice "build test environment"
|
69 | 86 | werft log slice "build test environment" --done
|
70 | 87 |
|
71 |
| - # clean preview environment when the script exits |
72 |
| - trap cleanup SIGINT SIGTERM EXIT |
73 |
| -
|
74 | 88 | werft log phase "integration test" "integration test"
|
75 | 89 | # we need get integration-test version like: jp-run-integration-test.61
|
76 | 90 |
|
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 |
78 | 92 | INTEGRATION_VERSION=$(cat versions.yaml | yq r - 'components.integrationTest.version')
|
79 | 93 |
|
80 | 94 | echo "using integration-test image: ${INTEGRATION_VERSION}" | werft log slice "test"
|
81 | 95 |
|
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) |
84 | 98 |
|
85 | 99 | echo "running integration, job name: ${TEST_BUILD_ID}" | werft log slice "test"
|
86 | 100 | werft log result -d "integration test job" url "https://werft.gitpod-dev.com/job/${TEST_BUILD_ID}"
|
|
0 commit comments