jenkins - 如何使用 Pipeline Job 的 CopyArtifact 插件传递从中复制工件的内部版本号?

标签 jenkins jenkins-workflow jenkins-pipeline

如何传递在管道作业中复制工件的内部版本号? 因为默认此步骤从最后一个稳定版本复制工件,并且我需要从特定版本(例如 123)复制工件。

我的管道代码在这里:

node {
  stage "Copy artifacts"
  step ([$class: 'CopyArtifact',
          projectName: 'other-project',
          filter: 'myapp.jar']);
}

最佳答案

来自官方博客post :

All other config options that the copyartifact-plugin supports are also available. The easiest way to test/browse all options is through the Workflow script “Snippet Generator” (available on the workflow configuration screen below the workflow script textarea).

如果可以参数化,内置的“片段生成器”中应该有适当的选项。

要从特定版本复制工件,您需要额外使用selector参数:

node {
  stage "Copy artifacts"
  step ([$class: 'CopyArtifact',
          projectName: 'other-project',
          filter: 'myapp.jar', 
          selector: [$class: 'SpecificBuildSelector', buildNumber: '1']
        ]);
}

关于jenkins - 如何使用 Pipeline Job 的 CopyArtifact 插件传递从中复制工件的内部版本号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36872752/

相关文章:

jenkins - 清理/var/lib/jenkins/caches 文件夹

Jenkinsfile 主动选择参数

ios - iOS 中的 Makefiles 使用 jenkins 构建

curl - Jenkins - 使用 curl 获取最新的工件

Jenkins管道: How to dump errors?

jenkins - 如何在工作流程中获得 $CAUSE

jenkins - Jenkins 上的 JUnit 结果超过 1 个图表

jenkins - 如何管理需要针对多个分支运行的 Jenkins 作业?

amazon-web-services - 如何在 Jenkins 上启动多台 AWS EC2 机器?

jenkins - Jenkins工作流程结帐访问BRANCH_NAME和GIT_COMMIT