AWS EC2/ECS and parallel dockerised stages

11 views
Skip to first unread message

Christian Gagneraud

unread,
Apr 7, 2018, 8:41:15 AM4/7/18
to jenkins...@googlegroups.com
Hi there,

From within a pipeline i would like to generate parallel jobs, and i
want all these jobs to run as ECS tasks using different specialised
docker images.
Can I use this syntax to achieve that?
----
stages {
stage ('Parallel builds') {
parallel {
stage ('Build#1') {
agent { docker 'image1' }
...
}
stage ('Build#2') {
agent { docker 'image2' }
...
}
}
}
---

From my experiments, I have the feeling that Jenkins will spawn
dockerised slaves in parallel for each parallel stage (good), but the
docker container will run within the EC2 instance ($DOCKER_HOST), and
thus it won't take advantage of CPU scaling (bad).

Right now, my ECS slave template is configured to use an image which
is just jenkins-jnlp + docker client.

Do I have to create one template per docker image and use "agent {
label '...' }" in place of "agent { docker '...' }"?

This looks weird to me.

Sorry if the question sounds stupid, i'm not that familiar with
Jenkins and Amazon ECS.

Thanks,
Chris
Reply all
Reply to author
Forward
0 new messages