Skip to content

Commit 835342e

Browse files
committed
rn
1 parent 1179d57 commit 835342e

7 files changed

Lines changed: 72 additions & 71 deletions

File tree

.github/workflows/collector-builder.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ on:
88
required: true
99
description: |
1010
The tag used to build the collector image
11-
arch-exclude:
11+
exclude-arch-json:
1212
type: string
1313
required: true
1414
description: |
15-
Which architectures to exclude from builds
15+
JSON for matrix.exclude in later jobs to prevent builds based on 'arch'
1616
outputs:
1717
collector-builder-tag:
1818
description: The builder tag used by the build
@@ -66,7 +66,7 @@ jobs:
6666
- runner: ubuntu-24.04
6767
- arch: arm64
6868
runner: ubuntu-24.04-arm
69-
exclude: ${{ fromJSON(inputs.arch-exclude) }}
69+
exclude: ${{ fromJSON(inputs.exclude-arch-json) }}
7070
runs-on: ${{ matrix.runner }}
7171

7272
env:
@@ -78,29 +78,31 @@ jobs:
7878
with:
7979
submodules: true
8080

81-
- if: matrix.arch != 's390x'
81+
- name: Set up QEMU
82+
if: matrix.arch != 's390x'
8283
uses: docker/setup-qemu-action@v3
8384
with:
8485
image: tonistiigi/binfmt:qemu-v8.1.5
8586

86-
- if: matrix.arch != 's390x'
87+
- name: Set up Docker Buildx
88+
if: matrix.arch != 's390x'
8789
uses: docker/setup-buildx-action@v3
8890

89-
- if: matrix.arch == 's390x'
90-
uses: actions/setup-python@v5
91+
- uses: actions/setup-python@v5
92+
if: matrix.arch == 's390x'
9193
with:
9294
python-version: "3.10"
9395

94-
- if: matrix.arch == 's390x'
95-
uses: 'google-github-actions/auth@v2'
96+
- uses: 'google-github-actions/auth@v2'
97+
if: matrix.arch == 's390x'
9698
with:
9799
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}'
98100

99-
- if: matrix.arch == 's390x'
100-
uses: 'google-github-actions/setup-gcloud@v2'
101+
- uses: 'google-github-actions/setup-gcloud@v2'
102+
if: matrix.arch == 's390x'
101103

102-
- if: matrix.arch == 's390x'
103-
uses: ./.github/actions/setup-vm-creds
104+
- uses: ./.github/actions/setup-vm-creds
105+
if: matrix.arch == 's390x'
104106
with:
105107
gcp-ssh-key: ${{ secrets.GCP_SSH_KEY }}
106108
gcp-ssh-key-pub: ${{ secrets.GCP_SSH_KEY_PUB }}
@@ -199,14 +201,13 @@ jobs:
199201
- name: Exclude architectures if needed
200202
uses: actions/github-script@v7
201203
env:
202-
exclude: ${{ inputs.arch-exclude }}
204+
exclude: ${{ inputs.exclude-arch-json }}
203205
with:
204206
script: |
205207
const archs = ['amd64', 'arm64', 'ppc64le', 's390x'];
206208
const exclude = JSON.parse(process.env.exclude).map(e => e.arch);
207209
const filtered = archs.filter(arch => ! exclude.includes(arch));
208210
core.exportVariable('ARCHS', filtered.join(' '));
209-
core.info(`Builder image for ${filtered} architectures`);
210211
211212
- name: Create and push multiarch manifest for builder to stackrox-io
212213
uses: ./.github/actions/create-multiarch-manifest

