Skip to content

Commit

Permalink
Merge pull request silinternational#150 from nazo/develop
Browse files Browse the repository at this point in the history
add `run-task` option
  • Loading branch information
fillup authored Jul 25, 2018
2 parents ce48b48 + 953f2b7 commit 71f55ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Usage
--enable-rollback Rollback task definition if new version is not running before TIMEOUT
--force-new-deployment Force a new deployment of the service. Default is false.
--skip-deployments-check Skip deployments check for services that takes to long to drain old tasks
--run-task Run created task now. If you set this, service-name are not needed.
-v | --verbose Verbose output
--version Display the version

Expand Down
13 changes: 13 additions & 0 deletions ecs-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ AWS_CLI=$(which aws)
AWS_ECS="$AWS_CLI --output json ecs"
FORCE_NEW_DEPLOYMENT=false
SKIP_DEPLOYMENTS_CHECK=false
RUN_TASK=false

function usage() {
cat <<EOM
Expand Down Expand Up @@ -54,6 +55,7 @@ Optional arguments:
--enable-rollback Rollback task definition if new version is not running before TIMEOUT
--force-new-deployment Force a new deployment of the service. Default is false.
--skip-deployments-check Skip deployments check for services that takes to long to drain old tasks
--run-task Run created task now. If you set this, service-name are not needed.
-v | --verbose Verbose output
--version Display the version
Expand Down Expand Up @@ -449,6 +451,11 @@ function waitForGreenDeployment {
fi
}

function runTask {
echo "Run task: $NEW_TASKDEF";
$AWS_ECS run-task --cluster $CLUSTER --task-definition $NEW_TASKDEF > /dev/null
}

######################################################
# When not being tested, run application as expected #
######################################################
Expand Down Expand Up @@ -548,6 +555,9 @@ if [ "$BASH_SOURCE" == "$0" ]; then
--skip-deployments-check)
SKIP_DEPLOYMENTS_CHECK=true
;;
--run-task)
RUN_TASK=true
;;
-v|--verbose)
VERBOSE=true
;;
Expand Down Expand Up @@ -598,6 +608,9 @@ if [ "$BASH_SOURCE" == "$0" ]; then

# update service if needed
if [ $SERVICE == false ]; then
if [ $RUN_TASK == true ]; then
runTask
fi
echo "Task definition updated successfully"
else
updateService
Expand Down

0 comments on commit 71f55ee

Please sign in to comment.