Skip to content

Commit 9978e0c

Browse files
committed
split
1 parent 97d0158 commit 9978e0c

File tree

2 files changed

+112
-36
lines changed

2 files changed

+112
-36
lines changed

.github/workflows/collector-builder.yml

Lines changed: 72 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ jobs:
6060
collector-builder-tag: ${{ steps.builder-tag.outputs.collector-builder-tag }}
6161
strategy:
6262
matrix:
63-
include: ${{ fromJSON(inputs.include-arch-json) }}
64-
runs-on: ${{ matrix.runner }}
63+
arch: [amd64, arm64]
64+
runs-on: ${{ (matrix.arch != 'arm64' && ubuntu-24.04) || 'ubuntu-24.04-arm' }}
6565

6666
env:
6767
PLATFORM: linux/${{ matrix.arch }}
@@ -73,30 +73,91 @@ jobs:
7373
submodules: true
7474

7575
- name: Set up QEMU
76-
if: matrix.remote != true
7776
uses: docker/setup-qemu-action@v3
7877
with:
7978
image: tonistiigi/binfmt:qemu-v8.1.5
8079

8180
- name: Set up Docker Buildx
82-
if: matrix.remote != true
8381
uses: docker/setup-buildx-action@v3
8482

83+
- name: Define builder tag
84+
id: builder-tag
85+
run: |
86+
COLLECTOR_BUILDER_TAG="${DEFAULT_BUILDER_TAG}"
87+
if [[ "${{ github.event_name }}" == 'pull_request' || \
88+
"${{ github.ref_type }}" == 'tag' || \
89+
"${{ github.ref_name }}" =~ ^release- ]]; then
90+
COLLECTOR_BUILDER_TAG="${{ inputs.collector-tag }}"
91+
fi
92+
93+
echo "COLLECTOR_BUILDER_TAG=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_ENV"
94+
echo "collector-builder-tag=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_OUTPUT"
95+
96+
- name: Create ansible vars
97+
run: |
98+
{
99+
echo "---"
100+
echo "stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}"
101+
echo "stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}"
102+
echo "rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}"
103+
echo "rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}"
104+
echo "collector_git_ref: ${{ github.ref }}"
105+
echo "collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}"
106+
} > ${{ github.workspace }}/ansible/secrets.yml
107+
108+
- name: Build images
109+
timeout-minutes: 480
110+
run: |
111+
ansible-galaxy install -r ansible/requirements.yml
112+
ansible-playbook \
113+
--connection local \
114+
-i localhost, \
115+
--limit localhost \
116+
-e arch='${{ matrix.arch }}' \
117+
-e @'${{ github.workspace }}/ansible/secrets.yml' \
118+
ansible/ci-build-builder.yml
119+
120+
build-builder-image-remote:
121+
if: contains(inputs.include-arch-json, 's390x')
122+
name: Build the builder image
123+
# Multiarch builds sometimes take for eeeeeeeeeever
124+
timeout-minutes: 480
125+
needs:
126+
- builder-needs-rebuilding
127+
if: |
128+
needs.builder-needs-rebuilding.outputs.build-image == 'true' ||
129+
(github.event_name == 'push' && (
130+
github.ref_type == 'tag' || startsWith(github.ref_name, 'release-')
131+
)) ||
132+
contains(github.event.pull_request.labels.*.name, 'build-builder-image') ||
133+
github.event_name == 'schedule'
134+
outputs:
135+
collector-builder-tag: ${{ steps.builder-tag.outputs.collector-builder-tag }}
136+
strategy:
137+
matrix:
138+
arch: [s390x]
139+
runs-on: ubuntu-24.04
140+
141+
env:
142+
PLATFORM: linux/${{ matrix.arch }}
143+
BUILD_TYPE: ci
144+
145+
steps:
146+
- uses: actions/checkout@v4
147+
with:
148+
submodules: true
149+
85150
- uses: actions/setup-python@v5
86-
if: matrix.remote
87151
with:
88152
python-version: "3.10"
89153

90154
- uses: 'google-github-actions/auth@v2'
91-
if: matrix.remote
92155
with:
93156
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}'
94157

95158
- uses: 'google-github-actions/setup-gcloud@v2'
96-
if: matrix.remote
97159

98160
- uses: ./.github/actions/setup-vm-creds
99-
if: matrix.remote
100161
with:
101162
gcp-ssh-key: ${{ secrets.GCP_SSH_KEY }}
102163
gcp-ssh-key-pub: ${{ secrets.GCP_SSH_KEY_PUB }}
@@ -111,7 +172,6 @@ jobs:
111172
job-tag: builder
112173

