|
58 | 58 | description: | |
59 | 59 | Trigger rebuild of QA containers |
60 | 60 | value: ${{ jobs.common-variables.outputs.rebuild-qa-containers }} |
61 | | - arch-exclude: |
| 61 | + exclude-arch-json: |
62 | 62 | 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 }} |
65 | 65 |
|
66 | 66 | jobs: |
67 | 67 | common-variables: |
|
79 | 79 | cpaas-support-packages-bucket: ${{ steps.gcp-buckets.outputs.cpaas-support-packages-bucket }} |
80 | 80 | support-packages-index-bucket: ${{ steps.gcp-buckets.outputs.support-packages-index-bucket }} |
81 | 81 | 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 }} |
83 | 83 |
|
84 | 84 | 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 | | -
|
111 | 85 | - uses: actions/checkout@v4 |
112 | 86 | with: |
113 | 87 | submodules: true |
@@ -205,3 +179,28 @@ jobs: |
205 | 179 | } >> "$GITHUB_OUTPUT" |
206 | 180 | fi |
207 | 181 |
|
| 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 | +
|
0 commit comments