Closed morfien101 closed 2 years ago
@chathsuom I was looking in the old pull requests and seen that you put in the feature for capacity.
I think the issue is that the getter and setter methods are the wrong names. It's never used in the tests so I doubt it would ever have been noticed.
// The Setter
public void setCapacityProviderStrategy(List<CapacityProviderStrategyEntry> capacityProviderStrategies)
// The Getter
public List<CapacityProviderStrategyEntry> getCapacityProviderStrategies()
Specifically the issue of CapacityProviderStrategy
and CapacityProviderStrategies
I can confirm a work around for now is you use the wrong syntax.
import com.cloudbees.jenkins.plugins.amazonecs.ECSTaskTemplate
ecsTaskTemplate(
// Use capacityProviderStrategy rather than capacityProviderStrategies here.
capacityProviderStrategy: [new ECSTaskTemplate.CapacityProviderStrategyEntry('FARGATE_SPOT',0,50), new ECSTaskTemplate.CapacityProviderStrategyEntry('FARGATE',0,1)]
) {
node(labelValue) {
stage('run aws tasks') {
sh 'echo "Hello World"'
}
}
}
Hi @morfien101 Good call out. Feel free to do a PR.
Merged, thanks!
Jenkins and plugins versions report
Environment
Jenkins 2.346.2 Amazon Elastic Container Service (ECS) / Fargate plugin Version1.41 ```text WARNING: Unknown parameter(s) found for class type 'com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStep': capacityProviderStrategies ```What Operating System are you using (both controller, and any agents involved in the problem)?
Ubuntu 22.04
Reproduction steps
When writing a dynamic agent using the example code:
Expected Results
The capacity provider is added to the task
Actual Results
An error is given in the jenkins log: WARNING: Unknown parameter(s) found for class type 'com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStep': capacityProviderStrategies
Anything else?
As a side note, when using the Jenkins Pipeline Syntax page, I get the following error:
no public field ‘capacityProviderStrategy’ (or getter method) found in class com.cloudbees.jenkins.plugins.amazonecs.pipeline.ECSTaskTemplateStep