Skip to content

Commit f50505e

Browse files
committed
feat(ci): build otel images
This enables building images with the opentelemetry output enabled, making it easier to run integration tests with it.
1 parent aa1e620 commit f50505e

3 files changed

Lines changed: 142 additions & 124 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -128,136 +128,34 @@ jobs:
128128
pip install ruff
129129
make format-check
130130
131-
vars:
132-
runs-on: ubuntu-24.04
133-
outputs:
134-
tag: ${{ steps.vars.outputs.tag }}
135-
stackrox-io-image: ${{ steps.vars.outputs.stackrox-io-image }}
136-
rhacs-eng-image: ${{ steps.vars.outputs.rhacs-eng-image }}
137-
steps:
138-
- uses: actions/checkout@v4
139-
with:
140-
submodules: true
141-
fetch-depth: 0
142-
143-
- id: vars
144-
run: |
145-
cat << EOF >> "$GITHUB_OUTPUT"
146-
tag=$(make tag)
147-
stackrox-io-image=$(make image-name)
148-
rhacs-eng-image=$(FACT_REGISTRY="quay.io/rhacs-eng/fact" make image-name)
149-
EOF
150-
151-
container:
152-
needs:
153-
- vars
154-
strategy:
155-
fail-fast: false
156-
matrix:
157-
arch:
158-
- amd64
159-
- arm64
160-
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
161-
env:
162-
FACT_TAG: ${{ needs.vars.outputs.tag }}-${{ matrix.arch }}
163-
FACT_VERSION: ${{ needs.vars.outputs.tag }}
164-
STACKROX_IO_IMAGE: ${{ needs.vars.outputs.stackrox-io-image }}-${{ matrix.arch }}
165-
RHACS_ENG_IMAGE: ${{ needs.vars.outputs.rhacs-eng-image }}-${{ matrix.arch }}
166-
steps:
167-
- uses: actions/checkout@v4
168-
with:
169-
submodules: true
170-
171-
- name: Build image
172-
run: DOCKER=podman make image
173-
174-
- name: Login to quay.io/stackrox-io
175-
uses: docker/login-action@v3
176-
with:
177-
registry: quay.io
178-
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
179-
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
180-
181-
- run: podman push "${STACKROX_IO_IMAGE}"
182-
183-
- name: Login to quay.io/rhacs-eng
184-
uses: docker/login-action@v3
185-
with:
186-
registry: quay.io
187-
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
188-
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
189-
190-
- name: Tag and push to rhacs-eng
191-
run: |
192-
podman tag "${STACKROX_IO_IMAGE}" "${RHACS_ENG_IMAGE}"
193-
podman push "${RHACS_ENG_IMAGE}"
194-
195-
manifest-stackrox-io:
196-
runs-on: ubuntu-24.04
197-
needs:
198-
- container
199-
- vars
200-
env:
201-
ARCHS: amd64 arm64
202-
steps:
203-
- uses: redhat-actions/podman-login@v1
204-
with:
205-
registry: quay.io
206-
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
207-
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
208-
209-
- name: Create multiarch manifest
210-
run: |
211-
podman manifest create ${{ needs.vars.outputs.stackrox-io-image }} \
212-
${{ needs.vars.outputs.stackrox-io-image }}-amd64 \
213-
${{ needs.vars.outputs.stackrox-io-image }}-arm64
214-
podman manifest inspect ${{ needs.vars.outputs.stackrox-io-image }}
215-
podman manifest push ${{ needs.vars.outputs.stackrox-io-image }}
216-
217-
manifest-rhacs-eng:
218-
runs-on: ubuntu-24.04
219-
needs:
220-
- container
221-
- vars
222-
env:
223-
ARCHS: amd64 arm64
224-
steps:
225-
- uses: redhat-actions/podman-login@v1
226-
with:
227-
registry: quay.io
228-
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
229-
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
131+
container-build:
132+
uses: ./.github/workflows/container-build.yml
133+
secrets: inherit
230134

231-
- name: Create multiarch manifest
232-
run: |
233-
podman manifest create ${{ needs.vars.outputs.rhacs-eng-image }} \
234-
${{ needs.vars.outputs.rhacs-eng-image }}-amd64 \
235-
${{ needs.vars.outputs.rhacs-eng-image }}-arm64
236-
podman manifest inspect ${{ needs.vars.outputs.rhacs-eng-image }}
237-
podman manifest push ${{ needs.vars.outputs.rhacs-eng-image }}
135+
container-build-otel:
136+
uses: ./.github/workflows/container-build.yml
137+
secrets: inherit
138+
with:
139+
tag-suffix: '-otel'
140+
make-target: 'image-otel'
238141

239142
unit-tests:
240143
uses: ./.github/workflows/unit-tests.yml
241144
secrets: inherit
242145

243146
integration-tests:
244147
needs:
245-
- vars
246-
- manifest-stackrox-io
247-
- manifest-rhacs-eng
148+
- container-build
248149
uses: ./.github/workflows/integration-tests.yml
249150
with:
250-
tag: ${{ needs.vars.outputs.tag }}
151+
tag: ${{ needs.container-build.outputs.tag }}
251152
secrets: inherit
252153

