Grant copy artIfact permission in multi-branch pipeline

落花浮王杯 提交于 2019-12-10 14:57:42

问题


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?


回答1:


For Scripted Pipeline Syntax, this works:

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




回答2:


In declarative pipelines, this is the preferred syntax:

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

Available from version 1.41 of Copy Artifact.



来源:https://stackoverflow.com/questions/47771722/grant-copy-artifact-permission-in-multi-branch-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!