@ -117,7 +117,7 @@ jobs:
env:
env:
ad_hoc_task_definition : ${{ inputs.aws_resource_prefix }}-ad-hoc
ad_hoc_task_definition : ${{ inputs.aws_resource_prefix }}-ad-hoc
cluster : ${{ inputs.aws_resource_prefix }}
cluster : ${{ inputs.aws_resource_prefix }}
service : ${{ inputs.aws_resource_prefix }}
service : ${{ inputs.aws_resource_prefix }}-app
run : |
run : |
network=$(aws ecs describe-services --cluster $cluster --services $service --query services[0].networkConfiguration)
network=$(aws ecs describe-services --cluster $cluster --services $service --query services[0].networkConfiguration)
overrides='{ "containerOverrides" : [{ "name" : "app", "command" : ["bundle", "exec", "rake", "db:migrate"]}]}'
overrides='{ "containerOverrides" : [{ "name" : "app", "command" : ["bundle", "exec", "rake", "db:migrate"]}]}'
@ -129,13 +129,13 @@ jobs:
succeeded=$(aws ecs describe-tasks --cluster $cluster --tasks $id --query "tasks[0].stopCode == 'EssentialContainerExited' && to_string(tasks[0].containers[0].exitCode) == '0'")
succeeded=$(aws ecs describe-tasks --cluster $cluster --tasks $id --query "tasks[0].stopCode == 'EssentialContainerExited' && to_string(tasks[0].containers[0].exitCode) == '0'")
if [ $succeeded == true ]; then exit 0; else exit 1; fi
if [ $succeeded == true ]; then exit 0; else exit 1; fi
- name : Download service task definition
- name : Download app service task definition
env:
env:
app_task_definition : ${{ inputs.aws_resource_prefix }}-app
app_task_definition : ${{ inputs.aws_resource_prefix }}-app
run : |
run : |
aws ecs describe-task-definition --task-definition $app_task_definition --query taskDefinition > app-task-definition.json
aws ecs describe-task-definition --task-definition $app_task_definition --query taskDefinition > app-task-definition.json
- name : Update image ID
- name : Update app image ID
id : app-task-def
id : app-task-def
uses : aws-actions/amazon-ecs-render-task-definition@v1
uses : aws-actions/amazon-ecs-render-task-definition@v1
with:
with:
@ -147,6 +147,28 @@ jobs:
uses : aws-actions/amazon-ecs-deploy-task-definition@v1
uses : aws-actions/amazon-ecs-deploy-task-definition@v1
with:
with:
cluster : ${{ inputs.aws_resource_prefix }}
cluster : ${{ inputs.aws_resource_prefix }}
service : ${{ inputs.aws_resource_prefix }}
service : ${{ inputs.aws_resource_prefix }}-app
task-definition : ${{ steps.app-task-def.outputs.task-definition }}
task-definition : ${{ steps.app-task-def.outputs.task-definition }}
wait-for-service-stability : true
wait-for-service-stability : true
- name : Download sidekiq service task definition
env:
sidekiq_task_definition : ${{ inputs.aws_resource_prefix }}-sidekiq
run : |
aws ecs describe-task-definition --task-definition $sidekiq_task_definition --query taskDefinition > sidekiq-task-definition.json
- name : Update sidekiq image ID
id : sidekiq-task-def
uses : aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition : sidekiq-task-definition.json
container-name : sidekiq
image : ${{ env.image }}
- name : Deploy updated sidekiq
uses : aws-actions/amazon-ecs-deploy-task-definition@v1
with:
cluster : ${{ inputs.aws_resource_prefix }}
service : ${{ inputs.aws_resource_prefix }}-sidekiq
task-definition : ${{ steps.sidekiq-task-def.outputs.task-definition }}
wait-for-service-stability : true