Skip to content

Commit 5356ac2

Browse files
authored
Use artifacts instead of GHCR for build-kit-<reponame> (#58)
* Use docker save/load for build-kit-<reponame> Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * fix context path Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * add tags Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * specify outputs instead of tags Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * define tags Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * another try Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * save directly in file Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * Changes * Use tags for build-kit-<reponame> * Don't support multi platform build Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * readd buildx Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * minor usage fix Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * use yaml as defaullt instead of yml Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * minor fix Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> * rename ci job Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de> --------- Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>
1 parent 71024d6 commit 5356ac2

File tree

1 file changed

+75
-33
lines changed

1 file changed

+75
-33
lines changed

.github/workflows/continuous_integration.yml

+75-33
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ on:
115115
docker_compose_file_path:
116116
description: 'The path to the docker-compose file, relative to the repository root'
117117
required: false
118-
default: '.ci/e2e/docker-compose.yml'
118+
default: '.ci/e2e/docker-compose.yaml'
119119
type: string
120120
integration_image_name:
121121
description: 'The name of the integration image'
@@ -250,39 +250,72 @@ jobs:
250250
fi
251251
252252
echo "latest_tag=$TAG" >> $GITHUB_OUTPUT
253-
254-
build-and-push-build-kit:
255-
name: Build and Push Build Kit
256-
uses: everest/everest-ci/.github/workflows/deploy-single-docker-image.yml@v1.3.1
253+
254+
build-the-build-kit:
255+
name: Build build-kit
256+
runs-on: ${{ inputs.runner }}
257257
needs:
258258
- setup-env
259-
permissions:
260-
contents: read
261-
packages: write
262-
secrets:
263-
SA_GITHUB_USERNAME: ${{ github.actor }}
264-
SA_GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
265-
with:
266-
image_name: ${{ github.event.repository.name }}/build-kit-${{ github.event.repository.name }}
267-
directory: ${{ inputs.build_kit_docker_directory}}
268-
docker_registry: ${{ inputs.docker_registry }}
269-
github_ref_before: ${{ github.event.before }}
270-
github_ref_after: ${{ github.event.after }}
271-
platforms: linux/amd64
272-
depends_on_paths: |
273-
${{ inputs.build_kit_scripts_directory }}
274-
${{ needs.setup-env.outputs.workflow_path }}
275-
build_args: |
259+
env:
260+
BUILD_KIT_IMAGE_NAME: local/build-kit-${{ github.event.repository.name }}
261+
BUILD_ARGS: |
276262
BASE_IMAGE_TAG=${{ needs.setup-env.outputs.tag_everest_ci }}
277-
263+
outputs:
264+
build_kit_image_tag: ${{ steps.set-outputs.outputs.tag }}
265+
steps:
266+
- name: Checkout Dockerfile
267+
uses: actions/checkout@v4
268+
with:
269+
repository: ${{ github.repository }}
270+
path: source
271+
ref: ${{ github.ref }}
272+
token: ${{ github.token}}
273+
fetch-depth: 0
274+
- name: Docker Meta
275+
id: meta
276+
uses: docker/metadata-action@v5
277+
with:
278+
images: ${{ env.BUILD_KIT_IMAGE_NAME }}
279+
- name: Setup Docker buildx
280+
uses: docker/setup-buildx-action@v3
281+
- name: Build
282+
uses: docker/build-push-action@v6
283+
with:
284+
context: source/${{ inputs.build_kit_docker_directory }}
285+
push: false
286+
cache-from: type=gha
287+
cache-to: type=gha,mode=max
288+
build-args: ${{ env.BUILD_ARGS }}
289+
tags: ${{ steps.meta.outputs.tags }}
290+
labels: ${{ steps.meta.outputs.labels }}
291+
outputs: type=docker,dest=build-kit.tar
292+
- name: Upload build-kit image
293+
uses: actions/upload-artifact@v4
294+
with:
295+
name: build-kit
296+
path: build-kit.tar
297+
- name: Set output tag
298+
id: set-outputs
299+
shell: python3 {0}
300+
run: |
301+
import os
302+
tags = "${{ steps.meta.outputs.tags }}".split(",")
303+
if len(tags) == 0:
304+
print("No tags found!❌")
305+
exit(1)
306+
tag = tags[0]
307+
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
308+
f.write(f"tag={tag}\n")
309+
print(f"Set tag={tag}")
310+
278311
build:
279312
name: Build, Unit Tests and Install
280313
needs:
281314
- setup-env
282-
- build-and-push-build-kit
315+
- build-the-build-kit
283316
runs-on: ${{ inputs.runner }}
284317
env:
285-
BUILD_KIT_IMAGE: ${{ needs.build-and-push-build-kit.outputs.one_image_tag_long }}
318+
BUILD_KIT_IMAGE: ${{ needs.build-the-build-kit.outputs.build_kit_image_tag }}
286319
steps:
287320
- name: Checkout local github actions
288321
uses: actions/checkout@v3
@@ -312,9 +345,13 @@ jobs:
312345
run: |
313346
mkdir scripts
314347
rsync -a source/${{ inputs.build_kit_scripts_directory }}/ scripts
315-
- name: Pull build-kit image
348+
- name: Download build-kit image
349+
uses: actions/download-artifact@v4
350+
with:
351+
name: build-kit
352+
- name: Load build-kit image
316353
run: |
317-
docker pull --quiet ${{ env.BUILD_KIT_IMAGE }}
354+
docker load -i build-kit.tar
318355
docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit
319356
- name: Compile
320357
run: |
@@ -411,9 +448,9 @@ jobs:
411448
needs:
412449
- setup-env
413450
- build
414-
- build-and-push-build-kit
451+
- build-the-build-kit
415452
env:
416-
BUILD_KIT_IMAGE: ${{ needs.build-and-push-build-kit.outputs.one_image_tag_long }}
453+
BUILD_KIT_IMAGE: ${{ needs.build-the-build-kit.outputs.build_kit_image_tag }}
417454
runs-on: ${{ inputs.runner }}
418455
if: ${{ inputs.run_integration_tests == 'true' }}
419456
steps:
@@ -438,9 +475,13 @@ jobs:
438475
run: |
439476
mkdir scripts
440477
rsync -a source/${{ inputs.build_kit_scripts_directory }}/ scripts
441-
- name: Pull build-kit image
478+
- name: Download build-kit image
479+
uses: actions/download-artifact@v4
480+
with:
481+
name: build-kit
482+
- name: Load build-kit image
442483
run: |
443-
docker pull --quiet ${{ env.BUILD_KIT_IMAGE }}
484+
docker load -i build-kit.tar
444485
docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit
445486
- name: Create integration-image
446487
run: |
@@ -452,8 +493,9 @@ jobs:
452493
- name: Run integration tests
453494
id: run_integration_tests
454495
run: |
455-
docker compose run \
496+
docker compose \
456497
-f source/${{ inputs.docker_compose_file_path }} \
498+
run \
457499
${{ inputs.test_service_name }} \
458500
run-script run_integration_tests
459501
- name: Upload result and report as artifact
@@ -462,7 +504,7 @@ jobs:
462504
with:
463505
if-no-files-found: error
464506
name: integration-test-report
465-
path:
507+
path: |
466508
${{ inputs.result_xml_path }}
467509
${{ inputs.report_html_path }}
468510
- name: Render result

0 commit comments

Comments
 (0)