Search code examples
jenkinsjenkins-apijenkins-docker

Jenkins script to update job config: restricted agent and using docker container


I'm using a Jenkins script to update several jobs. I'm able to update the description, SCM credentials, and so on.

But I can't find how to :

  • a) unset the option to restrict the agent (restrict where this project can be run)
  • b) set the option "Docker container" (DockerJobProperty)

Jenkins version: 1.609.3

Thanks in advance for any help.

Regards, Sébastien


Solution

  • If it can help someone else here is the answers.

    a) item.assignedLabel = null

    b) item.addProperty(new com.nirima.jenkins.plugins.docker.DockerJobProperty(false, "", false, true))

    Regards