Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
container upgradeVersion (CO-2739)
skoranda committed Jan 8, 2024
1 parent 9c47ccb commit 1fe0206
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions container/match/base/comanage_utils.sh
@@ -87,6 +87,7 @@ function comanage_utils::consume_injected_environment() {
COMANAGE_MATCH_SECURITY_SALT
COMANAGE_MATCH_PHP_SESSION_REDIS_URL
COMANAGE_MATCH_SKIP_SETUP
COMANAGE_MATCH_SKIP_UPGRADE
COMANAGE_MATCH_SLASH_ROOT_DIRECTORY
COMANAGE_MATCH_VIRTUAL_HOST_FQDN
COMANAGE_MATCH_VIRTUAL_HOST_REDIRECT_HTTP_NO
@@ -734,6 +735,56 @@ function comanage_utils::match_setup() {
fi
}

##########################################
# Run COmanage Match upgradeVersion shell command
# Globals:
# COMANAGE_MATCH_DATABASE_SCHEMA_FORCE
# COMANAGE_MATCH_DATABASE_SKIP_UPGRADE
# COMANAGE_MATCH_DIR
# OUTPUT
# Arguments:
# None
# Returns:
# None
##########################################
function comanage_utils::match_upgrade() {

if [[ -n "${COMANAGE_MATCH_SKIP_UPGRADE}" ]]; then
echo "Skipping upgrade step" > "$OUTPUT" 2>&1
return 0
fi

# We always run upgradeVersion since it will not make any changes
# if the current and target versions are the same or if
# an upgrade from the current to the target version is not allowed.

# First clear the caches.
comanage_utils::match_clear_cache

pushd "$COMANAGE_MATCH_DIR/app" > "$OUTPUT" 2>&1
echo "Running ./bin/cake upgradeVersion..." > "$OUTPUT"
./bin/cake upgradeVersion > "$OUTPUT" 2>&1
echo "Done running ./bin/cake upgradeVersion" > "$OUTPUT"
echo "You may ignore errors reported above if the Current and Target versions are the same" > "$OUTPUT"
popd > "$OUTPUT" 2>&1

# Force a datbase update if requested. This is helpful when deploying
# a new version of the code that does not result in a change in the
# version number and so upgradeVersion does not fire. An example
# of this scenario is when new code is introduced in the develop
# branch but before a release happens.
if [ -n "$COMANAGE_MATCH_DATABASE_SCHEMA_FORCE" ]; then
echo "Forcing a database schema update..." > "$OUTPUT"
pushd "$COMANAGE_MATCH_DIR/app" > "$OUTPUT" 2>&1
./bin/cake database > "$OUTPUT" 2>&1
echo "Done forcing database schema update" > "$OUTPUT"
popd > "$OUTPUT" 2>&1
fi

# Clear the caches again.
comanage_utils::match_clear_cache
}

##########################################
# Set tmp directory file ownership
# Globals:

0 comments on commit 1fe0206

Please sign in to comment.