Reputation: 922
I would like to use the Amazon ECS plugin with Fargate to create Jenkins build agents. I've tried a number of things in the pipeline to get this to work but I cannot find the right configuration.
Any assistance is appreciated!
My current setup contains:
Amazon EC2 Container Service cloud:
Name: aws-cloud
Amazon ECS Credentials: (none, host has an IAM role that should be sufficient, this Jenkins is
already managing static agents on Fargate)
AWS Region: us-east-1
ECS Cluster ID (arn:xxxxx:::cluster/jenkins-slave
ECS slave Templates:
Label: docker
Docker Image: jenkinsci/jnlp-slave
Filesystem root: /home/jenkins
Memory: 2048
CPU units 1024
Jenkinsfile:
pipeline {
agent none
stages {
stage('Test') {
agent {
ecs {
cloud 'aws-claims'
launchType 'FARGATE'
memory 2048
cpu 1024
assignPublicIp false
inheritFrom 'docker'
label 'sbt'
}
}
steps {
sh 'env'
}
}
}
}
I have tried many different variations in my pipeline to configure this but most give me a similar error.
ERROR: Unable to determine cloud configuration using: Labels: [sbt], inheritFrom: 'docker', Cloud: 'aws-cloud'
Upvotes: 2
Views: 2263
Reputation: 11
You have to configure list of settings to be allowed in the declarative pipeline first (see the Allowed Overrides setting). They are disabled by default for security reasons.
Also since you are using inheritFrom, I think you don't require to use label there you can directly mention the same in 'inheritFrom'
e.g
agent {
ecs {
inheritFrom '<your label name>'
Upvotes: 1
Reputation: 922
The initial problem was that I had the "Amazon EC2 Container Service with autoscaling capabilities" plugin installed as well as "Amazon Elastic Container Service (ECS) / Fargate". Removing the Container service plugin resolved my issue.
Upvotes: 0