question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Declarative pipeline overriding Fargate definition doesn't work

See original GitHub issue

Overriding attributes from an inherited template works when creating dynamic agents via Declarative pipeline ONLY when the original template uses EC2 as launch mode.

So this WORKS:

agent {
       ecs {
                inheritFrom 'ec2-template'
                cpu 1024
                memory 4096
            }
    }

this DOES NOT WORK:

agent {
       ecs {
                inheritFrom 'fargate-template'
                cpu 1024
                memory 4096
            }
    }

Here are the relevant logs for a task inherited from fargate-template:

Dec 19, 2019 11:28:52 AM INFO com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSDeclarativeAgent getAsArgs
In getAsArgs. label: ecs-agent-test-10-zl3f1
Dec 19, 2019 11:28:52 AM INFO com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSDeclarativeAgent getAsArgs
In getAsArgs. argMap: {assignPublicIp=false, cpu=1024, inheritFrom=fargate-template, label=ecs-agent-test-10-zl3f1, memory=8192, name=ecs-agent-test-10-zl3f1, overrides=[cpu, inheritFrom, memory, label], privileged=false}
Dec 19, 2019 11:28:52 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStep
In ECSTaskTemplateStep start. label: ecs-agent-test-10-zl3f1
Dec 19, 2019 11:28:52 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStep
In ECSTaskTemplateStep start. cloud: cloud-default
Dec 19, 2019 11:28:52 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
In ECSTaskTemplateExecution run()
Dec 19, 2019 11:28:52 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
cloud: cloud-default
Dec 19, 2019 11:28:52 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
label: ecs-agent-test-10-zl3f1
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] ecsTaskTemplate
[Pipeline] // ecsTaskTemplate
[Pipeline] End of Pipeline
ERROR: Cloud does not exist: cloud-default
Finished: FAILURE

And here’s what happens when I run the exact same thing but inheriting from ec2-template:

Dec 19, 2019 11:31:46 AM INFO com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSDeclarativeAgent getAsArgs
In getAsArgs. label: ecs-agent-test-11-krf00
Dec 19, 2019 11:31:46 AM INFO com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSDeclarativeAgent getAsArgs
In getAsArgs. argMap: {assignPublicIp=false, cpu=1024, inheritFrom=ec2-template, label=ecs-agent-test-11-krf00, memory=8192, name=ecs-agent-test-11-krf00, overrides=[cpu, inheritFrom, memory, label], privileged=false}
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStep
In ECSTaskTemplateStep start. label: ecs-agent-test-11-krf00
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStep
In ECSTaskTemplateStep start. cloud: cloud-default
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
In ECSTaskTemplateExecution run()
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
cloud: cloud-default
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
label: ecs-agent-test-11-krf00
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
Cloud maxCpu: 0
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
Cloud maxMemory: 0
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
Cloud maxMemoryReservation: 0
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
Step cpu: 1,024
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
Step memory: 8,192
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
Step memoryReservation: 0
Dec 19, 2019 11:31:46 AM FINE com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution
Step shareMemorySize: 0
Dec 19, 2019 11:31:46 AM INFO com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStepExecution start
Registering task template with name ecs-agent-test-11-krf00-88vps
Dec 19, 2019 11:31:48 AM INFO com.cloudbees.jenkins.plugins.amazonecs.ECSCloud provision
Asked to provision 1 agent(s) for: ecs-agent-test-11-krf00
Dec 19, 2019 11:31:48 AM INFO com.cloudbees.jenkins.plugins.amazonecs.ECSCloud provision
In provisioning : []
Dec 19, 2019 11:31:48 AM INFO com.cloudbees.jenkins.plugins.amazonecs.ECSCloud provision
Excess workload after pending ECS agents: 1
Dec 19, 2019 11:31:48 AM INFO com.cloudbees.jenkins.plugins.amazonecs.ECSCloud provision
Will provision ECS Agent ecs-agent-test-11-krf00, for label: ecs-agent-test-11-krf00
Dec 19, 2019 11:31:58 AM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSLauncher
ECS: Launching agent
Dec 19, 2019 11:31:58 AM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSLauncher
[Dev-cluster-wsvqv]: Creating Task in cluster null
Dec 19, 2019 11:31:58 AM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSCloud
Selected Region: us-east-1
Dec 19, 2019 11:31:58 AM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSCloud
Selected Region: us-east-1
Dec 19, 2019 11:31:58 AM FINE com.cloudbees.jenkins.plugins.amazonecs.ECSCloud
No existing task definition found for family or ARN: Dev-cluster-ecs-agent-test-11-krf00-88vps
[..]
[.. Task succesfully completes at the end. I've truncated output as it's not super relevant anymore ..]

I have thus far:

  • Allowed all overrides in the settings
  • Confirmed that this DOES NOT happen to ANY task that is inheriting from an EC2 launch type templates
  • Confirmed that specifying cloud doesn’t change anything.
  • Confirmed that NOT specifying cloud for an ec2 based template doesn’t break anything (at least on my setup with just a single cloud)
  • Made sure that the templates themselves work, if we don’t involve any overriding.

It feels to me that the issue lies here - https://github.com/jenkinsci/amazon-ecs-plugin/blob/a1c2e74fe8df5729e3410ddffb3407ac35e83d96/src/main/java/com/cloudbees/jenkins/plugins/amazonecs/pipeline/ECSTaskTemplateStepExecution.java#L52 That for some reason the Fargate based templates do not return as provisonable, but I don’t have the environment setup to actually do any development or testing this.

P.S. A similar issue was described in https://github.com/jenkinsci/amazon-ecs-plugin/issues/116, abut then closed without a proper resolution.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:34 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
chb0githubcommented, Apr 16, 2020

Actually… I don’t think a ticket is necessary - but, I am a little surprised. @webratz someone added a @Nonnull to this field and a few others - So, the JSR validation process clearly hasn’t occured. Regardless, it’s an easy fix.

0reactions
FnTmcommented, Apr 23, 2020

Yes, I just tested v1.33, the fix is still there and working. Thanks everyone for getting this shipped!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Amazon ECS tasks for Fargate that are stuck in ...
My Amazon Elastic Container Service (Amazon ECS) task that's running on AWS Fargate is stuck in the PENDING state.
Read more >
jenkinsci/amazon-ecs-plugin - Gitter
We're trying to update the pipelines to just run in ECS, but everything I've tried for the node label says that Jenkins doesn't...
Read more >
Codefresh YAML
The pipeline specification is based on the YAML syntax allowing you to describe your pipelines in a completely declarative manner. Using Codefresh yaml...
Read more >
AWS Step Functions and Fargate task: container runtime error ...
AWS Step Functions does not know if an ECS job has succeeded or failed. Step Functions would need to peek into the ECS...
Read more >
Deploying and Scaling Microservices with Docker and ...
... If the graph doesn't load If you just see a `Page not found` error, ... code in Starlark (dialect of Python) -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found