jenkinsci / docker-swarm-plugin

Jenkins plugin which allows to add a Docker Swarm as a cloud agent provider
https://plugins.jenkins.io/docker-swarm/
MIT License
55 stars 47 forks source link

Define Docker Swarm Agent Template in Jenkinsfile? #100

Open oarevaloy opened 3 years ago

oarevaloy commented 3 years ago

I would like to define the templates from code, directly in the Jenkinsfile or from yaml.

Just like the podTemplate statement in the Kubernetes plugin: https://github.com/jenkinsci/kubernetes-plugin

jcouton commented 3 years ago

The only way I achieved this is to use the Configuration As Code plugin, which let you use Yaml to configure Jenkins.

I have the feeling that you would like to call different templates based on the job being executed, my workaround for that is to declare multiple templates in the agentTemplates section of the CasC and call the one I need in the Jenkinsfile.

Not the perfect answer by any mean but it might help.

Regards