From 8147fcaf908ba09a9d0565a4aae95e79bce4b72e Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 23 Mar 2025 20:57:42 -0400 Subject: [PATCH] Improve image pulling and docker-compose update in auto-update script --- ansible/templates/update-forgejo.sh.j2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ansible/templates/update-forgejo.sh.j2 b/ansible/templates/update-forgejo.sh.j2 index 52df1ae..36d7144 100644 --- a/ansible/templates/update-forgejo.sh.j2 +++ b/ansible/templates/update-forgejo.sh.j2 @@ -78,6 +78,7 @@ get_current_version() { # Update Forgejo to the latest version update_forgejo() { local latest_version=$1 + local image_name="codeberg.org/forgejo/forgejo" log "Starting Forgejo update process..." @@ -92,11 +93,11 @@ update_forgejo() { # Pull the latest image log "Pulling the latest Forgejo image..." - docker pull "codeberg.org/forgejo/forgejo:$latest_version" + docker pull "$image_name:$latest_version" # Update the docker-compose file with the new version log "Updating docker-compose.yml with the new version..." - sed -i "s/codeberg.org\/forgejo\/forgejo:[0-9.]*\+*/codeberg.org\/forgejo\/forgejo:$latest_version/g" "$COMPOSE_FILE" + sed -i "s|codeberg.org/forgejo/forgejo:[0-9.]*\+*|$image_name:$latest_version|g" "$COMPOSE_FILE" # Restart Forgejo with the new version log "Restarting Forgejo with the new version..."