Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grant copy artIfact permission in multi-branch pipeline

I have the following setup:

A Jenkins multi-branch pipeline job configured through Jenkinsfile. After successful checkout and build, the artifact is archived and a downstream job is triggered to deploy the generated artifact.

For the second job to be able to copy the artefact through the [$class: 'CopyArtifact'... step, it needs copy permissions.

So the question is, how do I grant those permissions through the Jenkinsfile of the upstream job?

like image 813
TheRock3t Avatar asked Dec 12 '17 11:12

TheRock3t


People also ask

Under which section is the copy artifacts option present in Jenkins?

Next you need to install the Copy Artifact plugin in the Manage Plugins section of Jenkins. Go to "[PROJECT-NAME]-Output" > configure and add a new build step. Because you have installed the Copy Artifact plugin you should see an option called 'copy artifacts from another project' in the drop down menu.

How do you add build artifacts in Jenkins?

How to Create an Artifact. In Jenkins, an artifact is created in either Freestyle projects or Pipeline projects. In Freestyle, add the “Archive the artifacts” post-build step. In Pipeline, use the archiveArtifacts step.


1 Answers

In declarative pipelines, this is the preferred syntax:

options {
    copyArtifactPermission('my-downstream-project');
}

Available from version 1.41 of Copy Artifact.

like image 193
Raphael Avatar answered Nov 03 '22 01:11

Raphael