generated from EVerest/everest-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use docker save/load for build-kit-<reponame>
Signed-off-by: Andreas Heinrich <[email protected]>
- Loading branch information
Showing
1 changed file
with
60 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,39 +250,61 @@ jobs: | |
fi | ||
echo "latest_tag=$TAG" >> $GITHUB_OUTPUT | ||
build-and-push-build-kit: | ||
name: Build and Push Build Kit | ||
uses: everest/everest-ci/.github/workflows/[email protected] | ||
build-build-kit: | ||
name: Build build-kit | ||
runs-on: ${{ inputs.runner }} | ||
needs: | ||
- setup-env | ||
permissions: | ||
contents: read | ||
packages: write | ||
secrets: | ||
SA_GITHUB_USERNAME: ${{ github.actor }} | ||
SA_GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
image_name: ${{ github.event.repository.name }}/build-kit-${{ github.event.repository.name }} | ||
directory: ${{ inputs.build_kit_docker_directory}} | ||
docker_registry: ${{ inputs.docker_registry }} | ||
github_ref_before: ${{ github.event.before }} | ||
github_ref_after: ${{ github.event.after }} | ||
platforms: linux/amd64 | ||
depends_on_paths: | | ||
${{ inputs.build_kit_scripts_directory }} | ||
${{ needs.setup-env.outputs.workflow_path }} | ||
build_args: | | ||
env: | ||
BUILD_KIT_IMAGE_NAME: local/build-kit-${{ github.event.repository.name }} | ||
PLATFORMS: linux/amd64 | ||
BUILD_ARGS: | | ||
BASE_IMAGE_TAG=${{ needs.setup-env.outputs.tag_everest_ci }} | ||
outputs: | ||
build_kit_image_name: ${{ env.BUILD_KIT_IMAGE_NAME }} | ||
steps: | ||
- name: Checkout Dockerfile | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.repository }} | ||
path: source | ||
ref: ${{ github.ref }} | ||
token: ${{ github.token}} | ||
fetch-depth: 0 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
image: tonistiigi/binfmt:latest | ||
platforms: ${{ env.PLATFORMS }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ${{ inputs.build_kit_docker_directory }} | ||
push: false | ||
platforms: ${{ env.PLATFORMS }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: ${{ env.BUILD_ARGS }} | ||
- name: Save build-kit image | ||
run: | | ||
docker save ${{ env.BUILD_KIT_IMAGE_NAME }} -o build-kit.tar | ||
- name: Upload build-kit image | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-kit | ||
path: build-kit.tar | ||
|
||
build: | ||
name: Build, Unit Tests and Install | ||
needs: | ||
- setup-env | ||
- build-and-push-build-kit | ||
- build-build-kit | ||
runs-on: ${{ inputs.runner }} | ||
env: | ||
BUILD_KIT_IMAGE: ${{ needs.build-and-push-build-kit.outputs.one_image_tag_long }} | ||
BUILD_KIT_IMAGE: ${{ needs.build-build-kit.outputs.build_kit_image_name }} | ||
steps: | ||
- name: Checkout local github actions | ||
uses: actions/checkout@v3 | ||
|
@@ -312,9 +334,13 @@ jobs: | |
run: | | ||
mkdir scripts | ||
rsync -a source/${{ inputs.build_kit_scripts_directory }}/ scripts | ||
- name: Pull build-kit image | ||
- name: Download build-kit image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-kit | ||
- name: Load build-kit image | ||
run: | | ||
docker pull --quiet ${{ env.BUILD_KIT_IMAGE }} | ||
docker load -i build-kit.tar | ||
docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit | ||
- name: Compile | ||
run: | | ||
|
@@ -411,9 +437,9 @@ jobs: | |
needs: | ||
- setup-env | ||
- build | ||
- build-and-push-build-kit | ||
- build-build-kit | ||
env: | ||
BUILD_KIT_IMAGE: ${{ needs.build-and-push-build-kit.outputs.one_image_tag_long }} | ||
BUILD_KIT_IMAGE: ${{ needs.build-build-kit.outputs.build_kit_image_name }} | ||
runs-on: ${{ inputs.runner }} | ||
if: ${{ inputs.run_integration_tests == 'true' }} | ||
steps: | ||
|
@@ -438,9 +464,13 @@ jobs: | |
run: | | ||
mkdir scripts | ||
rsync -a source/${{ inputs.build_kit_scripts_directory }}/ scripts | ||
- name: Pull build-kit image | ||
- name: Download build-kit image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-kit | ||
- name: Load build-kit image | ||
run: | | ||
docker pull --quiet ${{ env.BUILD_KIT_IMAGE }} | ||
docker load -i build-kit.tar | ||
docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit | ||
- name: Create integration-image | ||
run: | | ||
|