diff --git a/cfg/jobs/forgejo.run b/cfg/jobs/forgejo.run index 6408343..98ef790 100755 --- a/cfg/jobs/forgejo.run +++ b/cfg/jobs/forgejo.run @@ -50,10 +50,29 @@ incus exec $CNAME -- \ https://codeberg.org/forgejo/forgejo/raw/branch/forgejo/contrib/systemd/forgejo.service #incus file push setup.sh $CNAME/usr/local/bin/ -laminarc run incus_publish \ - CNAME="$CNAME" \ - UPSTREAM=$UPSTREAM_NAME \ - UPSTREAM_VER=$UPSTREAM_VER \ - IMAGE=$IMAGE \ - SERIAL=$SERIAL \ - ALIAS=$ALIAS +# 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 diff --git a/cfg/jobs/mastodon.run b/cfg/jobs/mastodon.run index f9be733..00c5253 100755 --- a/cfg/jobs/mastodon.run +++ b/cfg/jobs/mastodon.run @@ -17,7 +17,7 @@ ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL" cd "$WORKSPACE" incus launch images:$IMAGE "$CNAME" --quiet -wait_network "$CNAME" +wait_network $CNAME # Mastodon incus exec "$CNAME" -- bash -c ' @@ -40,10 +40,32 @@ incus exec "$CNAME" \ --force-noninteractive \ -- bash /tmp/setup_mastodon.sh -laminarc run incus_publish \ - CNAME="$CNAME" \ - UPSTREAM=$UPSTREAM_NAME \ - UPSTREAM_VER=$UPSTREAM_VER \ - IMAGE=$IMAGE \ - SERIAL=$SERIAL \ - ALIAS=$ALIAS +# 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" diff --git a/cfg/scripts/wait_network b/cfg/scripts/wait_network index 36725f8..a31f043 100755 --- a/cfg/scripts/wait_network +++ b/cfg/scripts/wait_network @@ -1,4 +1,5 @@ #!/bin/env bash +# Upstream doc: https://www.navidrome.org/docs/installation/linux/ set -euxo pipefail CNAME="$1"