Skip to content

Commit 2ee2f6c

Browse files
SaphMBjeduardo
andauthored
Chore: Reuse CI images (#18)
* chore: added build/load image steps and dependency chain --------- Signed-off-by: John Mikos <[email protected]> Co-authored-by: John Mikos <[email protected]>
1 parent c2ec180 commit 2ee2f6c

File tree

1 file changed

+165
-8
lines changed

1 file changed

+165
-8
lines changed

.github/workflows/test-kratix.yaml

Lines changed: 165 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ on:
44
workflow_dispatch:
55
inputs:
66
sha:
7-
description: 'Commit sha of Kratix'
7+
description: "Commit sha of Kratix"
88
required: true
99
type: string
1010
message:
11-
description: 'Commit message'
11+
description: "Commit message"
1212
type: string
1313
required: false
1414
ssh_session:
1515
type: boolean
16-
description: 'Run the build with tmate debugging.'
16+
description: "Run the build with tmate debugging."
1717
required: false
1818
default: false
1919
workflow_call:
@@ -55,29 +55,121 @@ jobs:
5555
go install golang.org/x/vuln/cmd/govulncheck@latest
5656
govulncheck ./...
5757
58-
quick-start-test:
58+
build-kratix-image:
59+
runs-on: ubuntu-latest
60+
needs: [unit-tests-and-lint]
61+
steps:
62+
- name: Checkout ci repository
63+
uses: actions/checkout@v4
64+
with:
65+
repository: syntasso/ci
66+
67+
- name: Setup Common Environment
68+
uses: ./.github/actions/setup-common
69+
with:
70+
repository: syntasso/kratix
71+
ref: ${{ github.event.inputs.sha }}
72+
path: kratix
73+
ssh_session: ${{ github.event.inputs.ssh_session }}
74+
75+
- name: Start tmate ssh debugging session
76+
if: "${{ inputs.ssh_session == 'true' }}"
77+
uses: mxschmitt/action-tmate@v3
78+
with:
79+
limit-access-to-actor: true
80+
detached: true
81+
82+
- name: Build Kratix image
83+
run: |
84+
cd kratix
85+
EXPORT_IMAGE_TAR=$(make export-image)
86+
echo "Image saved to: ${EXPORT_IMAGE_TAR}"
87+
echo "EXPORT_IMAGE_TAR=${EXPORT_IMAGE_TAR}" >> "${GITHUB_ENV}"
88+
89+
- name: Upload Kratix image artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: kratix-image-${{ github.run_id }}
93+
path: ${{ env.EXPORT_IMAGE_TAR }}
94+
retention-days: 1
95+
96+
build-quick-start-installer-image:
5997
runs-on: ubuntu-latest
6098
needs: [unit-tests-and-lint]
6199
steps:
62100
- name: Checkout ci repository
63101
uses: actions/checkout@v4
64102
with:
65103
repository: syntasso/ci
104+
105+
- name: Setup Common Environment
106+
uses: ./.github/actions/setup-common
107+
with:
108+
repository: syntasso/kratix
109+
ref: ${{ github.event.inputs.sha }}
110+
path: kratix
111+
ssh_session: ${{ github.event.inputs.ssh_session }}
112+
113+
- name: Build quick-start installer image
114+
run: |
115+
cd kratix/hack/kratix-quick-start-installer
116+
QUICK_START_INSTALLER_TAR=$(make export-image)
117+
echo "QUICK_START_INSTALLER_TAR=${QUICK_START_INSTALLER_TAR}" >> "${GITHUB_ENV}"
118+
119+
- name: Upload quick-start installer image artifact
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: quick-start-installer-image-${{ github.run_id }}
123+
path: ${{ env.QUICK_START_INSTALLER_TAR }}
124+
retention-days: 1
125+
126+
quick-start-test:
127+
runs-on: ubuntu-latest
128+
needs: [build-kratix-image, build-quick-start-installer-image]
129+
steps:
130+
- name: Checkout ci repository
131+
uses: actions/checkout@v4
132+
with:
133+
repository: syntasso/ci
134+
66135
- name: Setup Common Environment
67136
uses: ./.github/actions/setup-common
68137
with:
69138
repository: syntasso/kratix
70139
ref: ${{ github.event.inputs.sha }}
71140
path: kratix
72141
ssh_session: ${{ github.event.inputs.ssh_session }}
142+
143+
- name: Download quick-start installer image artifact
144+
uses: actions/download-artifact@v4
145+
with:
146+
name: quick-start-installer-image-${{ github.run_id }}
147+
path: ${{ runner.temp }}/quick-start-installer-image
148+
149+
- name: Load quick-start installer image
150+
run: |
151+
image_tar=$(ls $RUNNER_TEMP/quick-start-installer-image/*.tar | head -1)
152+
docker load -i "${image_tar}"
153+
154+
- name: Download Kratix image artifact
155+
uses: actions/download-artifact@v4
156+
with:
157+
name: kratix-image-${{ github.run_id }}
158+
path: ${{ runner.temp }}/kratix-image
159+
160+
- name: Load Kratix image
161+
run: |
162+
image_tar=$(ls $RUNNER_TEMP/kratix-image/*.tar)
163+
docker load -i "${image_tar}"
164+
73165
- name: System Tests
74166
run: |
75167
cd kratix
76168
DOCKER_BUILDKIT=1 ACK_GINKGO_RC=true cd hack/kratix-quick-start-installer && make system-test
77169
78170
system-test:
79171
runs-on: ubuntu-latest
80-
needs: [unit-tests-and-lint]
172+
needs: [build-kratix-image, build-quick-start-installer-image]
81173
strategy:
82174
fail-fast: false
83175
matrix:
@@ -98,13 +190,37 @@ jobs:
98190
uses: actions/checkout@v4
99191
with:
100192
repository: syntasso/ci
193+
101194
- name: Setup Common Environment
102195
uses: ./.github/actions/setup-common
103196
with:
104197
repository: syntasso/kratix
105198
ref: ${{ github.event.inputs.sha }}
106199
path: kratix
107200
ssh_session: ${{ github.event.inputs.ssh_session }}
201+
202+
- name: Download quick-start installer image artifact
203+
uses: actions/download-artifact@v4
204+
with:
205+
name: quick-start-installer-image-${{ github.run_id }}
206+
path: ${{ runner.temp }}/quick-start-installer-image
207+
208+
- name: Load quick-start installer image
209+
run: |
210+
image_tar=$(ls $RUNNER_TEMP/quick-start-installer-image/*.tar | head -1)
211+
docker load -i "${image_tar}"
212+
213+
- name: Download Kratix image artifact
214+
uses: actions/download-artifact@v4
215+
with:
216+
name: kratix-image-${{ github.run_id }}
217+
path: ${{ runner.temp }}/kratix-image
218+
219+
- name: Load Kratix image
220+
run: |
221+
image_tar=$(ls $RUNNER_TEMP/kratix-image/*.tar)
222+
docker load -i "${image_tar}"
223+
108224
- name: System Tests
109225
env: ${{ matrix.flags.env }}
110226
run: |
@@ -113,44 +229,71 @@ jobs:
113229
114230
core-test:
115231
runs-on: ubuntu-latest
116-
needs: [unit-tests-and-lint]
232+
needs: [build-kratix-image]
117233
steps:
118234
- name: Checkout ci repository
119235
uses: actions/checkout@v4
120236
with:
121237
repository: syntasso/ci
238+
122239
- name: Setup Common Environment
123240
uses: ./.github/actions/setup-common
124241
with:
125242
repository: syntasso/kratix
126243
ref: ${{ github.event.inputs.sha }}
127244
path: kratix
128245
ssh_session: ${{ github.event.inputs.ssh_session }}
246+
247+
- name: Download Kratix image artifact
248+
uses: actions/download-artifact@v4
249+
with:
250+
name: kratix-image-${{ github.run_id }}
251+
path: ${{ runner.temp }}/kratix-image
252+
253+
- name: Load Kratix image
254+
run: |
255+
image_tar=$(ls $RUNNER_TEMP/kratix-image/*.tar)
256+
docker load -i "${image_tar}"
257+
129258
- name: System Tests
130259
run: |
131260
cd kratix
132261
DOCKER_BUILDKIT=1 ACK_GINKGO_RC=true make core-test
133262
134263
integration-test-git:
135264
runs-on: ubuntu-latest
136-
needs: [unit-tests-and-lint]
265+
needs: [build-kratix-image]
137266
steps:
138267
- name: Checkout ci repository
139268
uses: actions/checkout@v4
140269
with:
141270
repository: syntasso/ci
271+
142272
- name: Setup Common Environment
143273
uses: ./.github/actions/setup-common
144274
with:
145275
repository: syntasso/kratix
146276
ref: ${{ github.event.inputs.sha }}
147277
path: kratix
148278
ssh_session: ${{ github.event.inputs.ssh_session }}
279+
280+
- name: Download Kratix image artifact
281+
uses: actions/download-artifact@v4
282+
with:
283+
name: kratix-image-${{ github.run_id }}
284+
path: ${{ runner.temp }}/kratix-image
285+
286+
- name: Load Kratix image
287+
run: |
288+
image_tar=$(ls $RUNNER_TEMP/kratix-image/*.tar)
289+
docker load -i "${image_tar}"
290+
149291
- name: Checkout out kratix helm charts
150292
uses: actions/checkout@v4
151293
with:
152294
repository: syntasso/helm-charts
153295
path: kratix/charts
296+
154297
- name: Install Helm
155298
uses: azure/setup-helm@v3
156299
- name: e2e-demo-test-helm-git
@@ -162,24 +305,38 @@ jobs:
162305

163306
integration-test-bucket:
164307
runs-on: ubuntu-latest
165-
needs: [unit-tests-and-lint]
308+
needs: [build-kratix-image]
166309
steps:
167310
- name: Checkout ci repository
168311
uses: actions/checkout@v4
169312
with:
170313
repository: syntasso/ci
314+
171315
- name: Setup Common Environment
172316
uses: ./.github/actions/setup-common
173317
with:
174318
repository: syntasso/kratix
175319
ref: ${{ github.event.inputs.sha }}
176320
path: kratix
177321
ssh_session: ${{ github.event.inputs.ssh_session }}
322+
323+
- name: Download Kratix image artifact
324+
uses: actions/download-artifact@v4
325+
with:
326+
name: kratix-image-${{ github.run_id }}
327+
path: ${{ runner.temp }}/kratix-image
328+
329+
- name: Load Kratix image
330+
run: |
331+
image_tar=$(ls $RUNNER_TEMP/kratix-image/*.tar)
332+
docker load -i "${image_tar}"
333+
178334
- name: Checkout out kratix helm charts
179335
uses: actions/checkout@v4
180336
with:
181337
repository: syntasso/helm-charts
182338
path: kratix/charts
339+
183340
- name: Install Helm
184341
uses: azure/setup-helm@v3
185342
- name: e2e-demo-test-helm-bucket

0 commit comments

Comments
 (0)