Skip to content

Commit 61cd323

Browse files
authored
Revert GH arm changes (#2107)
This reverts commit d562819.
1 parent d562819 commit 61cd323

File tree

6 files changed

+147
-133
lines changed

6 files changed

+147
-133
lines changed

.github/workflows/collector-builder.yml

Lines changed: 97 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,10 @@ on:
88
required: true
99
description: |
1010
The tag used to build the collector image
11-
architectures:
12-
type: string
13-
required: true
14-
description: |
15-
Space-seperated list of architectures to build
16-
1711
outputs:
1812
collector-builder-tag:
1913
description: The builder tag used by the build
20-
value: ${{ jobs.builder-needs-rebuilding.outputs.collector-builder-tag }}
14+
value: ${{ jobs.build-builder-image.outputs.collector-builder-tag || 'master' }}
2115

2216
env:
2317
COLLECTOR_TAG: ${{ inputs.collector-tag }}
@@ -29,11 +23,7 @@ jobs:
2923
name: Determine if builder image needs to be built
3024
runs-on: ubuntu-24.04
3125
outputs:
32-
build-image: ${{ steps.builder-tag.outputs.build-image || false }}
33-
collector-builder-tag: ${{ steps.builder-tag.outputs.collector-builder-tag || 'master'}}
34-
35-
env:
36-
DEFAULT_BUILDER_TAG: master
26+
build-image: ${{ steps.changed.outputs.builder-changed }}
3727

3828
steps:
3929
- uses: actions/checkout@v4
@@ -48,46 +38,30 @@ jobs:
4838
- builder/Dockerfile
4939
- .github/workflows/collector-builder.yml
5040
51-
- name: Check labels and define builder tag
52-
id: builder-tag
53-
if: |
54-
steps.changed.outputs.builder-changed == 'true' ||
55-
(github.event_name == 'push' && (
56-
github.ref_type == 'tag' || startsWith(github.ref_name, 'release-')
57-
)) ||
58-
contains(github.event.pull_request.labels.*.name, 'build-builder-image') ||
59-
github.event_name == 'schedule'
60-
run: |
61-
COLLECTOR_BUILDER_TAG="${DEFAULT_BUILDER_TAG}"
62-
if [[ "${{ github.event_name }}" == 'pull_request' || \
63-
"${{ github.ref_type }}" == 'tag' || \
64-
"${{ github.ref_name }}" =~ ^release- ]]; then
65-
COLLECTOR_BUILDER_TAG="${{ inputs.collector-tag }}"
66-
fi
67-
68-
echo "Rebuild builder image with tag ${COLLECTOR_BUILDER_TAG}"
69-
echo "collector-builder-tag=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_OUTPUT"
70-
echo "build-image=true" >> "$GITHUB_OUTPUT"
71-
7241
build-builder-image:
73-
name: Local builder image
42+
name: Build the builder image
43+
runs-on: ubuntu-24.04
7444
# Multiarch builds sometimes take for eeeeeeeeeever
7545
timeout-minutes: 480
7646
needs:
7747
- builder-needs-rebuilding
7848
if: |
79-
needs.builder-needs-rebuilding.outputs.build-image == 'true'
49+
needs.builder-needs-rebuilding.outputs.build-image == 'true' ||
50+
(github.event_name == 'push' && (
51+
github.ref_type == 'tag' || startsWith(github.ref_name, 'release-')
52+
)) ||
53+
contains(github.event.pull_request.labels.*.name, 'build-builder-image') ||
54+
github.event_name == 'schedule'
55+
outputs:
56+
collector-builder-tag: ${{ steps.builder-tag.outputs.collector-builder-tag }}
8057
strategy:
58+
fail-fast: false
8159
matrix:
82-
arch: [amd64, arm64, ppc64le]
83-
exclude:
84-
- arch: ${{ contains(inputs.architectures, 'ppc64le') && '' || 'ppc64le' }}
85-
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
60+
arch: [amd64, ppc64le, s390x, arm64]
8661

8762
env:
8863
PLATFORM: linux/${{ matrix.arch }}
8964
BUILD_TYPE: ci
90-
COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }}
9165

