From 887f614e204287fe215fe7ba94e8f9adbc2496c4 Mon Sep 17 00:00:00 2001 From: Benoit Date: Thu, 14 Nov 2024 21:34:38 +0900 Subject: [PATCH] Forgejo: Use incus_publish job --- cfg/jobs/forgejo.run | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/cfg/jobs/forgejo.run b/cfg/jobs/forgejo.run index 98ef790..6408343 100755 --- a/cfg/jobs/forgejo.run +++ b/cfg/jobs/forgejo.run @@ -50,29 +50,10 @@ incus exec $CNAME -- \ https://codeberg.org/forgejo/forgejo/raw/branch/forgejo/contrib/systemd/forgejo.service #incus file push setup.sh $CNAME/usr/local/bin/ -# Clean -incus exec $CNAME -- \ - rm -rf \ - /etc/machine-id \ - /var/cache/apt \ - /var/log/journal - -# Publish -incus stop $CNAME -incus config metadata show $CNAME > $ARCHIVE/metadata.yaml -# Get the current Unix timestamp -current_timestamp=$(date +%s) -# Calculate expiry date as current timestamp + 1 week (604800 seconds) -expiry_date=$(($current_timestamp + 604800)) -# Update metadata values -sed -i \ - -e "s/creation_date: .*/creation_date: $current_timestamp/" \ - -e "s/expiry_date: .*/expiry_date: $expiry_date/" \ - -e "s#description: .*#description: $UPSTREAM_NAME v$UPSTREAM_VER on $IMAGE release $SERIAL#" \ - -e "s/name: .*/name: $CNAME/" \ - -e "s/serial: .*/serial: $SERIAL/" \ - $ARCHIVE/metadata.yaml - -incus config metadata edit $CNAME < $ARCHIVE/metadata.yaml -incus publish $CNAME --alias $ALIAS --public --quiet -incus rm $CNAME +laminarc run incus_publish \ + CNAME="$CNAME" \ + UPSTREAM=$UPSTREAM_NAME \ + UPSTREAM_VER=$UPSTREAM_VER \ + IMAGE=$IMAGE \ + SERIAL=$SERIAL \ + ALIAS=$ALIAS