Skip to content

Commit 4a12b90

Browse files
authored
Merge pull request #151 from gardenlinux/versioning-for-in-place
versioning: reorder to allow in-place updates
2 parents 8223575 + bed25a7 commit 4a12b90

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'closed' }}
8484
uses: ./.github/workflows/test.yml
8585
with:
86-
image_tag: "${{ needs.meta.outputs.UPLOAD_VERSION }}-metal-sci-usi-amd64-${{ needs.meta.outputs.COMMIT_SHA }}-amd64"
86+
image_tag: "${{ needs.meta.outputs.UPLOAD_VERSION }}-metal-sci-usi-amd64-${{ needs.meta.outputs.UPLOAD_VERSION }}-${{ needs.meta.outputs.COMMIT_SHA }}"
8787

8888
cleanup_images:
8989
name: Cleanup PR images

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
id: fetch_tag
3434
if: ${{ inputs.image_tag == '' || github.event_name == 'workflow_run' || github.event_name == 'push' }}
3535
run: |
36-
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)
36+
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)
3737
echo $latest_tag
3838
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
3939
- name: Build

.github/workflows/upload_oci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,19 @@ jobs:
7575
- name: Add additional semver tag
7676
run: |
7777
echo ${{ secrets.GITHUB_TOKEN }} | oras login -u ${{ github.repository_owner }} --password-stdin ghcr.io
78+
COMMIT_SHA_SHORT=$(git rev-parse HEAD | cut -c1-8)
79+
# Keep CNAME reference
7880
CNAME2=${CNAME//_/-}
81+
# Remove version from CNAME
7982
CNAME2=${CNAME2//-${{ inputs.version }}/}
80-
echo "Adding additional tag: ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${{ matrix.arch }}"
81-
oras tag ghcr.io/${{ github.repository }}:${{ inputs.version }}-${CNAME}-${{ matrix.arch }} ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${{ matrix.arch }}
83+
# Remove commit sha from CNAME
84+
CNAME2=${CNAME2//-${COMMIT_SHA_SHORT}/}
85+
# 8 charachter commit hash
86+
DASHED_VERSION=${{ inputs.upload_version || inputs.version }}
87+
DASHED_VERSION=${DASHED_VERSION//./-}
88+
89+
echo "Adding additional tag: ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT}"
90+
oras tag ghcr.io/${{ github.repository }}:${{ inputs.version }}-${CNAME}-${{ matrix.arch }} ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT}
8291
- uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # [email protected]
8392
with:
8493
path: oci_manifest_entry_${{ env.CNAME }}.json

features/_usi/initrd.include/usr/bin/persist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ export HOME=/root
7171
# source optional config file
7272
[ -f /sysroot/opt/persist/gl-oci.conf ] && . /sysroot/opt/persist/gl-oci.conf
7373
OCI_REPO="${OCI_REPO:-keppel.global.cloud.sap/ccloud-ghcr-io-mirror/gardenlinux/gardenlinux-ccloud}"
74-
OCI_ARCH="${OCI_ARCH:-amd64}"
7574

75+
DASHED_GARDENLINUX_VERSION=${GARDENLINUX_VERSION//./-}
7676
# setup OCI_TAG, UKI_SHA and fetch UKI
77-
OCI_TAG=${OCI_TAG:-"$GARDENLINUX_VERSION-$VARIANT_ID-$GARDENLINUX_COMMIT_ID-$OCI_ARCH"}
77+
OCI_TAG=${OCI_TAG:-"$GARDENLINUX_VERSION-$VARIANT_ID-${DASHED_GARDENLINUX_VERSION}-$GARDENLINUX_COMMIT_ID"}
7878
OCI_TAG=${OCI_TAG//_/-} # replace underscores with dashes
7979
UKI_SHA=$(oras manifest fetch "$OCI_REPO:${OCI_TAG}" | jq -r '.layers[] | select(.mediaType=="application/io.gardenlinux.uki") | .digest')
8080
oras blob fetch "$OCI_REPO@$UKI_SHA" -o "$esp_dir/EFI/Linux/uki.efi"

0 commit comments

Comments
 (0)