9266
steps:
9367
- uses: actions/checkout@v4
@@ -102,54 +76,6 @@ jobs:
10276
- name: Set up Docker Buildx
10377
uses: docker/setup-buildx-action@v3
10478

105-
- name: Create ansible vars
106-
run: |
107-
cat << EOF > ${{ github.workspace }}/ansible/secrets.yml
108-
---
109-
stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
110-
stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
111-
rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
112-
rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
113-
collector_git_ref: ${{ github.ref }}
114-
collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}
115-
EOF
116-
117-
- name: Build images
118-
timeout-minutes: 480
119-
run: |
120-
ansible-galaxy install -r ansible/requirements.yml
121-
ansible-playbook \
122-
--connection local \
123-
-i localhost, \
124-
--limit localhost \
125-
-e arch='${{ matrix.arch }}' \
126-
-e @'${{ github.workspace }}/ansible/secrets.yml' \
127-
ansible/ci-build-builder.yml
128-
129-
build-builder-image-remote-vm:
130-
name: Remote builder image
131-
# Multiarch builds sometimes take for eeeeeeeeeever
132-
timeout-minutes: 480
133-
needs:
134-
- builder-needs-rebuilding
135-
if: |
136-
needs.builder-needs-rebuilding.outputs.build-image == 'true' &&
137-
contains(inputs.architectures, 's390x')
138-
strategy:
139-
matrix:
140-
arch: [s390x]
141-
runs-on: ubuntu-24.04
142-
143-
env:
144-
PLATFORM: linux/${{ matrix.arch }}
145-
BUILD_TYPE: ci
146-
COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }}
147-
148-
steps:
149-
- uses: actions/checkout@v4
150-
with:
151-
submodules: true
152-
15379
- uses: actions/setup-python@v5
15480
with:
15581
python-version: "3.10"
@@ -175,22 +101,57 @@ jobs:
175101
job-tag: builder
176102

177103
- name: Create Build VMs
104+
if: |
105+
matrix.arch == 's390x' &&
106+
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds'))
178107
run: |
179108
make -C "${{ github.workspace }}/ansible" create-build-vms
180109
110+
- name: Define builder tag
111+
id: builder-tag
112+
run: |
113+
COLLECTOR_BUILDER_TAG="${DEFAULT_BUILDER_TAG}"
114+
if [[ "${{ github.event_name }}" == 'pull_request' || \
115+
"${{ github.ref_type }}" == 'tag' || \
116+
"${{ github.ref_name }}" =~ ^release- ]]; then
117+
COLLECTOR_BUILDER_TAG="${{ inputs.collector-tag }}"
118+
fi
119+
120+
echo "COLLECTOR_BUILDER_TAG=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_ENV"
121+
echo "collector-builder-tag=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_OUTPUT"
122+
181123
- name: Create ansible vars
182124
run: |
183-
cat << EOF > ${{ github.workspace }}/ansible/secrets.yml
184-
---
185-
stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
186-
stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
187-
rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
188-
rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
189-
collector_git_ref: ${{ github.ref }}
190-
collector_builder_tag: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }}
191-
EOF
125+
{
126+
echo "---"
127+
echo "stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}"
128+
echo "stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}"
129+
echo "rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}"
130+
echo "rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}"
131+
echo "collector_git_ref: ${{ github.ref }}"
132+
echo "collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}"
133+
} > ${{ github.workspace }}/ansible/secrets.yml
192134
193135
- name: Build images
136+
if: |
137+
(github.event_name != 'pull_request' && matrix.arch != 's390x') ||
138+
matrix.arch == 'amd64' ||
139+
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch != 's390x')
140+
timeout-minutes: 480
141+
run: |
142+
ansible-galaxy install -r ansible/requirements.yml
143+
ansible-playbook \
144+
--connection local \
145+
-i localhost, \
146+
--limit localhost \
147+
-e arch='${{ matrix.arch }}' \
148+
-e @'${{ github.workspace }}/ansible/secrets.yml' \
149+
ansible/ci-build-builder.yml
150+
151+
- name: Build s390x images
152+
if: |
153+
(github.event_name != 'pull_request' && matrix.arch == 's390x') ||
154+
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch == 's390x')
194155
timeout-minutes: 480
195156
run: |
196157
ansible-playbook \
@@ -201,23 +162,22 @@ jobs:
201162
ansible/ci-build-builder.yml
202163
203164
- name: Destroy VMs
204-
if: always()
165+
if: always() && matrix.arch == 's390x'
205166
run: |
206167
make -C ansible destroy-vms
207168
208169
create-multiarch-manifest:
209170
needs:
210-
- builder-needs-rebuilding
211171
- build-builder-image
212-
- build-builder-image-remote-vm
213172
name: Create Multiarch manifest
214173
runs-on: ubuntu-24.04
215174
if: |
216-
always() && !contains(join(needs.*.result, ','), 'failure') &&
217-
needs.builder-needs-rebuilding.outputs.build-image == 'true'
175+
github.event_name != 'pull_request' ||
176+
(needs.build-builder-image.outputs.collector-builder-tag != 'cache' &&
177+
contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds'))
218178
env:
219-
COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }}
220-
ARCHS: ${{ inputs.architectures }}
179+
COLLECTOR_BUILDER_TAG: ${{ needs.build-builder-image.outputs.collector-builder-tag }}
180+
ARCHS: amd64 ppc64le s390x arm64
221181

