Search code examples
jenkinsgroovyjenkins-job-dsl

Jenkins DSL API for copyartifact permissions


I am trying to add a call to my jenkins job dsl that will configure the job to give permission to another build to copy artifacts. However, I am unable to find a command for it in the Jenkins Job DSL API: https://jenkinsci.github.io/job-dsl-plugin/

Here is the option I am trying to set using the DSL:enter image description here

Does this command exist? Is there anyways to setup my groovy to do this if it doesnt?


Solution

  • There is no built-in DSL to set that permission, but you can use the Dynamic DSL.
    The Job DSL API viewer can be opened at http://localhost:8080/plugin/job-dsl/api-viewer/index.html where localhost is your Jenkins host. Search for copyArtifactPermission as an example:

    job('example') {
      properties {
        copyArtifactPermissionProperty {
          projectNames('one, two')
        }
      }
    }