1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-18 14:58:21 +02:00

bin/upgrade: issue warning on custom image (#314)

* `bin/upgrade`: issue warning on custom image (#314)

* prevent version to be added twice to GIT_BRIDGE_IMAGE


---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
This commit is contained in:
Miguel Serrano 2024-11-19 12:52:53 +01:00 committed by GitHub
parent 1a4d138ade
commit 5937a49abd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 2024-11-18
### Added
- When a custom `GIT_BRIDGE_IMAGE` is set, `bin/upgrade` no longer tries to pull the new version, and prompts
the user to update and tag the custom image separately.
## 2024-10-29
### Added
- Pull new images from `bin/upgrade` ahead of stopping containers

View file

@ -160,6 +160,16 @@ function handle_image_upgrade() {
set_server_pro_image_name "$SEED_IMAGE_VERSION"
docker pull "$IMAGE"
if [[ $GIT_BRIDGE_ENABLED == "true" ]]; then
if [[ -n ${GIT_BRIDGE_IMAGE:-} ]]; then
echo "------------------- WARNING ----------------------"
echo " You're using the custom git bridge image $GIT_BRIDGE_IMAGE"
echo " Before continuing you need to tag the updated image separately, making sure that:"
echo " 1. The Docker image is tagged with the new version: $SEED_IMAGE_VERSION"
echo " 2. The config/overleaf.rc entry GIT_BRIDGE_IMAGE only contains the image name, and not a tag/version."
echo " You wont be able to continue with this upgrade until you've tagged your custom image with $SEED_IMAGE_VERSION"
echo "------------------- WARNING ----------------------"
prompt "Has the custom image been tagged?"
fi
set_git_bridge_image_name "$SEED_IMAGE_VERSION"
docker pull "$GIT_BRIDGE_IMAGE"
fi

View file

@ -96,7 +96,15 @@ function set_git_bridge_image_name() {
else
image_name="quay.io/sharelatex/git-bridge"
fi
export GIT_BRIDGE_IMAGE="$image_name:$version"
# since we're reusing the GIT_BRIDGE_IMAGE environment variable, we check here if the version
# has already been added to it, for scenarios where this function is called more than once
if [[ "$image_name" == *"$version" ]]; then
export GIT_BRIDGE_IMAGE="$image_name"
else
export GIT_BRIDGE_IMAGE="$image_name:$version"
fi
}
function check_retracted_version() {