222182
steps:
223183
- uses: actions/checkout@v4
@@ -248,13 +208,45 @@ jobs:
248208
base-image: quay.io/rhacs-eng/collector-builder:${{ env.COLLECTOR_BUILDER_TAG }}
249209
archs: ${{ env.ARCHS }}
250210

211+
retag-x86-image:
212+
needs:
213+
- build-builder-image
214+
name: Retag x86 builder image
215+
runs-on: ubuntu-24.04
216+
if: |
217+
github.event_name == 'pull_request' &&
218+
needs.build-builder-image.outputs.collector-builder-tag != 'cache' &&
219+
!contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')
220+
env:
221+
COLLECTOR_BUILDER_TAG: ${{ needs.build-builder-image.outputs.collector-builder-tag }}
222+
steps:
223+
- name: Pull image to retag
224+
run: |
225+
docker pull "quay.io/stackrox-io/collector-builder:${COLLECTOR_BUILDER_TAG}-amd64"
226+
227+
- name: Retag and push stackrox-io
228+
uses: stackrox/actions/images/retag-and-push@v1
229+
with:
230+
src-image: quay.io/stackrox-io/collector-builder:${{ env.COLLECTOR_BUILDER_TAG }}-amd64
231+
dst-image: quay.io/stackrox-io/collector-builder:${{ env.COLLECTOR_BUILDER_TAG }}
232+
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
233+
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
234+
235+
- name: Retag and push rhacs-eng
236+
uses: stackrox/actions/images/retag-and-push@v1
237+
with:
238+
src-image: quay.io/stackrox-io/collector-builder:${{ env.COLLECTOR_BUILDER_TAG }}-amd64
239+
dst-image: quay.io/rhacs-eng/collector-builder:${{ env.COLLECTOR_BUILDER_TAG }}
240+
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
241+
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
242+
251243
notify:
252244
runs-on: ubuntu-24.04
253245
if: always() && contains(join(needs.*.result, ','), 'failure') && github.event_name != 'pull_request'
254246
needs:
255247
- build-builder-image
256-
- build-builder-image-remote-vm
257248
- create-multiarch-manifest
249+
- retag-x86-image
258250
steps:
259251
- name: Slack notification
260252
uses: rtCamp/action-slack-notify@v2

0 commit comments

Comments
 (0)