Skip to content

Commit 0bb6aaa

Browse files
authored
Change gh runners concurrency rules (#18281)
* Change gh runners concurrency rules * Configure concurrency for create-runner job * Change group condition * Do not install monitoring by default
1 parent 648dc30 commit 0bb6aaa

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ gitpod:summary
6161
If enabled this will create the environment on GCE infra
6262
- [ ] with-integration-tests=all
6363
Valid options are `all`, `workspace`, `webapp`, `ide`, `jetbrains`, `vscode`, `ssh`
64+
- [ ] with-monitoring
6465
</details>
6566

6667
/hold

.github/workflows/build.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ jobs:
1515
create-runner:
1616
uses: ./.github/workflows/create_runner.yml
1717
secrets: inherit
18+
concurrency:
19+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-create-runner
20+
cancel-in-progress: false
1821

1922
configuration:
2023
name: Configure job parameters
2124
runs-on: ${{ needs.create-runner.outputs.label }}
2225
needs: [create-runner]
2326
concurrency:
24-
# github.head_ref is set by a pull_request event - contains the name of the source branch of the PR
25-
# github.ref_name is set if the event is NOT a pull_request - it contains only the branch name.
26-
group: ${{ github.head_ref || github.ref_name }}-configuration
27+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-configuration
28+
cancel-in-progress: true
2729
outputs:
2830
is_main_branch: ${{ (github.head_ref || github.ref) == 'refs/heads/main' }}
2931
version: ${{ steps.branches.outputs.sanitized-branch-name }}-gha.${{github.run_number}}
@@ -40,6 +42,7 @@ jobs:
4042
pr_no_diff_skip: ${{ steps.pr-diff.outputs.pr_no_diff_skip }}
4143
with_werft: ${{ steps.output.outputs.with-werft }}
4244
with_integration_tests: ${{ steps.output.outputs.with_integration_tests }}
45+
with_monitoring: ${{ contains( steps.pr-details.outputs.pr_body, '[x] with-monitoring') }}
4346
latest_ide_version: ${{ contains( steps.pr-details.outputs.pr_body, '[x] latest-ide-version=true') }}
4447
leeway_cache_bucket: ${{ steps.output.outputs.leeway_cache_bucket }}
4548
pr_number: ${{ steps.pr-details.outputs.number }}
@@ -87,7 +90,7 @@ jobs:
8790
(needs.configuration.outputs.preview_enable == 'true')
8891
needs: [configuration, create-runner]
8992
concurrency:
90-
group: ${{ github.workflow }}-${{ github.ref }}-build-previewctl
93+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-build-previewctl
9194
cancel-in-progress: ${{ needs.configuration.outputs.is_main_branch == 'false' }}
9295
runs-on: ${{ needs.create-runner.outputs.label }}
9396
container:
@@ -115,7 +118,7 @@ jobs:
115118
(needs.configuration.outputs.is_main_branch != 'true')
116119
runs-on: ${{ needs.create-runner.outputs.label }}
117120
concurrency:
118-
group: ${{ github.head_ref || github.ref_name }}-infrastructure
121+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-infrastructure
119122
cancel-in-progress: true
120123
steps:
121124
- uses: actions/checkout@v3
@@ -135,9 +138,7 @@ jobs:
135138
needs: [configuration, create-runner]
136139
runs-on: ${{ needs.create-runner.outputs.label }}
137140
concurrency:
138-
group: ${{ github.head_ref || github.ref_name }}-build-gitpod
139-
# For the main branch we always want the build job to run to completion
140-
# For other branches we only care about the "latest" version, so it is fine to cancel in-progress builds
141+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-build-gitpod
141142
cancel-in-progress: ${{ needs.configuration.outputs.is_main_branch == 'false' }}
142143
services:
143144
mysql:
@@ -329,8 +330,8 @@ jobs:
329330
- create-runner
330331
runs-on: ${{ needs.create-runner.outputs.label }}
331332
concurrency:
332-
group: ${{ github.workflow }}-${{ github.ref }}-install
333-
cancel-in-progress: true
333+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-install
334+
cancel-in-progress: ${{ needs.configuration.outputs.is_main_branch == 'false' }}
334335
steps:
335336
- uses: actions/checkout@v3
336337
- name: Deploy Gitpod to the preview environment
@@ -372,8 +373,9 @@ jobs:
372373
name: "Install Monitoring Satellite"
373374
needs: [infrastructure, build-previewctl, create-runner]
374375
runs-on: ${{ needs.create-runner.outputs.label }}
376+
if: needs.configuration.outputs.with_monitoring == 'true'
375377
concurrency:
376-
group: ${{ github.workflow }}-${{ github.ref }}-monitoring
378+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-monitoring
377379
cancel-in-progress: true
378380
steps:
379381
- uses: actions/checkout@v3
@@ -398,7 +400,7 @@ jobs:
398400
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:aledbf-new-dev-image-gha.13182
399401
if: needs.configuration.outputs.with_integration_tests != ''
400402
concurrency:
401-
group: ${{ github.workflow }}-${{ github.ref }}-integration-test
403+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-integration-test
402404
cancel-in-progress: true
403405
steps:
404406
- uses: actions/checkout@v3
@@ -444,3 +446,6 @@ jobs:
444446
secrets: inherit
445447
with:
446448
runner-label: ${{ needs.create-runner.outputs.label }}
449+
concurrency:
450+
group: ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-delete-runner
451+
cancel-in-progress: false

0 commit comments

Comments
 (0)