113174
- name: Create Build VMs
114-
if: matrix.remote
115175
run: |
116176
make -C "${{ github.workspace }}/ansible" create-build-vms
117177
@@ -140,21 +200,7 @@ jobs:
140200
echo "collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}"
141201
} > ${{ github.workspace }}/ansible/secrets.yml
142202
143-
- name: Build images
144-
if: matrix.remote != true
145-
timeout-minutes: 480
146-
run: |
147-
ansible-galaxy install -r ansible/requirements.yml
148-
ansible-playbook \
149-
--connection local \
150-
-i localhost, \
151-
--limit localhost \
152-
-e arch='${{ matrix.arch }}' \
153-
-e @'${{ github.workspace }}/ansible/secrets.yml' \
154-
ansible/ci-build-builder.yml
155-
156203
- name: Build s390x images
157-
if: matrix.remote
158204
timeout-minutes: 480
159205
run: |
160206
ansible-playbook \
@@ -165,13 +211,14 @@ jobs:
165211
ansible/ci-build-builder.yml
166212
167213
- name: Destroy VMs
168-
if: always() && matrix.remote
214+
if: always()
169215
run: |
170216
make -C ansible destroy-vms
171217
172218
create-multiarch-manifest:
173219
needs:
174220
- build-builder-image
221+
- build-builder-image-remote
175222
name: Create Multiarch manifest
176223
runs-on: ubuntu-24.04
177224
if: |
@@ -215,6 +262,7 @@ jobs:
215262
if: always() && contains(join(needs.*.result, ','), 'failure') && github.event_name != 'pull_request'
216263
needs:
217264
- build-builder-image
265+
- build-builder-image-remote
218266
- create-multiarch-manifest
219267
steps:
220268
- name: Slack notification

.github/workflows/collector.yml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
name: Build Collector
3838
strategy:
3939
matrix:
40-
include: ${{ fromJSON(inputs.include-arch-json) }}
41-
runs-on: ${{ matrix.runner }}
40+
arch: [amd64, arm64]
41+
runs-on: ${{ (matrix.arch != 'arm64' && ubuntu-24.04) || 'ubuntu-24.04-arm' }}
4242

4343
env:
4444
PLATFORM: linux/${{ matrix.arch }}
@@ -50,13 +50,11 @@ jobs:
5050
submodules: true
5151

5252
- name: Set up QEMU
53-
if: matrix.remote != true
5453
uses: docker/setup-qemu-action@v3
5554
with:
5655
image: tonistiigi/binfmt:qemu-v8.1.5
5756

5857
- name: Set up Docker Buildx
59-
if: matrix.remote != true
6058
uses: docker/setup-buildx-action@v3
6159

6260
- name: Create ansible vars
@@ -79,7 +77,6 @@ jobs:
7977
EOF
8078
8179
- name: Build ${{ matrix.arch }} image locally
82-
if: matrix.remote != true
8380
timeout-minutes: 480
8481
run: |
8582
ansible-playbook \
@@ -90,21 +87,53 @@ jobs:
9087
-e @'${{ github.workspace }}/ansible/secrets.yml' \
9188
ansible/ci-build-collector.yml
9289
90+
build-collector-image-remote:
91+
if: contains(inputs.include-arch-json, 's390x')
92+
name: Build Collector
93+
strategy:
94+
matrix:
95+
arch: [s390x]
96+
runs-on: ubuntu-24.04
97+
98+
env:
99+
PLATFORM: linux/${{ matrix.arch }}
100+
CONTEXT_DRIVERS_DIR: ${{ github.workspace }}/collector/kernel-modules
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
with:
105+
submodules: true
106+
107+
- name: Create ansible vars
108+
run: |
109+
cat << EOF > ${{ github.workspace }}/ansible/secrets.yml
110+
---
111+
stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
112+
stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
113+
rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
114+
rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
115+
collector_git_ref: ${{ github.ref }}
116+
collector_git_sha: ${{ github.sha }}
117+
collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}
118+
disable_profiling: ${{ matrix.arch != 'amd64' && matrix.arch != 'arm64' }}
119+
rhacs_eng_image: ${{ env.RHACS_ENG_IMAGE }}
120+
collector_image: ${{ inputs.collector-image }}
121+
collector_tag: ${{ inputs.collector-tag }}
122+
debug_mode: ${{ github.event_name == 'pull_request' }}
123+
driver_version: ${DRIVER_VERSION}
124+
EOF
125+
93126
- uses: actions/setup-python@v5
94-
if: matrix.remote
95127
with:
96128
python-version: "3.10"
97129

98130
- uses: 'google-github-actions/auth@v2'
99-
if: matrix.remote
100131
with:
101132
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}'
102133

103134
- uses: 'google-github-actions/setup-gcloud@v2'
104-
if: matrix.remote
105135

106136
- uses: ./.github/actions/setup-vm-creds
107-
if: matrix.remote
108137
with:
109138
gcp-ssh-key: ${{ secrets.GCP_SSH_KEY }}
110139
gcp-ssh-key-pub: ${{ secrets.GCP_SSH_KEY_PUB }}
@@ -119,12 +148,10 @@ jobs:
119148
job-tag: builder
120149

121150
- name: Create Build VMs
122-
if: matrix.remote
123151
run: |
124152
make -C "${{ github.workspace }}/ansible" create-build-vms
125153
126154
- name: Build ${{ matrix.arch }} image remotely
127-
if: matrix.remote
128155
timeout-minutes: 480
129156
run: |
130157
ansible-playbook \
@@ -135,7 +162,7 @@ jobs:
135162
ansible/ci-build-collector.yml
136163
137164
- name: Destroy Build VMs
138-
if: always() && matrix.remote
165+
if: always()
139166
run: |
140167
make -C ansible destroy-vms
141168
@@ -182,6 +209,7 @@ jobs:
182209
if: always() && contains(join(needs.*.result, ','), 'failure') && github.event_name != 'pull_request'
183210
needs:
184211
- build-collector-image
212+
- build-collector-image-remote
185213
- create-multiarch-manifest
186214
steps:
187215
- name: Slack notification

0 commit comments

Comments
 (0)