diff --git a/.github/workflows/build-latest-aurora.yml b/.github/workflows/build-latest-aurora.yml index 643c9f83dd9..4a51c0deef0 100644 --- a/.github/workflows/build-latest-aurora.yml +++ b/.github/workflows/build-latest-aurora.yml @@ -26,3 +26,4 @@ jobs: with: brand_name: aurora fedora_version: latest + rechunk: true diff --git a/.github/workflows/build-latest-bluefin.yml b/.github/workflows/build-latest-bluefin.yml index 9ef35430ad6..dbbabf58e55 100644 --- a/.github/workflows/build-latest-bluefin.yml +++ b/.github/workflows/build-latest-bluefin.yml @@ -26,3 +26,4 @@ jobs: with: brand_name: bluefin fedora_version: latest + rechunk: true diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 0d4b0217c58..38e7f55f852 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -10,6 +10,11 @@ on: description: "'aurora' or 'bluefin'" required: true type: string + rechunk: + description: "Rechunk the image" + required: false + type: boolean + default: false outputs: images: description: "An array of images built and pushed to the registry" @@ -173,7 +178,7 @@ jobs: with: containers: ${{ env.AKMODS_FLAVOR }}-kernel:${{ env.kernel_release }} - - name: Verify Kernel Verion Matches + - name: Verify Kernel Version Matches uses: Wandalen/wretry.action@6feedb7dedadeb826de0f45ff482b53b379a7844 # v3.5.0 with: attempt_limit: 3 @@ -189,8 +194,9 @@ jobs: fi - name: Maximize build space - if: contains(matrix.base_name, '-dx') && (github.event_name == 'pull_request' && ( matrix.image_flavor == 'main' || matrix.image_flavor == 'nvidia' ) || github.event_name != 'pull_request') uses: ublue-os/remove-unwanted-software@517622d6452028f266b7ba4cc9a123b5f58a6b53 # v7 + with: + remove-codeql: true - name: Check just syntax uses: ublue-os/just-action@bda593098a84a84973b002b4377709166a68be52 # v2 @@ -377,6 +383,35 @@ jobs: with: string: ${{ env.IMAGE_REGISTRY }} + - name: Prepare Rechunk + if: inputs.rechunk == 'true' && github.event_name != 'pull_request' + run: | + sudo apt update && sudo apt install systemd-container + sudo podman image scp $(whoami)@localhost::${{ steps.build_image.outputs.image }}:${{ env.DEFAULT_TAG }} root@localhost:: + podman rmi $(podman image ls -qa) --force + + - name: Rechunk Image + id: rechunk + if: inputs.rechunk == 'true' && github.event_name != 'pull_request' + uses: hhd-dev/rechunk@v0.8.6 + with: + rechunk: ghcr.io/hhd-dev/rechunk:v0.8.6 + ref: ${{ steps.build_image.outputs.image }}:${{ env.DEFAULT_TAG }} + skip_compression: 'true' + labels: ${{ steps.meta.outputs.labels }} + prev-ref: ${{ steps.registry_case.outputs.lowercase }}/${{ steps.build_image.outputs.image }}:${{ env.DEFAULT_TAG }} + + # Overwrite the image with the chuncked image + - name: Load Rechunked Image + if: inputs.rechunk == 'true' && github.event_name != 'pull_request' + run: | + sudo podman rmi $(sudo podman image ls -qa) --force + IMAGE=$(podman pull ${{ steps.rechunk.outputs.ref }}) + sudo rm -rf ${{ steps.rechunk.outputs.output }} + for tag in ${{ steps.build_image.outputs.tags }}; do + podman tag $IMAGE ${{ env.IMAGE_NAME }}:${tag} + done + # Push the image to GHCR (Image Registry) - name: Push To GHCR uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2