Skip to content

Commit

Permalink
Use docker save/load for build-kit-<reponame>
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Heinrich <[email protected]>
  • Loading branch information
andistorm committed Oct 21, 2024
1 parent 71024d6 commit e19d4d0
Showing 1 changed file with 60 additions and 30 deletions.
90 changes: 60 additions & 30 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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:
Expand All @@ -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: |
Expand Down

0 comments on commit e19d4d0

Please sign in to comment.