Reputation: 63
I run a Jenkins pipeline which executes jobs on a (always the same) virtual machine using agent.jar
.
These jobs produce artifacts on the VM-workspace
directory and these files are successfully transferred to Jenkins.
Now I want the pipeline to retrieve data from that VM-workspace
too.
How can I configure the "archiveArtifacts
to access my VM?
Upvotes: 0
Views: 89
Reputation: 63
this works for me: In the job config activate "Permission to Copy Artifact" "Projects to allow copy artifacts" : *
In the job config, Post build actions, Archive the artifacts, Files to archive: result.html
In the pipeline script:
stage("foo-stage") {
steps {
script {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', catchInterruptions: false) {
timeout(time: 5, unit: 'MINUTES') {
String jobName = "foo-job"
String artifactsFilter = "*.html"
result = build job: jobName
copyArtifacts filter: artifactsFilter, projectName: jobName , selector: specific("${result.number}")
archiveArtifacts artifacts: artifactsFilter
}
}
}
}
}
Upvotes: 0