.github/workflows/collector.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ on:
1818
required: true
1919
description: |
2020
The builder tag to use in the build
21-
arch-exclude:
21+
exclude-arch-json:
2222
type: string
2323
required: true
2424
description: |
25-
Which architectures to exclude from builds
25+
JSON for matrix.exclude in later jobs to prevent builds based on 'arch'
2626
2727
env:
2828
COLLECTOR_TAG: ${{ inputs.collector-tag }}
@@ -36,8 +36,8 @@ jobs:
3636
build-collector-image:
3737
name: Build Collector
3838
if: |
39-
!contains(inputs.arch-exclude, 'amd64') || !contains(inputs.arch-exclude, 'arm64') ||
40-
!contains(inputs.arch-exclude, 'ppc64le')
39+
!contains(inputs.exclude-arch-json, 'amd64') || !contains(inputs.exclude-arch-json, 'arm64') ||
40+
!contains(inputs.exclude-arch-json, 'ppc64le')
4141
strategy:
4242
fail-fast: false
4343
matrix:
@@ -46,7 +46,7 @@ jobs:
4646
- runner: ubuntu-24.04
4747
- arch: arm64
4848
runner: ubuntu-24.04-arm
49-
exclude: ${{ fromJSON(inputs.arch-exclude) }}
49+
exclude: ${{ fromJSON(inputs.exclude-arch-json) }}
5050
runs-on: ${{ matrix.runner }}
5151

5252
env:
@@ -98,7 +98,7 @@ jobs:
9898
build-collector-image-remote-vm:
9999
name: Build Collector on a remote VM
100100
runs-on: ubuntu-24.04
101-
if: ${{ !contains(inputs.arch-exclude, 's390x') }}
101+
if: ${{ !contains(inputs.exclude-arch-json, 's390x') }}
102102
strategy:
103103
fail-fast: false
104104
matrix:
@@ -182,17 +182,16 @@ jobs:
182182
steps:
183183
- uses: actions/checkout@v4
184184

185-
- name: Exclude architectures if needed
185+
- name: Create list of archs to build
186186
uses: actions/github-script@v7
187187
env:
188-
exclude: ${{ inputs.arch-exclude }}
188+
exclude: ${{ inputs.exclude-arch-json }}
189189
with:
190190
script: |
191191
const archs = ['amd64', 'arm64', 'ppc64le', 's390x'];
192192
const exclude = JSON.parse(process.env.exclude).map(e => e.arch);
193193
const filtered = archs.filter(arch => ! exclude.includes(arch));
194194
core.exportVariable('ARCHS', filtered.join(' '));
195-
core.info(`Builder image for ${filtered} architectures`);
196195
197196
- name: Login to quay.io/stackrox-io
198197
uses: docker/login-action@v3

.github/workflows/init.yml

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ on:
5858
description: |
5959
Trigger rebuild of QA containers
6060
value: ${{ jobs.common-variables.outputs.rebuild-qa-containers }}
61-
arch-exclude:
61+
exclude-arch-json:
6262
description: |
63-
Set of archs to not build or test based on PR labels
64-
value: ${{ jobs.common-variables.outputs.arch-exclude }}
63+
JSON for matrix.exclude in later jobs to prevent builds based on 'arch'
64+
value: ${{ jobs.common-variables.outputs.exclude-arch-json }}
6565

6666
jobs:
6767
common-variables:
@@ -79,35 +79,9 @@ jobs:
7979
cpaas-support-packages-bucket: ${{ steps.gcp-buckets.outputs.cpaas-support-packages-bucket }}
8080
support-packages-index-bucket: ${{ steps.gcp-buckets.outputs.support-packages-index-bucket }}
8181
rebuild-qa-containers: ${{ steps.filter.outputs.container }}
82-
arch-exclude: ${{ steps.arch-exclude.outputs.arch-exclude }}
82+
exclude-arch-json: ${{ steps.exclude-arch-json.outputs.exclude-arch-json }}
8383

