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

Be able to add label to created service #112

Closed Drimix20 closed 1 year ago

Drimix20 commented 2 years ago

We are using docker-swarm-plugin as provider for slave. Unfortunately we are facing connectivity problems in swarm and it happens that there remains running containers or dead services (without replicas) when jenkins job is killed or connection is reset. Because of that we would like to be able to define label (e.g. marker how long service shoul live, TTL=24H, TTL=48H etc) in a docker agent template configuration. Based on that labels we will be able to clean up running services without affecting correctly startup services.

Configuration: obrazek

Result service: [ { "ID": "sm1eitmz1ypuorjo43c8hesz0", "Version": { "Index": 67228061 }, "CreatedAt": "2021-09-27T16:46:22.040470091Z", "UpdatedAt": "2021-09-27T16:46:22.096417534Z", "Spec": { "Name": "agt-test_drimalm-4", "Labels": { "ROLE": "jenkins-agent", "TTL": "48H", "TEAM": "TeamA" },