Skip to content

Commit 6fa7008

Browse files
committed
hack: allow supplying custom OCI_TAG during persist
1 parent d70b5d9 commit 6fa7008

File tree

5 files changed

+29
-20
lines changed

5 files changed

+29
-20
lines changed

.github/actions/test/integration/build/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ runs:
103103
PASSWORD=$(openssl passwd "password")
104104
echo "PASSWORD=$PASSWORD" >> $GITHUB_ENV
105105
sed -i "s|PASSWORD_GOES_HERE|$PASSWORD|g" ./.github/actions/test/integration/build/dev-user-butane.yaml
106+
sed -i "s|TAG_GOES_HERE|${{ inputs.image_tag }}|g" ./.github/actions/test/integration/build/dev-user-butane.yaml
106107
butane --pretty --strict ./.github/actions/test/integration/build/dev-user-butane.yaml > "/opt/${TAG}.ign"
107108
108109
- name: Download ubuntu cloud image

.github/actions/test/integration/build/dev-user-butane.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ storage:
5050
contents:
5151
inline: |
5252
NON_HUGEPAGES_PM=1000
53-
# pull the image from GHCR instead of keppel
5453
- path: /opt/persist/gl-oci.conf
5554
mode: 0644
5655
contents:
5756
inline: |
57+
# pull the image from GHCR instead of keppel
5858
OCI_REPO=ghcr.io/gardenlinux/gardenlinux-ccloud
59+
# point to a custom tag to download for the persist step
60+
OCI_TAG=TAG_GOES_HERE
5961
# Enable unlimited core dumps for all systemd services
6062
- path: /etc/systemd/system.conf.d/10-core.conf
6163
mode: 0644

.github/workflows/dev.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ jobs:
2121
with:
2222
submodules: recursive
2323

24-
- name: use VERSION file to support dev build on rel-branch
24+
- name: Derive version
2525
id: version
26-
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
26+
run: |
27+
if [ "${{ github.event_name }}" = "pull_request" ]; then
28+
# could also use another valid output instead of MAJOR.MINOR.PATCH
29+
# https://github.com/gardenlinux/gardenlinux/blob/d6f26762652a6c3f5b9e79dedeadcc4a61b0a7db/bin/garden-version#L146-L152
30+
# would also make deletion "easy" since the format for PR images is fixed and unique
31+
# we pull by the additional tag, bootstrap happens via the version inside the image
32+
echo "VERSION=today" >> $GITHUB_OUTPUT
33+
else
34+
echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
35+
fi
2736
2837
build:
2938
needs: [set_version]
@@ -67,7 +76,6 @@ jobs:
6776
version: ${{ needs.set_version.outputs.VERSION }}
6877
upload_version: ${{ needs.meta.outputs.UPLOAD_VERSION }}
6978
flavor_filter: '--include-only "metal-sci_usi-amd64"'
70-
additional_semver_tag: false
7179
secrets: inherit
7280

7381
test:
@@ -76,4 +84,8 @@ jobs:
7684
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'closed' }}
7785
uses: ./.github/workflows/test.yml
7886
with:
79-
image_tag: "pr-${{ github.event.pull_request.number }}-metal-sci_usi-amd64-${{ needs.set_version.outputs.VERSION }}-${{ needs.meta.outputs.COMMIT_SHA }}-amd64"
87+
image_tag: "${{ needs.meta.outputs.UPLOAD_VERSION }}-metal-sci-usi-amd64-${{ needs.meta.outputs.COMMIT_SHA }}-amd64"
88+
89+
# TODO on PR close, clean up everything in form of
90+
# oras repo tags ghcr.io/gardenlinux/gardenlinux-ccloud | grep -v -E '^[0-9]{4}\.[0-9]+.*$'
91+
# oras repo tags ghcr.io/gardenlinux/gardenlinux-ccloud | grep -E '^PREFIX$'

.github/workflows/upload_oci.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
upload_version:
99
type: string
1010
default: ""
11-
additional_semver_tag:
12-
type: boolean
13-
default: true
1411
flavor_filter:
1512
type: string
1613
default: '--exclude "bare-*"'
@@ -71,19 +68,17 @@ jobs:
7168
--dir "${CNAME}" \
7269
--container "ghcr.io/${{ github.repository }}" \
7370
--arch ${{ matrix.arch }} \
74-
--version ${{ inputs.upload_version || inputs.version }} \
71+
--version ${{ inputs.version }} \
7572
--cname "${CNAME}" \
7673
--cosign_file digest.txt \
7774
--manifest_file "oci_manifest_entry_${CNAME}.json"
7875
- name: Add additional semver tag
79-
if: ${{ inputs.additional_semver_tag }}
8076
run: |
8177
echo ${{ secrets.GITHUB_TOKEN }} | oras login -u ${{ github.repository_owner }} --password-stdin ghcr.io
82-
UPLOAD_VER="${{ inputs.upload_version || inputs.version }}"
8378
CNAME2=${CNAME//_/-}
8479
CNAME2=${CNAME2//-${{ inputs.version }}/}
85-
echo "Adding additional tag: ${UPLOAD_VER}-${CNAME2}-${{ matrix.arch }}"
86-
oras tag ghcr.io/${{ github.repository }}:${UPLOAD_VER}-${CNAME}-${{ matrix.arch }} ${UPLOAD_VER}-${CNAME2}-${{ matrix.arch }}
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 }}
8782
- uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # [email protected]
8883
with:
8984
path: oci_manifest_entry_${{ env.CNAME }}.json

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,19 @@ if [ ! -f "$OS_RELEASE_FILE" ]; then
6262
echo "File not found '$OS_RELEASE_FILE', exiting"
6363
exit 1
6464
fi
65-
66-
# source optional config file
67-
[ -f /sysroot/opt/persist/gl-oci.conf ] && . /sysroot/opt/persist/gl-oci.conf
68-
OCI_REPO="${OCI_REPO:-keppel.global.cloud.sap/ccloud-ghcr-io-mirror/gardenlinux/gardenlinux-ccloud}"
69-
OCI_ARCH="${OCI_ARCH:-amd64}"
70-
7165
# source os-release file
7266
. "$OS_RELEASE_FILE"
7367

7468
# oras needs a proper HOME variable
7569
export HOME=/root
7670

71+
# source optional config file
72+
[ -f /sysroot/opt/persist/gl-oci.conf ] && . /sysroot/opt/persist/gl-oci.conf
73+
OCI_REPO="${OCI_REPO:-keppel.global.cloud.sap/ccloud-ghcr-io-mirror/gardenlinux/gardenlinux-ccloud}"
74+
OCI_ARCH="${OCI_ARCH:-amd64}"
75+
7776
# setup OCI_TAG, UKI_SHA and fetch UKI
78-
OCI_TAG="$GARDENLINUX_VERSION-$VARIANT_ID-$GARDENLINUX_COMMIT_ID-$OCI_ARCH"
77+
OCI_TAG=${OCI_TAG:-"$GARDENLINUX_VERSION-$VARIANT_ID-$GARDENLINUX_COMMIT_ID-$OCI_ARCH"}
7978
OCI_TAG=${OCI_TAG//_/-} # replace underscores with dashes
8079
UKI_SHA=$(oras manifest fetch "$OCI_REPO:${OCI_TAG}" | jq -r '.layers[] | select(.mediaType=="application/io.gardenlinux.uki") | .digest')
8180
oras blob fetch "$OCI_REPO@$UKI_SHA" -o "$esp_dir/EFI/Linux/uki.efi"

0 commit comments

Comments
 (0)