8484
steps:
85-
- name: Determine architectures to exclude from builds
86-
id: arch-exclude
87-
uses: actions/github-script@v7
88-
with:
89-
script: |
90-
const archs = ['arm64', 'amd64', 'ppc64le', 's390x'];
91-
let include = archs;
92-
if (context.payload.pull_request) {
93-
const labels = context.payload.pull_request.labels.map(label => label.name);
94-
if (archs.some(a => labels.includes(`run-${a}-builds`))) {
95-
// Check for labels that specify a specific architecture
96-
include = archs.filter(a => labels.includes(`run-${a}-builds`))
97-
} else {
98-
// Otherwise, use default architectures on PRs
99-
include = ['arm64', 'amd64']
100-
// If multiarch label is included, also add z and power
101-
if (labels.includes('run-multiarch-builds')) {
102-
include = include.concat(['ppc64le', 's390x'])
103-
}
104-
}
105-
}
106-
// Build exclude list for arch fields in job matrix
107-
const exclude = archs.filter(a => !include.includes(a)).map(a => ({ arch: a }));
108-
core.setOutput('arch-exclude', JSON.stringify(exclude));
109-
core.info(`Excluding from builds: ${JSON.stringify(exclude)}`);
110-
11185
- uses: actions/checkout@v4
11286
with:
11387
submodules: true
@@ -205,3 +179,28 @@ jobs:
205179
} >> "$GITHUB_OUTPUT"
206180
fi
207181
182+
- name: Determine architectures to exclude from builds
183+
id: exclude-arch-json
184+
uses: actions/github-script@v7
185+
with:
186+
script: |
187+
const archs = ['arm64', 'amd64', 'ppc64le', 's390x'];
188+
let include = archs;
189+
if (context.payload.pull_request) {
190+
const labels = context.payload.pull_request.labels.map(label => label.name);
191+
if (archs.some(a => labels.includes(`run-${a}-builds`))) {
192+
// Check for labels that specify a specific architecture
193+
include = archs.filter(a => labels.includes(`run-${a}-builds`))
194+
} else {
195+
// Otherwise, use default architectures on PRs
196+
include = ['arm64', 'amd64']
197+
// If multiarch label is included, also add z and power
198+
if (labels.includes('run-multiarch-builds')) {
199+
include = include.concat(['ppc64le', 's390x'])
200+
}
201+
}
202+
}
203+
// Build JSON string for matrix.exclude in jobs, all archs will build if empty
204+
const exclude = archs.filter(a => !include.includes(a)).map(a => ({ arch: a }));
205+
core.setOutput('exclude-arch-json', JSON.stringify(exclude));
206+

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ on:
4242
number of CPU cores.
4343
type: boolean
4444
default: false
45-
arch-exclude:
45+
exclude-arch-json:
4646
type: string
4747
required: true
4848
description: |
49-
Which architectures to exclude from builds
49+
JSON for matrix.exclude in later jobs to prevent builds based on 'arch'
5050
5151
jobs:
5252
amd64-integration-tests:
5353
uses: ./.github/workflows/integration-tests-vm-type.yml
54-
if: ${{ !contains(inputs.arch-exclude, 'amd64') }}
54+
if: ${{ !contains(inputs.exclude-arch-json, 'amd64') }}
5555
strategy:
5656
# ensure that if one part of the matrix fails, the
5757
# rest will continue
@@ -97,7 +97,7 @@ jobs:
9797

9898
arm64-integration-tests:
9999
uses: ./.github/workflows/integration-tests-vm-type.yml
100-
if: ${{ !contains(inputs.arch-exclude, 'arm64') }}
100+
if: ${{ !contains(inputs.exclude-arch-json, 'arm64') }}
101101
strategy:
102102
# ensure that if one part of the matrix fails, the
103103
# rest will continue
@@ -119,7 +119,7 @@ jobs:
119119

120120
s390x-integration-tests:
121121
uses: ./.github/workflows/integration-tests-vm-type.yml
122-
if: ${{ !contains(inputs.arch-exclude, 's390x') }}
122+
if: ${{ !contains(inputs.exclude-arch-json, 's390x') }}
123123
with:
124124
vm_type: rhel-s390x
125125
collector-tag: ${{ inputs.collector-tag }}
@@ -131,7 +131,7 @@ jobs:
131131

132132
ppc64le-integration-tests:
133133
uses: ./.github/workflows/integration-tests-vm-type.yml
134-
if: ${{ !contains(inputs.arch-exclude, 'ppc64le') }}
134+
if: ${{ !contains(inputs.exclude-arch-json, 'ppc64le') }}
135135
with:
136136
vm_type: rhel-ppc64le
137137
collector-tag: ${{ inputs.collector-tag }}