253154
performance-tests:
254155
if: github.event_name == 'schedule'
255156
needs:
256-
- vars
257-
- manifest-stackrox-io
258-
- manifest-rhacs-eng
259-
- integration-tests
260-
uses: ./.github/workflows/performance-tests.yml
157+
- container-build
158+
uses: ./.github/workflows/integration-tests.yml
261159
with:
262-
tag: ${{ needs.vars.outputs.tag }}
160+
tag: ${{ needs.container-build.outputs.tag }}
263161
secrets: inherit
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Build container
2+
on:
3+
workflow_call:
4+
inputs:
5+
tag-suffix:
6+
required: false
7+
default: ''
8+
type: string
9+
make-target:
10+
required: false
11+
default: 'image'
12+
type: string
13+
outputs:
14+
tag:
15+
value: ${{ jobs.vars.outputs.tag }}
16+
17+
jobs:
18+
vars:
19+
runs-on: ubuntu-24.04
20+
outputs:
21+
tag: ${{ steps.vars.outputs.tag }}
22+
stackrox-io-image: ${{ steps.vars.outputs.stackrox-io-image }}
23+
rhacs-eng-image: ${{ steps.vars.outputs.rhacs-eng-image }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
submodules: true
28+
fetch-depth: 0
29+
30+
- id: vars
31+
run: |
32+
cat << EOF >> "$GITHUB_OUTPUT"
33+
tag=$(make tag)${{ inputs.tag-suffix }}
34+
stackrox-io-image=$(make image-name)${{ inputs.tag-suffix }}
35+
rhacs-eng-image=$(FACT_REGISTRY="quay.io/rhacs-eng/fact" make image-name)${{ inputs.tag-suffix }}
36+
EOF
37+
38+
container:
39+
needs:
40+
- vars
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
arch:
45+
- amd64
46+
- arm64
47+
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
48+
env:
49+
FACT_TAG: ${{ needs.vars.outputs.tag }}-${{ matrix.arch }}
50+
FACT_VERSION: ${{ needs.vars.outputs.tag }}
51+
STACKROX_IO_IMAGE: ${{ needs.vars.outputs.stackrox-io-image }}-${{ matrix.arch }}
52+
RHACS_ENG_IMAGE: ${{ needs.vars.outputs.rhacs-eng-image }}-${{ matrix.arch }}
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
submodules: true
57+
58+
- name: Build image
59+
run: DOCKER=podman make ${{ inputs.make-target }}
60+
61+
- name: Login to quay.io/stackrox-io
62+
uses: docker/login-action@v3
63+
with:
64+
registry: quay.io
65+
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
66+
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
67+
68+
- run: podman push "${STACKROX_IO_IMAGE}"
69+
70+
- name: Login to quay.io/rhacs-eng
71+
uses: docker/login-action@v3
72+
with:
73+
registry: quay.io
74+
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
75+
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
76+
77+
- name: Tag and push to rhacs-eng
78+
run: |
79+
podman tag "${STACKROX_IO_IMAGE}" "${RHACS_ENG_IMAGE}"
80+
podman push "${RHACS_ENG_IMAGE}"
81+
82+
manifest-stackrox-io:
83+
runs-on: ubuntu-24.04
84+
needs:
85+
- container
86+
- vars
87+
env:
88+
ARCHS: amd64 arm64
89+
steps:
90+
- uses: redhat-actions/podman-login@v1
91+
with:
92+
registry: quay.io
93+
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
94+
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
95+
96+
- name: Create multiarch manifest
97+
run: |
98+
podman manifest create ${{ needs.vars.outputs.stackrox-io-image }} \
99+
${{ needs.vars.outputs.stackrox-io-image }}-amd64 \
100+
${{ needs.vars.outputs.stackrox-io-image }}-arm64
101+
podman manifest inspect ${{ needs.vars.outputs.stackrox-io-image }}
102+
podman manifest push ${{ needs.vars.outputs.stackrox-io-image }}
103+
104+
manifest-rhacs-eng:
105+
runs-on: ubuntu-24.04
106+
needs:
107+
- container
108+
- vars
109+
env:
110+
ARCHS: amd64 arm64
111+
steps:
112+
- uses: redhat-actions/podman-login@v1
113+
with:
114+
registry: quay.io
115+
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
116+
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
117+
118+
- name: Create multiarch manifest
119+
run: |
120+
podman manifest create ${{ needs.vars.outputs.rhacs-eng-image }} \
121+
${{ needs.vars.outputs.rhacs-eng-image }}-amd64 \
122+
${{ needs.vars.outputs.rhacs-eng-image }}-arm64
123+
podman manifest inspect ${{ needs.vars.outputs.rhacs-eng-image }}
124+
podman manifest push ${{ needs.vars.outputs.rhacs-eng-image }}
125+

Makefile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,12 @@ image:
1717
-f Containerfile \
1818
--build-arg FACT_VERSION=$(FACT_VERSION) \
1919
--build-arg RUST_VERSION=$(RUST_VERSION) \
20+
--build-arg CARGO_ARGS="$(CARGO_ARGS)" \
2021
-t $(FACT_IMAGE_NAME) \
2122
$(CURDIR)
2223

23-
image-otel:
24-
$(DOCKER) build \
25-
-f Containerfile \
26-
--build-arg FACT_VERSION=$(FACT_VERSION) \
27-
--build-arg RUST_VERSION=$(RUST_VERSION) \
28-
--build-arg CARGO_ARGS="--features otel" \
29-
-t $(FACT_IMAGE_NAME)-otel \
30-
$(CURDIR)
24+
image-otel: CARGO_ARGS = --features otel
25+
image-otel: image
3126

3227
licenses:THIRD_PARTY_LICENSES.html
3328

0 commit comments

Comments
 (0)