eklektek
eklektek

Reputation: 1173

example of a DSL generated copyArtifacts job

I am trying to use DSL to generate a job that uses copyArtifacts. I have been able to generate basic Copy artifact from another project using the following:

job('DSL-AgreegateArtifacts') {
  steps {
    copyArtifacts( 'Template-DSPL_RPub' )
  }
}

However I also need to be able to specify Which build, Artifacts to copy and Target directory. It is not clear to me how I use Closure copyArtifactClosure to specify this information? I have not found any examples.

Upvotes: 1

Views: 1873

Answers (1)

daspilker
daspilker

Reputation: 8194

There is an example in the Job DSL reference for copyArtifacts:

job('example') {
    steps {
        copyArtifacts('upstream') {
            includePatterns('*.xml', '*.properties')
            targetDirectory('files')
            buildSelector {
                latestSuccessful(true)
            }
        }
    }
}

Upvotes: 2

Related Questions