Skip to content

Commit d22a386

Browse files
chore: Automatically select self-hosted/github agents (#4514)
* Automatically select self-hosted/github agents in fork/main * Update OS matrix to correctly take ARM self-hosted runners * Change matrix to still use `arch` parameter * Fix syntax * Attempt at fixing hanging workflow Refactor the 'runs-on' expression for better readability.
1 parent a96bbfd commit d22a386

File tree

8 files changed

+24
-18
lines changed

8 files changed

+24
-18
lines changed

.github/workflows/backport.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
# Also only run if the PR is merged, as an extra safe-guard.
1313
if: ${{ ! github.event.pull_request.head.repo.fork && github.event.pull_request.merged == true }}
1414

15-
runs-on: ubuntu-x64-small
15+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }}
1616
permissions:
1717
contents: "read"
1818
id-token: "write"

.github/workflows/ci.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818

1919
jobs:
2020
format:
21-
runs-on: ubuntu-x64-large
21+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }}
2222
steps:
2323
- name: Checkout code
2424
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
@@ -31,7 +31,7 @@ jobs:
3131
- name: Format
3232
run: make fmt check/unstaged-changes
3333
check-generated:
34-
runs-on: ubuntu-x64-large
34+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }}
3535
steps:
3636
- name: Checkout code
3737
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
@@ -48,7 +48,13 @@ jobs:
4848
fail-fast: false
4949
matrix:
5050
arch: [amd64, arm64]
51-
runs-on: ubuntu-${{ matrix.arch }}-large
51+
# Compute runner OS dynamically based on arch and repo ownership
52+
runs-on: >-
53+
${{
54+
github.repository_owner == 'grafana'
55+
&& format('ubuntu-{0}-large', matrix.arch)
56+
|| (matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04')
57+
}}
5258
steps:
5359
- name: Checkout code
5460
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
@@ -63,7 +69,7 @@ jobs:
6369
- name: Test
6470
run: make go/test
6571
lint:
66-
runs-on: ubuntu-x64-large
72+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }}
6773
steps:
6874
- name: Checkout code
6975
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
@@ -79,7 +85,7 @@ jobs:
7985
run: make helm/check check/unstaged-changes
8086

8187
test-docs:
82-
runs-on: ubuntu-x64-small
88+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }}
8389
steps:
8490
- name: "Check out code"
8591
uses: "actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955" # v4
@@ -90,7 +96,7 @@ jobs:
9096

9197
build-image:
9298
if: github.event_name != 'push'
93-
runs-on: ubuntu-x64
99+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64' || 'ubuntu-latest' }}
94100
steps:
95101
- name: Checkout Repo
96102
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
@@ -116,7 +122,7 @@ jobs:
116122
permissions:
117123
contents: read
118124
id-token: write
119-
runs-on: ubuntu-x64-large
125+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }}
120126
outputs:
121127
image: ${{ steps.push-metadata.outputs.image }}
122128
image-digest: ${{ steps.push-metadata.outputs.image-digest }}
@@ -163,7 +169,7 @@ jobs:
163169
contents: read
164170
id-token: write
165171
if: github.event_name == 'push' && github.repository == 'grafana/pyroscope' && github.ref == 'refs/heads/main'
166-
runs-on: ubuntu-x64-small
172+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }}
167173
needs: [build-push]
168174
steps:
169175
- id: "submit-argowfs-deployment"

.github/workflows/frontend.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414
contents: read
1515
jobs:
1616
type-check:
17-
runs-on: ubuntu-x64
17+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64' || 'ubuntu-latest' }}
1818
steps:
1919
- name: Checkout code
2020
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -28,7 +28,7 @@ jobs:
2828
- name: Run type-check
2929
run: yarn type-check
3030
format:
31-
runs-on: ubuntu-x64
31+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64' || 'ubuntu-latest' }}
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -42,7 +42,7 @@ jobs:
4242
- name: Run format
4343
run: yarn run format
4444
lint:
45-
runs-on: ubuntu-x64
45+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64' || 'ubuntu-latest' }}
4646
steps:
4747
- name: Checkout code
4848
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -56,7 +56,7 @@ jobs:
5656
- name: Run lint
5757
run: yarn lint
5858
build:
59-
runs-on: ubuntu-x64
59+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64' || 'ubuntu-latest' }}
6060
steps:
6161
- name: Checkout code
6262
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.github/workflows/fuzzer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permissions:
77
contents: read
88
jobs:
99
go-fuzz-merge-single:
10-
runs-on: ubuntu-x64
10+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64' || 'ubuntu-latest' }}
1111
steps:
1212
- name: Checkout code
1313
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.github/workflows/renovate-config-validator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818

1919
jobs:
2020
validate:
21-
runs-on: ubuntu-x64-small
21+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }}
2222
steps:
2323
- name: Checkout code
2424
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4

.github/workflows/test-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
contents: read
1414
jobs:
1515
test:
16-
runs-on: ubuntu-x64-large
16+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-large' || 'ubuntu-latest' }}
1717
steps:
1818
- name: Checkout code
1919
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.github/workflows/update-examples-cron.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
update-examples-cron:
14-
runs-on: ubuntu-x64-small
14+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }}
1515
steps:
1616
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1717
with:

.github/workflows/update-make-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
main:
1111
if: github.repository == 'grafana/pyroscope'
12-
runs-on: ubuntu-x64-small
12+
runs-on: ${{ github.repository_owner == 'grafana' && 'ubuntu-x64-small' || 'ubuntu-latest' }}
1313
steps:
1414
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1515
with:

0 commit comments

Comments
 (0)