amazon-ecs-deploy-task-definition icon indicating copy to clipboard operation
amazon-ecs-deploy-task-definition copied to clipboard

Null service results in silent failure

Open socketbox opened this issue 2 years ago • 0 comments

Excerpt:

        name: Deploy Amazon ECS task definition
        uses: aws-actions/amazon-ecs-deploy-task-definition@v1
        with:
          task-definition: ${{ steps.pbsorg-task-def.outputs.task-definition }}
          service: ${{ env.service_name }}
          cluster: ${{ env.cluster_name }}
          wait-for-service-stability: true

With an incorrect service name, the step that includes this action does not fail, even though the relevant service is not updated.

In this particular case, the service name ends up evaluating to null because there is no environment variable service_name (if the service name is not null but simply incorrect, then an error is produced and failure results).

As the logs below show, because the service value evaluates to null, the action is called without any service name argument whatsoever. And so the service goes un-updated, but no failure is indicated.

##[debug]..Evaluating String:
##[debug]..=> 'task-definition'
##[debug]=> '/home/runner/work/_temp/task-definition--2436-LsXDAQty8uw7-.json'
##[debug]Result: '/home/runner/work/_temp/task-definition--2436-LsXDAQty8uw7-.json'
##[debug]Evaluating: env.service_name
##[debug]Evaluating Index:
##[debug]..Evaluating env:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'service_name'
##[debug]=> null
##[debug]Result: null
##[debug]Evaluating: env.cluster_name
##[debug]Evaluating Index:
##[debug]..Evaluating env:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'cluster_name'
##[debug]=> 'QA'
##[debug]Result: 'QA'
##[debug]Loading env
Run aws-actions/amazon-ecs-deploy-task-definition@v1
  with:
    task-definition: /home/runner/work/_temp/task-definition--[24](https://github.com/pbs/pbsorg/actions/runs/4566453356/jobs/8059145939#step:13:24)[36](https://github.com/pbs/pbsorg/actions/runs/4566453356/jobs/8059145939#step:13:36)-LsXDAQty8uw7-.json
    cluster: QA
    wait-for-service-stability: true
...
##[debug]Registering the task definition
...
##[debug]Service was not specified, no service updated
##[debug]Node Action run completed with exit code 0
##[debug]Set output task-definition-arn = arn:aws:ecs:***:***:task-definition/pbsorg-staging-web:[71](https://github.com/pbs/pbsorg/actions/runs/4566453356/jobs/8059145939#step:13:72)4
##[debug]Finishing: Deploy Amazon ECS task definition

socketbox avatar Mar 30 '23 16:03 socketbox