diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index b89e60c5..6dc97a4b 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -83,7 +83,7 @@ jobs: if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'closed' }} uses: ./.github/workflows/test.yml with: - image_tag: "${{ needs.meta.outputs.UPLOAD_VERSION }}-metal-sci-usi-amd64-${{ needs.meta.outputs.COMMIT_SHA }}-amd64" + image_tag: "${{ needs.meta.outputs.UPLOAD_VERSION }}-metal-sci-usi-amd64-${{ needs.meta.outputs.UPLOAD_VERSION }}-${{ needs.meta.outputs.COMMIT_SHA }}" cleanup_images: name: Cleanup PR images diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c6cb3b4d..ea9abc1f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: id: fetch_tag if: ${{ inputs.image_tag == '' || github.event_name == 'workflow_run' || github.event_name == 'push' }} run: | - latest_tag=$(oras repo tags ghcr.io/gardenlinux/gardenlinux-ccloud | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-metal-sci-usi-amd64-[0-9a-f]{8}-amd64$' | sort -r | head -n 1) + latest_tag=$(oras repo tags ghcr.io/gardenlinux/gardenlinux-ccloud | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-metal-sci-usi-amd64-[0-9]+-[0-9]+-[0-9]-[0-9a-f]{8}$' | sort -r | head -n 1) echo $latest_tag echo "latest_tag=$latest_tag" >> $GITHUB_ENV - name: Build diff --git a/.github/workflows/upload_oci.yml b/.github/workflows/upload_oci.yml index 423e5736..896e2495 100644 --- a/.github/workflows/upload_oci.yml +++ b/.github/workflows/upload_oci.yml @@ -75,10 +75,19 @@ jobs: - name: Add additional semver tag run: | echo ${{ secrets.GITHUB_TOKEN }} | oras login -u ${{ github.repository_owner }} --password-stdin ghcr.io + COMMIT_SHA_SHORT=$(git rev-parse HEAD | cut -c1-8) + # Keep CNAME reference CNAME2=${CNAME//_/-} + # Remove version from CNAME CNAME2=${CNAME2//-${{ inputs.version }}/} - echo "Adding additional tag: ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${{ matrix.arch }}" - oras tag ghcr.io/${{ github.repository }}:${{ inputs.version }}-${CNAME}-${{ matrix.arch }} ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${{ matrix.arch }} + # Remove commit sha from CNAME + CNAME2=${CNAME2//-${COMMIT_SHA_SHORT}/} + # 8 charachter commit hash + DASHED_VERSION=${{ inputs.upload_version || inputs.version }} + DASHED_VERSION=${DASHED_VERSION//./-} + + echo "Adding additional tag: ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT}" + oras tag ghcr.io/${{ github.repository }}:${{ inputs.version }}-${CNAME}-${{ matrix.arch }} ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT} - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # pin@v4.2.3 with: path: oci_manifest_entry_${{ env.CNAME }}.json diff --git a/features/_usi/initrd.include/usr/bin/persist b/features/_usi/initrd.include/usr/bin/persist index 280ce539..ad950446 100755 --- a/features/_usi/initrd.include/usr/bin/persist +++ b/features/_usi/initrd.include/usr/bin/persist @@ -71,10 +71,10 @@ export HOME=/root # source optional config file [ -f /sysroot/opt/persist/gl-oci.conf ] && . /sysroot/opt/persist/gl-oci.conf OCI_REPO="${OCI_REPO:-keppel.global.cloud.sap/ccloud-ghcr-io-mirror/gardenlinux/gardenlinux-ccloud}" -OCI_ARCH="${OCI_ARCH:-amd64}" +DASHED_GARDENLINUX_VERSION=${GARDENLINUX_VERSION//./-} # setup OCI_TAG, UKI_SHA and fetch UKI -OCI_TAG=${OCI_TAG:-"$GARDENLINUX_VERSION-$VARIANT_ID-$GARDENLINUX_COMMIT_ID-$OCI_ARCH"} +OCI_TAG=${OCI_TAG:-"$GARDENLINUX_VERSION-$VARIANT_ID-${DASHED_GARDENLINUX_VERSION}-$GARDENLINUX_COMMIT_ID"} OCI_TAG=${OCI_TAG//_/-} # replace underscores with dashes UKI_SHA=$(oras manifest fetch "$OCI_REPO:${OCI_TAG}" | jq -r '.layers[] | select(.mediaType=="application/io.gardenlinux.uki") | .digest') oras blob fetch "$OCI_REPO@$UKI_SHA" -o "$esp_dir/EFI/Linux/uki.efi"