Skip to content

Commit

Permalink
Merge pull request silinternational#103 from silinternational/develop
Browse files Browse the repository at this point in the history
add flag to enable rollback, default value is disabled
  • Loading branch information
fillup authored May 1, 2017
2 parents 5effc54 + ff65526 commit 4a7142e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Usage
Note: This number must be 1 or higher (i.e. keep only the current revision ACTIVE).
Max definitions causes all task revisions not matching criteria to be deregistered, even if they're created manually.
Script will only perform deregistration if deployment succeeds.
--enable-rollback Rollback task definition if new version is not running before TIMEOUT
-v | --verbose Verbose output

Examples:
Expand Down
9 changes: 8 additions & 1 deletion ecs-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TIMEOUT=90
VERBOSE=false
TAGVAR=false
TAGONLY=""
ENABLE_ROLLBACK=false
AWS_CLI=$(which aws)
AWS_ECS="$AWS_CLI --output json ecs"

Expand Down Expand Up @@ -45,6 +46,7 @@ Optional arguments:
-e | --tag-env-var Get image tag name from environment variable. If provided this will override value specified in image name argument.
-to | --tag-only New tag to apply to all images defined in the task (multi-container task). If provided this will override value specified in image name argument.
--max-definitions Number of Task Definition Revisions to persist before deregistering oldest revisions.
--enable-rollback Rollback task definition if new version is not running before TIMEOUT
-v | --verbose Verbose output
Requirements:
Expand Down Expand Up @@ -363,7 +365,9 @@ function updateService() {
if [[ "${UPDATE_SERVICE_SUCCESS}" != "true" ]]; then
# Timeout
echo "ERROR: New task definition not running within $TIMEOUT seconds"
rollback
if [[ "${ENABLE_ROLLBACK}" != "false" ]]; then
rollback
fi
exit 1
fi
else
Expand Down Expand Up @@ -485,6 +489,9 @@ if [ "$BASH_SOURCE" == "$0" ]; then
MAX_DEFINITIONS="$2"
shift
;;
--enable-rollback)
ENABLE_ROLLBACK=true
;;
-v|--verbose)
VERBOSE=true
;;
Expand Down

0 comments on commit 4a7142e

Please sign in to comment.