Regression - Externally-managed ECS task definitions don't work with inheritFrom
See original GitHub issueThere appears to have been a regression from version 1.24 onwards impacting management the deletion of task definitions when externally-managed ECS task definitions are being used. I can confirm that if you use agent { label 'name-of-my-externally-manged-ecs-agent'} it works but it did break a bunch of pipelines that we had configured with the previous agent { ecs { inheritFrom 'name-of-my-externally-manged-ecs-agent' } }. The agent is being executed, the steps in the stage are also executed but the pipeline fails when the agents are being destroyed. There are no issues with using inheritFrom with policies defined in the plugin config and managed by the plugin with and without overwriting properties.
Here is an anonymised stacktrace from the logs of the plugin.
Delete ECS agent task: arn:aws:ecs:us-east-1:aws_account_id:task/task_id
Jan 17, 2020 2:00:09 PM INFO com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution$ECSTaskTemplateCallback finished
Removing task template my-template-name from cloud my-ecs-cloud
Jan 17, 2020 2:00:09 PM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSCloud
Selected Region: us-east-1
Jan 17, 2020 2:00:09 PM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSCloud
Selected Region: us-east-1
Jan 17, 2020 2:00:10 PM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSLauncher
[my-ecs-cloud-testp-115-xlx3c-wcg6z]: Status of ECS Task is PENDING
Jan 17, 2020 2:00:10 PM INFO com.cloudbees.jenkins.plugins.amazonecs.ECSLauncher launch
[my-ecs-cloud-testp-115-xlx3c-wcg6z]: Waiting for agent to start
Jan 17, 2020 2:00:10 PM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSCloud
No existing task definition found for family or ARN: my-ecs-cloud-my-template-name
com.amazonaws.services.ecs.model.ClientException: Unable to describe task definition. (Service: AmazonECS; Status Code: 400; Error Code: ClientException; Request ID: 7b5f77d2-477b-4a27-8d51-edd21747bbdb)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1726)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1381)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1127)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:784)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:752)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:726)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:686)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:668)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:532)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:512)
at com.amazonaws.services.ecs.AmazonECSClient.doInvoke(AmazonECSClient.java:4233)
at com.amazonaws.services.ecs.AmazonECSClient.invoke(AmazonECSClient.java:4200)
at com.amazonaws.services.ecs.AmazonECSClient.invoke(AmazonECSClient.java:4189)
at com.amazonaws.services.ecs.AmazonECSClient.executeDescribeTaskDefinition(AmazonECSClient.java:1632)
at com.amazonaws.services.ecs.AmazonECSClient.describeTaskDefinition(AmazonECSClient.java:1602)
at com.cloudbees.jenkins.plugins.amazonecs.ECSService.findTaskDefinition(ECSService.java:302)
at com.cloudbees.jenkins.plugins.amazonecs.ECSService.removeTemplate(ECSService.java:281)
at com.cloudbees.jenkins.plugins.amazonecs.ECSCloud.removeDynamicTemplate(ECSCloud.java:379)
at com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution$ECSTaskTemplateCallback.finished(ECSTaskTemplateStepExecution.java:196)
at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:118)
at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:377)
at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:166)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:405)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:317)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:281)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Jan 17, 2020 2:00:10 PM INFO com.cloudbees.jenkins.plugins.amazonecs.ECSService findTaskDefinition
No existing task definition found for family or ARN: my-ecs-cloud-my-template-name
Plugin version 1.24 and 1.26 tested. Jenkins ver. 2.204.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)

Top Related StackOverflow Question
Hey, I currently don’t have time to work a lot on the plugin, but I’m glad to merge a PR with tests for that issue and release as fast as possible.
Likely due to this change
https://github.com/jenkinsci/amazon-ecs-plugin/commit/8d74e145039ee985e110b99801f7f122f7f69504
To fix the regression, both getInheritFrom() and getTaskDefinitionOverride() must be done, with appropriate logic handling the possible cases.