Use incus_publish job
This commit is contained in:
parent
f6a0dacf4f
commit
ce00f97cbe
1 changed files with 8 additions and 30 deletions
|
@ -17,7 +17,7 @@ ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL"
|
||||||
cd "$WORKSPACE"
|
cd "$WORKSPACE"
|
||||||
incus launch images:$IMAGE "$CNAME" --quiet
|
incus launch images:$IMAGE "$CNAME" --quiet
|
||||||
|
|
||||||
wait_network $CNAME
|
wait_network "$CNAME"
|
||||||
|
|
||||||
# Mastodon
|
# Mastodon
|
||||||
incus exec "$CNAME" -- bash -c '
|
incus exec "$CNAME" -- bash -c '
|
||||||
|
@ -40,32 +40,10 @@ incus exec "$CNAME" \
|
||||||
--force-noninteractive \
|
--force-noninteractive \
|
||||||
-- bash /tmp/setup_mastodon.sh
|
-- bash /tmp/setup_mastodon.sh
|
||||||
|
|
||||||
# Clean
|
laminarc run incus_publish \
|
||||||
incus exec "$CNAME" -- \
|
CNAME="$CNAME" \
|
||||||
rm -rf \
|
UPSTREAM=$UPSTREAM_NAME \
|
||||||
/etc/machine-id \
|
UPSTREAM_VER=$UPSTREAM_VER \
|
||||||
/var/cache/apt \
|
IMAGE=$IMAGE \
|
||||||
/var/log/journal
|
SERIAL=$SERIAL \
|
||||||
|
ALIAS=$ALIAS
|
||||||
# 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"
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue