diff --git a/src/lib-gantry.sh b/src/lib-gantry.sh index a10ecba..e121c80 100755 --- a/src/lib-gantry.sh +++ b/src/lib-gantry.sh @@ -386,6 +386,7 @@ rollback_service() { local ROLLBACK_OPTIONS="${GANTRY_ROLLBACK_OPTIONS:-""}" local SERVICE_NAME="${1}" local DOCKER_CONFIG="${2}" + local ADDITIONAL_OPTION="${3}" if ! is_true "${ROLLBACK_ON_FAILURE}"; then return 0 fi @@ -393,7 +394,7 @@ rollback_service() { local ROLLBACK_MSG= # SC2086: Double quote to prevent globbing and word splitting. # shellcheck disable=SC2086 - ROLLBACK_MSG=$(docker ${DOCKER_CONFIG} service update ${ROLLBACK_OPTIONS} --rollback "${SERVICE_NAME}" 2>&1) + ROLLBACK_MSG=$(docker ${DOCKER_CONFIG} service update ${ADDITIONAL_OPTION} ${ROLLBACK_OPTIONS} --rollback "${SERVICE_NAME}" 2>&1) local RETURN_VALUE=$? if [ ${RETURN_VALUE} -ne 0 ]; then log ERROR "Failed to roll back ${SERVICE_NAME}. ${ROLLBACK_MSG}" @@ -431,7 +432,7 @@ update_single_service() { # shellcheck disable=SC2086 if ! UPDATE_MSG=$(timeout "${UPDATE_TIMEOUT_SECONDS}" docker ${DOCKER_CONFIG} service update ${ADDITIONAL_OPTION} ${UPDATE_OPTIONS} --image="${IMAGE}" "${SERVICE_NAME}" 2>&1); then log ERROR "docker service update failed or timeout. ${UPDATE_MSG}" - rollback_service "${SERVICE_NAME}" "${DOCKER_CONFIG}" + rollback_service "${SERVICE_NAME}" "${DOCKER_CONFIG}" "${ADDITIONAL_OPTION}" add_service_update_failed "${SERVICE_NAME}" return 1 fi