18
18
required : true
19
19
description : |
20
20
The builder tag to use in the build
21
+ include-arch-json :
22
+ type : string
23
+ required : true
24
+ description : |
25
+ JSON for matrix.include to select architectures and runners to build
21
26
22
27
env :
23
28
COLLECTOR_TAG : ${{ inputs.collector-tag }}
30
35
jobs :
31
36
build-collector-image :
32
37
name : Build Collector
33
- runs-on : ubuntu-24.04
34
38
strategy :
35
- fail-fast : false
36
39
matrix :
37
- arch : [amd64, ppc64le, arm64]
40
+ include : ${{ fromJSON(inputs.include-arch-json) }}
41
+ runs-on : ${{ matrix.runner }}
38
42
39
43
env :
40
44
PLATFORM : linux/${{ matrix.arch }}
@@ -46,11 +50,13 @@ jobs:
46
50
submodules : true
47
51
48
52
- name : Set up QEMU
53
+ if : matrix.remote != true
49
54
uses : docker/setup-qemu-action@v3
50
55
with :
51
56
image : tonistiigi/binfmt:qemu-v8.1.5
52
57
53
58
- name : Set up Docker Buildx
59
+ if : matrix.remote != true
54
60
uses : docker/setup-buildx-action@v3
55
61
56
62
- name : Create ansible vars
62
68
rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
63
69
rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
64
70
collector_git_ref: ${{ github.ref }}
71
+ collector_git_sha: ${{ github.sha }}
65
72
collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}
66
73
disable_profiling: ${{ matrix.arch != 'amd64' && matrix.arch != 'arm64' }}
67
74
rhacs_eng_image: ${{ env.RHACS_ENG_IMAGE }}
71
78
driver_version: ${DRIVER_VERSION}
72
79
EOF
73
80
74
- - name : Build images
75
- if : |
76
- github.event_name != 'pull_request' ||
77
- matrix.arch == 'amd64' ||
78
- contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')
81
+ - name : Build ${{ matrix.arch }} image locally
82
+ if : matrix.remote != true
79
83
timeout-minutes : 480
80
84
run : |
81
85
ansible-playbook \
@@ -86,32 +90,21 @@ jobs:
86
90
-e @'${{ github.workspace }}/ansible/secrets.yml' \
87
91
ansible/ci-build-collector.yml
88
92
89
- build-collector-image-remote-vm :
90
- name : Build Collector on a remote VM
91
- runs-on : ubuntu-24.04
92
- if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')
93
- strategy :
94
- fail-fast : false
95
- matrix :
96
- arch : [s390x]
97
-
98
- env :
99
- PLATFORM : linux/${{ matrix.arch }}
100
-
101
- steps :
102
- - uses : actions/checkout@v4
103
-
104
93
- uses : actions/setup-python@v5
94
+ if : matrix.remote
105
95
with :
106
96
python-version : " 3.10"
107
97
108
98
- uses : ' google-github-actions/auth@v2'
99
+ if : matrix.remote
109
100
with :
110
101
credentials_json : ' ${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}'
111
102
112
103
- uses : ' google-github-actions/setup-gcloud@v2'
104
+ if : matrix.remote
113
105
114
106
- uses : ./.github/actions/setup-vm-creds
107
+ if : matrix.remote
115
108
with :
116
109
gcp-ssh-key : ${{ secrets.GCP_SSH_KEY }}
117
110
gcp-ssh-key-pub : ${{ secrets.GCP_SSH_KEY_PUB }}
@@ -126,28 +119,12 @@ jobs:
126
119
job-tag : builder
127
120
128
121
- name : Create Build VMs
122
+ if : matrix.remote
129
123
run : |
130
124
make -C "${{ github.workspace }}/ansible" create-build-vms
131
125
132
- - name : Create ansible vars
133
- run : |
134
- cat << EOF > ${{ github.workspace }}/ansible/secrets.yml
135
- ---
136
- stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
137
- stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
138
- rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
139
- rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
140
- collector_git_ref: ${{ github.ref }}
141
- collector_git_sha: ${{ github.sha }}
142
- collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}
143
- disable_profiling: ${{ matrix.arch != 'amd64' && matrix.arch != 'arm64' }}
144
- rhacs_eng_image: ${{ env.RHACS_ENG_IMAGE }}
145
- collector_image: ${{ inputs.collector-image }}
146
- collector_tag: ${{ inputs.collector-tag }}
147
- debug_mode: ${{ github.event_name == 'pull_request' }}
148
- EOF
149
-
150
- - name : Build ${{ matrix.arch }} image
126
+ - name : Build ${{ matrix.arch }} image remotely
127
+ if : matrix.remote
151
128
timeout-minutes : 480
152
129
run : |
153
130
ansible-playbook \
@@ -158,21 +135,18 @@ jobs:
158
135
ansible/ci-build-collector.yml
159
136
160
137
- name : Destroy Build VMs
161
- if : always()
138
+ if : always() && matrix.remote
162
139
run : |
163
140
make -C ansible destroy-vms
164
141
165
142
create-multiarch-manifest :
166
143
needs :
167
144
- build-collector-image
168
- - build-collector-image-remote-vm
169
145
name : Create Multiarch manifest
170
146
runs-on : ubuntu-24.04
171
- if : |
172
- github.event_name != 'pull_request' ||
173
- contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')
147
+ if : always() && !contains(join(needs.*.result, ','), 'failure')
174
148
env :
175
- ARCHS : amd64 ppc64le s390x arm64
149
+ ARCHS : ${{ join(fromJSON(inputs.include-arch-json).*.arch, ' ') }}
176
150
177
151
steps :
178
152
- uses : actions/checkout@v4
@@ -203,43 +177,12 @@ jobs:
203
177
base-image : quay.io/rhacs-eng/collector:${{ inputs.collector-tag }}
204
178
archs : ${{ env.ARCHS }}
205
179
206
- retag-x86-image :
207
- needs :
208
- - build-collector-image
209
- name : Retag x86 image
210
- runs-on : ubuntu-24.04
211
- if : |
212
- github.event_name == 'pull_request' &&
213
- !contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')
214
- steps :
215
- - name : Pull image to retag
216
- run : |
217
- docker pull ${{ inputs.collector-image }}-amd64
218
-
219
- - name : Retag and push stackrox-io
220
- uses : stackrox/actions/images/retag-and-push@v1
221
- with :
222
- src-image : ${{ inputs.collector-image }}-amd64
223
- dst-image : ${{ inputs.collector-image }}
224
- username : ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
225
- password : ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
226
-
227
- - name : Retag and push rhacs-eng
228
- uses : stackrox/actions/images/retag-and-push@v1
229
- with :
230
- src-image : ${{ inputs.collector-image }}-amd64
231
- dst-image : ${{ env.RHACS_ENG_IMAGE }}
232
- username : ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
233
- password : ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
234
-
235
180
notify :
236
181
runs-on : ubuntu-24.04
237
182
if : always() && contains(join(needs.*.result, ','), 'failure') && github.event_name != 'pull_request'
238
183
needs :
239
184
- build-collector-image
240
- - build-collector-image-remote-vm
241
185
- create-multiarch-manifest
242
- - retag-x86-image
243
186
steps :
244
187
- name : Slack notification
245
188
uses : rtCamp/action-slack-notify@v2
0 commit comments