1
1
name : Build
2
2
on :
3
3
pull_request :
4
- types : [ opened, edited ]
4
+ types : [opened, edited]
5
5
push :
6
6
workflow_dispatch :
7
7
inputs :
12
12
default : " false"
13
13
14
14
jobs :
15
+ create-runner :
16
+ uses : ./.github/workflows/create_runner.yml
17
+ secrets : inherit
18
+
15
19
configuration :
16
20
name : Configure job parameters
17
- runs-on : [ self-hosted ]
21
+ runs-on : ${{ needs.create-runner.outputs.label }}
22
+ needs : [create-runner]
18
23
concurrency :
19
24
# github.head_ref is set by a pull_request event - contains the name of the source branch of the PR
20
25
# github.ref_name is set if the event is NOT a pull_request - it contains only the branch name.
@@ -55,17 +60,18 @@ jobs:
55
60
id : pr-diff
56
61
if : (github.event_name == 'pull_request' && github.event.action == 'edited')
57
62
env :
58
- PR_DESC : ' ${{ steps.pr-details.outputs.pr_body }}'
59
- OLD_BODY : ' ${{ github.event.changes.body.from }}'
63
+ PR_DESC : " ${{ steps.pr-details.outputs.pr_body }}"
64
+ OLD_BODY : " ${{ github.event.changes.body.from }}"
60
65
run : |
61
66
if ! diff <(echo "$OLD_BODY") <(echo "$PR_DESC") | grep -e '\[x\]' -e '\[X\]'; then
62
67
echo "pr_no_diff_skip=true" >> $GITHUB_OUTPUT
63
68
fi
64
69
- name : " Set outputs"
65
70
id : output
66
71
env :
67
- PR_DESC : ' ${{ steps.pr-details.outputs.pr_body }}'
72
+ PR_DESC : " ${{ steps.pr-details.outputs.pr_body }}"
68
73
MAIN_BRANCH : ${{ (github.head_ref || github.ref) == 'refs/heads/main' }}
74
+ LEEWAY_WORKSPACE_ROOT : ${{ env.GITHUB_WORKSPACE }}
69
75
shell : bash
70
76
run : |
71
77
{
@@ -80,48 +86,39 @@ jobs:
80
86
if : |
81
87
(needs.configuration.outputs.pr_no_diff_skip != 'true') &&
82
88
(needs.configuration.outputs.preview_enable == 'true')
83
- needs : [ configuration ]
89
+ needs : [configuration, create-runner ]
84
90
concurrency :
85
91
group : ${{ github.workflow }}-${{ github.ref }}-build-previewctl
86
- runs-on : [ self-hosted ]
92
+ runs-on : ${{ needs.create-runner.outputs.label }}
87
93
container :
88
94
image : eu.gcr.io/gitpod-core-dev/dev/dev-environment:cw-bump-leeway-075-gha.12686
89
- volumes :
90
- - /var/tmp:/var/tmp
91
- - /tmp:/tmp
92
95
outputs :
93
96
previewctl_hash : ${{ steps.build.outputs.previewctl_hash }}
94
97
steps :
95
98
- uses : actions/checkout@v3
96
- - name : Configure workspace
97
- run : |
98
- sudo chown -R gitpod:gitpod /__t
99
- # Needed by docker/login-action
100
- sudo chmod goa+rw /var/run/docker.sock
101
99
- name : Build previewctl
102
100
id : build
103
101
shell : bash
104
102
env :
105
- HOME : /home/gitpod
106
103
PREVIEW_ENV_DEV_SA_KEY : ${{ secrets.GCP_CREDENTIALS }}
107
- LEEWAY_SEGMENT_KEY : ' ${{ secrets.LEEWAY_SEGMENT_KEY }}'
104
+ LEEWAY_SEGMENT_KEY : " ${{ secrets.LEEWAY_SEGMENT_KEY }}"
105
+ LEEWAY_WORKSPACE_ROOT : ${{ env.GITHUB_WORKSPACE }}
108
106
run : |
109
107
# Authenticate with GCP so we can use the Leeway cache
110
108
export PREVIEW_ENV_DEV_SA_KEY_PATH="$HOME/.config/gcloud/preview-environment-dev-sa.json"
111
109
echo "${PREVIEW_ENV_DEV_SA_KEY}" > "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
112
110
gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
113
111
114
- export LEEWAY_WORKSPACE_ROOT="$(pwd)"
115
112
leeway build dev/preview/previewctl:docker -Dversion="${{needs.configuration.outputs.version}}"
116
113
echo "previewctl_hash=$(leeway describe dev/preview/previewctl:docker -Dversion="${{needs.configuration.outputs.version}}" -t '{{ .Metadata.Version }}')" >> $GITHUB_OUTPUT
117
114
118
115
infrastructure :
119
- needs : [ configuration, build-previewctl ]
116
+ needs : [configuration, build-previewctl, create-runner ]
120
117
if : |
121
118
(needs.configuration.outputs.pr_no_diff_skip != 'true') &&
122
119
(needs.configuration.outputs.preview_enable == 'true') &&
123
120
(needs.configuration.outputs.is_main_branch != 'true')
124
- runs-on : [ self-hosted ]
121
+ runs-on : ${{ needs.create-runner.outputs.label }}
125
122
concurrency :
126
123
group : ${{ github.head_ref || github.ref_name }}-infrastructure
127
124
steps :
@@ -139,8 +136,8 @@ jobs:
139
136
140
137
build-gitpod :
141
138
name : Build Gitpod
142
- needs : [ configuration ]
143
- runs-on : [ self-hosted ]
139
+ needs : [configuration, create-runner ]
140
+ runs-on : ${{ needs.create-runner.outputs.label }}
144
141
concurrency :
145
142
group : ${{ github.head_ref || github.ref_name }}-build-gitpod
146
143
# For the main branch we always want the build job to run to completion
@@ -155,22 +152,11 @@ jobs:
155
152
- 23306:23306
156
153
container :
157
154
image : eu.gcr.io/gitpod-core-dev/dev/dev-environment:cw-bump-leeway-075-gha.12686
158
- volumes :
159
- - /var/tmp/${{ needs.configuration.outputs.leeway_cache_bucket }}:/var/tmp
160
- - /tmp:/tmp
161
155
env :
162
156
DB_HOST : " mysql"
163
157
DB_PORT : " 23306"
164
- LEEWAY_REMOTE_CACHE_BUCKET : ' ${{ needs.configuration.outputs.leeway_cache_bucket }}'
165
158
steps :
166
159
- uses : actions/checkout@v3
167
- - name : Configure workspace
168
- run : |
169
- cp -r /__w/gitpod/gitpod /workspace
170
- # Needed by google-github-actions/setup-gcloud
171
- sudo chown -R gitpod:gitpod /__t
172
- # Needed by docker/login-action
173
- sudo chmod goa+rw /var/run/docker.sock
174
160
- id : auth
175
161
uses : google-github-actions/auth@v1
176
162
with :
@@ -185,12 +171,12 @@ jobs:
185
171
password : " ${{ steps.auth.outputs.access_token }}"
186
172
- name : Leeway Vet
187
173
shell : bash
188
- working-directory : /workspace/gitpod
189
174
run : |
190
175
leeway vet --ignore-warnings
176
+ env :
177
+ LEEWAY_WORKSPACE_ROOT : ${{ env.GITHUB_WORKSPACE }}
191
178
- name : Pre-Commit Checks
192
179
shell : bash
193
- working-directory : /workspace/gitpod
194
180
run : |
195
181
RESULT=0
196
182
pre-commit run --show-diff-on-failure || RESULT=$?
@@ -200,7 +186,8 @@ jobs:
200
186
exit "$RESULT"
201
187
- name : Check License Headers
202
188
shell : bash
203
- working-directory : /workspace/gitpod
189
+ env :
190
+ LEEWAY_WORKSPACE_ROOT : ${{ env.GITHUB_WORKSPACE }}
204
191
run : |
205
192
RESULT=0
206
193
LICENCE_HEADER_CHECK_ONLY=true leeway run components:update-license-header || RESULT=$?
@@ -209,8 +196,8 @@ jobs:
209
196
fi
210
197
exit "$RESULT"
211
198
- name : Get Secrets from GCP
212
- id : ' secrets'
213
- uses : ' google-github-actions/get-secretmanager-secrets@v1'
199
+ id : " secrets"
200
+ uses : " google-github-actions/get-secretmanager-secrets@v1"
214
201
with :
215
202
secrets : |-
216
203
segment-io-token:gitpod-core-dev/segment-io-token
@@ -222,9 +209,9 @@ jobs:
222
209
env :
223
210
JAVA_HOME : /home/gitpod/.sdkman/candidates/java/current
224
211
VERSION : ${{needs.configuration.outputs.version}}
225
- LEEWAY_SEGMENT_KEY : ' ${{ secrets.LEEWAY_SEGMENT_KEY }}'
212
+ LEEWAY_SEGMENT_KEY : " ${{ secrets.LEEWAY_SEGMENT_KEY }}"
213
+ LEEWAY_WORKSPACE_ROOT : ${{ env.GITHUB_WORKSPACE }}
226
214
shell : bash
227
- working-directory : /workspace/gitpod
228
215
run : |
229
216
RESULT=0
230
217
set -x
@@ -249,22 +236,22 @@ jobs:
249
236
- name : Leeway Build
250
237
id : leeway
251
238
shell : bash
252
- working-directory : /workspace/gitpod
253
239
env :
254
240
DB_HOST : " mysql"
255
241
DB_PORT : " 23306"
256
242
NODE_OPTIONS : " --max_old_space_size=4096"
257
243
JAVA_HOME : /home/gitpod/.sdkman/candidates/java/current
258
244
VERSION : ${{needs.configuration.outputs.version}}
259
- SEGMENT_IO_TOKEN : ' ${{ steps.secrets.outputs.segment-io-token }}'
245
+ SEGMENT_IO_TOKEN : " ${{ steps.secrets.outputs.segment-io-token }}"
260
246
PR_NO_CACHE : ${{needs.configuration.outputs.build_no_cache}}
261
247
PR_NO_TEST : ${{needs.configuration.outputs.build_no_test}}
262
- NPM_AUTH_TOKEN : ' ${{ steps.secrets.outputs.npm-auth-token }}'
248
+ NPM_AUTH_TOKEN : " ${{ steps.secrets.outputs.npm-auth-token }}"
263
249
PUBLISH_TO_NPM : ${{ needs.configuration.outputs.publish_to_npm == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
264
- JB_MARKETPLACE_PUBLISH_TOKEN : ' ${{ steps.secrets.outputs.jb-marketplace-publish-token }}'
250
+ JB_MARKETPLACE_PUBLISH_TOKEN : " ${{ steps.secrets.outputs.jb-marketplace-publish-token }}"
265
251
PUBLISH_TO_JBPM : ${{ needs.configuration.outputs.publish_to_jbmp == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
266
- CODECOV_TOKEN : ' ${{ steps.secrets.outputs.codecov-token }}'
267
- LEEWAY_SEGMENT_KEY : ' ${{ secrets.LEEWAY_SEGMENT_KEY }}'
252
+ CODECOV_TOKEN : " ${{ steps.secrets.outputs.codecov-token }}"
253
+ LEEWAY_SEGMENT_KEY : " ${{ secrets.LEEWAY_SEGMENT_KEY }}"
254
+ LEEWAY_WORKSPACE_ROOT : ${{ env.GITHUB_WORKSPACE }}
268
255
run : |
269
256
[[ "$PR_NO_CACHE" = "true" ]] && CACHE="none" || CACHE="remote"
270
257
[[ "$PR_NO_TEST" = "true" ]] && TEST="--dont-test" || TEST=""
@@ -301,8 +288,8 @@ jobs:
301
288
test-coverage-report
302
289
303
290
install-app :
304
- runs-on : ubuntu-latest
305
- needs : [ configuration, build-gitpod ]
291
+ runs-on : ${{ needs.create-runner.outputs.label }}
292
+ needs : [configuration, build-gitpod, create-runner ]
306
293
if : ${{ needs.configuration.outputs.is_main_branch == 'true' }}
307
294
steps :
308
295
-
uses :
gitpod-io/[email protected]
@@ -328,8 +315,15 @@ jobs:
328
315
329
316
install :
330
317
name : " Install Gitpod"
331
- needs : [ configuration, build-previewctl, build-gitpod, infrastructure ]
332
- runs-on : [ self-hosted ]
318
+ needs :
319
+ [
320
+ configuration,
321
+ build-previewctl,
322
+ build-gitpod,
323
+ infrastructure,
324
+ create-runner,
325
+ ]
326
+ runs-on : ${{ needs.create-runner.outputs.label }}
333
327
concurrency :
334
328
group : ${{ github.workflow }}-${{ github.ref }}-install
335
329
steps :
@@ -371,8 +365,8 @@ jobs:
371
365
372
366
monitoring :
373
367
name : " Install Monitoring Satellite"
374
- needs : [ infrastructure, build-previewctl ]
375
- runs-on : [ self-hosted ]
368
+ needs : [infrastructure, build-previewctl, create-runner ]
369
+ runs-on : ${{ needs.create-runner.outputs.label }}
376
370
concurrency :
377
371
group : ${{ github.workflow }}-${{ github.ref }}-monitoring
378
372
steps :
@@ -386,13 +380,18 @@ jobs:
386
380
387
381
integration-test :
388
382
name : " Run integration test"
389
- needs : [ configuration, build-previewctl, build-gitpod, infrastructure, install ]
390
- runs-on : [ self-hosted ]
383
+ needs :
384
+ [
385
+ configuration,
386
+ build-previewctl,
387
+ build-gitpod,
388
+ infrastructure,
389
+ install,
390
+ create-runner,
391
+ ]
392
+ runs-on : ${{ needs.create-runner.outputs.label }}
391
393
container :
392
- image : eu.gcr.io/gitpod-core-dev/dev/dev-environment:cw-bump-leeway-075-gha.12686
393
- volumes :
394
- - /var/tmp:/var/tmp
395
- - /tmp:/tmp
394
+ image : eu.gcr.io/gitpod-core-dev/dev/dev-environment:cw-bump-leeway-075-gha.12686
396
395
if : needs.configuration.outputs.with_integration_tests != ''
397
396
concurrency :
398
397
group : ${{ github.workflow }}-${{ github.ref }}-integration-test
@@ -401,31 +400,46 @@ jobs:
401
400
- name : Run integration test
402
401
shell : bash
403
402
env :
404
- ROBOQUAT_TOKEN : ${{ secrets.GITHUB_TOKEN }}
405
- INTEGRATION_TEST_USERNAME : ${{ secrets.IDE_INTEGRATION_TEST_USERNAME }}
406
- INTEGRATION_TEST_USER_TOKEN : ${{ secrets.IDE_INTEGRATION_TEST_USER_TOKEN }}
407
- PREVIEW_ENV_DEV_SA_KEY : ${{ secrets.GCP_CREDENTIALS }}
408
- PREVIEW_NAME : ${{ github.head_ref || github.ref_name }}
409
- TEST_SUITS : ${{ needs.configuration.outputs.with_integration_tests }}
410
- TEST_USE_LATEST_VERSION : ${{ needs.configuration.outputs.latest_ide_version }}
411
- TEST_BUILD_ID : ${{ github.run_id }}
412
- TEST_BUILD_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
413
- TEST_BUILD_REF : ${{ github.head_ref || github.ref }}
403
+ ROBOQUAT_TOKEN : ${{ secrets.GITHUB_TOKEN }}
404
+ INTEGRATION_TEST_USERNAME : ${{ secrets.IDE_INTEGRATION_TEST_USERNAME }}
405
+ INTEGRATION_TEST_USER_TOKEN : ${{ secrets.IDE_INTEGRATION_TEST_USER_TOKEN }}
406
+ PREVIEW_ENV_DEV_SA_KEY : ${{ secrets.GCP_CREDENTIALS }}
407
+ PREVIEW_NAME : ${{ github.head_ref || github.ref_name }}
408
+ TEST_SUITS : ${{ needs.configuration.outputs.with_integration_tests }}
409
+ TEST_USE_LATEST_VERSION : ${{ needs.configuration.outputs.latest_ide_version }}
410
+ TEST_BUILD_ID : ${{ github.run_id }}
411
+ TEST_BUILD_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
412
+ TEST_BUILD_REF : ${{ github.head_ref || github.ref }}
413
+ PREVIEW_ENV_DEV_SA_KEY_PATH : ${{ env.GITHUB_WORKSPACE }}"/.config/gcloud/preview-environment-dev-sa.json"
414
+ LEEWAY_WORKSPACE_ROOT : ${{ env.GITHUB_WORKSPACE }}
414
415
run : |
415
- set -euo pipefail
416
+ set -euo pipefail
416
417
417
- export LEEWAY_WORKSPACE_ROOT="$(pwd)"
418
- export HOME="/home/gitpod"
419
- export PREVIEW_ENV_DEV_SA_KEY_PATH="/home/gitpod/.config/gcloud/preview-environment-dev-sa.json"
418
+ echo "${PREVIEW_ENV_DEV_SA_KEY}" > "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
419
+ gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
420
420
421
- echo "${PREVIEW_ENV_DEV_SA_KEY}" > "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
422
- gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
421
+ leeway run dev/preview/previewctl:install
423
422
424
- leeway run dev/preview/previewctl:install
423
+ echo "Setting up access to core-dev and harvester"
424
+ previewctl get-credentials --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
425
425
426
- echo "Setting up access to core-dev and harvester"
427
- previewctl get-credentials --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
426
+ previewctl install-context --branch "${PREVIEW_NAME}" --log-level debug --timeout 1m --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
428
427
429
- previewctl install-context --branch "${PREVIEW_NAME}" --log-level debug --timeout 1m --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
428
+ $GITHUB_WORKSPACE/test/run.sh -s ${TEST_SUITS}
430
429
431
- $GITHUB_WORKSPACE/test/run.sh -s ${TEST_SUITS}
430
+ delete-runner :
431
+ if : always()
432
+ needs :
433
+ - create-runner
434
+ - configuration
435
+ - build-previewctl
436
+ - infrastructure
437
+ - build-gitpod
438
+ - install-app
439
+ - install
440
+ - monitoring
441
+ - integration-test
442
+ uses : ./.github/workflows/remove_runner.yml
443
+ secrets : inherit
444
+ with :
445
+ runner-label : ${{ needs.create-runner.outputs.label }}
0 commit comments