.github/workflows/konflux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
collector-tests-tag: ${{ needs.integration-tests-containers.outputs.collector-tests-tag }}
9090
is-konflux: true
9191
job-tag: konf
92-
arch-exclude: '[]'
92+
exclude-arch-json: '[]'
9393
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
9494
secrets: inherit
9595

.github/workflows/main.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
needs: init
4141
with:
4242
collector-tag: ${{ needs.init.outputs.collector-tag }}
43-
arch-exclude: ${{ needs.init.outputs.arch-exclude }}
43+
exclude-arch-json: ${{ needs.init.outputs.exclude-arch-json }}
4444
secrets: inherit
4545

4646
build-collector:
@@ -52,7 +52,7 @@ jobs:
5252
collector-tag: ${{ needs.init.outputs.collector-tag }}
5353
collector-image: ${{ needs.init.outputs.collector-image }}
5454
collector-builder-tag: ${{ needs.build-builder-image.outputs.collector-builder-tag }}
55-
arch-exclude: ${{ needs.init.outputs.arch-exclude }}
55+
exclude-arch-json: ${{ needs.init.outputs.exclude-arch-json }}
5656
secrets: inherit
5757

5858
build-test-containers:
@@ -72,7 +72,7 @@ jobs:
7272
- build-builder-image
7373
with:
7474
collector-builder-tag: ${{ needs.build-builder-image.outputs.collector-builder-tag }}
75-
arch-exclude: ${{ needs.init.outputs.arch-exclude }}
75+
exclude-arch-json: ${{ needs.init.outputs.exclude-arch-json }}
7676
secrets: inherit
7777

7878
integration-tests:
@@ -82,7 +82,7 @@ jobs:
8282
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
8383
collector-tests-tag: ${{ needs.build-test-containers.outputs.collector-tests-tag }}
8484
large-box: ${{ github.event.schedule == '0 0 * * 0' }}
85-
arch-exclude: ${{ needs.init.outputs.arch-exclude }}
85+
exclude-arch-json: ${{ needs.init.outputs.exclude-arch-json }}
8686
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
8787
needs:
8888
- init
@@ -96,7 +96,9 @@ jobs:
9696
collector-tag: ${{ needs.init.outputs.collector-tag }}
9797
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
9898
collector-tests-tag: ${{ needs.build-test-containers.outputs.collector-tests-tag }}
99-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
99+
if: |
100+
!contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') &&
101+
!contains(needs.init.outputs.exclude-arch-json, 'amd64')
100102
needs:
101103
- init
102104
- build-collector
@@ -110,7 +112,7 @@ jobs:
110112
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
111113
collector-tests-tag: ${{ needs.build-test-containers.outputs.collector-tests-tag }}
112114
if: |
113-
always() &&
115+
always() && !contains(needs.init.outputs.exclude-arch-json, 'amd64') &&
114116
((github.event_name != 'pull_request' && github.ref_name == 'master') ||
115117
contains(github.event.pull_request.labels.*.name, 'run-benchmark'))
116118
needs:

.github/workflows/unit-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88
required: true
99
description: |
1010
The builder tag to use in the build
11-
arch-exclude:
11+
exclude-arch-json:
1212
type: string
1313
required: true
1414
description: |
15-
Which architectures to exclude from builds
15+
JSON for matrix.exclude in later jobs to prevent builds based on 'arch'
1616
1717
jobs:
1818
unit-tests:
19-
if: ${{ !contains(inputs.arch-exclude, 'amd64') || !contains(inputs.arch-exclude, 'arm64') }}
19+
if: ${{ !contains(inputs.exclude-arch-json, 'amd64') || !contains(inputs.exclude-arch-json, 'arm64') }}
2020
container:
2121
image: quay.io/stackrox-io/collector-builder:${{ inputs.collector-builder-tag }}
2222
strategy:
@@ -32,7 +32,7 @@ jobs:
3232
runner: ubuntu-24.04
3333
- arch: arm64
3434
runner: ubuntu-24.04-arm
35-
exclude: ${{ fromJSON(inputs.arch-exclude) }}
35+
exclude: ${{ fromJSON(inputs.exclude-arch-json) }}
3636
runs-on: ${{ matrix.runner }}
3737

3838
steps:

0 commit comments

Comments
 (0)