Skip to content

Commit

Permalink
Use upload/download to share airgap bundles between tests
Browse files Browse the repository at this point in the history
This removes the cache hack that was used to share the prebuilt image
bundles with the integration tests. The upload/download action is now
reasonably fast.

Signed-off-by: Tom Wieczorek <[email protected]>
  • Loading branch information
twz123 committed Jan 12, 2024
1 parent d8ef4c6 commit f1e55b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/build-airgap-image-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
name: "${{ inputs.target-os }}-${{ inputs.target-arch }}"
runs-on: ubuntu-22.04

outputs:
cache-key: ${{ steps.cache-airgap-image-bundle-calc-key.outputs.cache-key }}

env:
TARGET_OS: ${{ inputs.target-os }}
TARGET_ARCH: ${{ inputs.target-arch }}
Expand All @@ -38,11 +35,9 @@ jobs:
with:
name: airgap-image-list-${{ inputs.target-os }}-${{ inputs.target-arch }}

# Capture the calculated image bundle source hash in a build output, so
# it can be shared between the cache actions in this job and in the
# smoketests. Do this in a separate step, as the hashFiles function is
# evaluated before the step execution. So all the required files need to
# exist before that.
# Capture the calculated image bundle source hash in a separate step, as
# the hashFiles function is evaluated before the step execution. So all
# the required files need to exist before that.
- name: "Cache :: Airgap image bundle :: Calculate cache key"
id: cache-airgap-image-bundle-calc-key
env:
Expand All @@ -56,11 +51,17 @@ jobs:
with:
key: ${{ steps.cache-airgap-image-bundle-calc-key.outputs.cache-key }}
path: airgap-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}.tar
lookup-only: true

- name: "Build :: Airgap image bundle"
if: steps.cache-airgap-image-bundle.outputs.cache-hit != 'true'
run: |
mkdir -p "embedded-bins/staging/$TARGET_OS/bin"
make --touch airgap-images.txt
make "airgap-image-bundle-$TARGET_OS-$TARGET_ARCH.tar"
- name: "Upload :: Airgap image bundle"
uses: actions/upload-artifact@v4
with:
name: airgap-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}
path: airgap-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}.tar
compression: 0
17 changes: 4 additions & 13 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,14 @@ jobs:
chmod +x k0s
./k0s sysinfo
- name: Cache airgap image bundle
id: cache-airgap-image-bundle
- name: Download airgap image bundle
if: contains(matrix.smoke-suite, 'airgap')
uses: actions/cache@v3
uses: actions/download-artifact@v4
with:
key: ${{ needs.build-airgap-image-bundle.outputs.cache-key }}
path: airgap-image-bundle-linux-amd64.tar
name: airgap-image-bundle-linux-amd64

- name: Run inttest
env:
NEEDS_AIRGAP_IMAGE_BUNDLE: ${{ contains(matrix.smoke-suite, 'airgap') }}
run: |
[ "$NEEDS_AIRGAP_IMAGE_BUNDLE" != true ] || [ -f airgap-image-bundle-linux-amd64.tar ] || {
echo Airgap image bundle file missing!
exit 1
}
make -C inttest ${{ matrix.smoke-suite }}
run: make -C inttest ${{ matrix.smoke-suite }}

- name: Collect k0s logs and support bundle
if: failure()
Expand Down

0 comments on commit f1e55b6

Please sign in to comment.