Grant copy artIfact permission in multi-branch pipeline
Asked Answered
K

2

9

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?

Kab answered 12/12, 2017 at 11:38 Comment(0)
R
2

For Scripted Pipeline Syntax, this works:

  properties([[$class: 'CopyArtifactPermissionProperty', projectNames: 'Other Project Name'], [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], pipelineTriggers([])])

Referendum answered 21/3, 2019 at 15:31 Comment(1)
is there a way to use wildcards - or allow all other build to access ?Bobbery
C
9

In declarative pipelines, this is the preferred syntax:

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

Available from version 1.41 of Copy Artifact.

Cetology answered 25/4, 2019 at 17:5 Comment(0)
R
2

For Scripted Pipeline Syntax, this works:

  properties([[$class: 'CopyArtifactPermissionProperty', projectNames: 'Other Project Name'], [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], pipelineTriggers([])])

Referendum answered 21/3, 2019 at 15:31 Comment(1)
is there a way to use wildcards - or allow all other build to access ?Bobbery

© 2022 - 2024 — McMap. All rights reserved.