Jenkins Pipeline:如何在构建多分支项目后构建作业构建?

luk*_*a5z 3 jenkins jenkins-pipeline

是否可以Build after other projects are built为Pipeline Multibranch定义,特别是对于org.文件夹如GitHub OrganizationBitbucket Tream/Project

例:

properties([pipelineTriggers([upstream(
        threshold: hudson.model.Result.SUCCESS,         
        upstreamProjects: "../multibranch-job/master")])])
Run Code Online (Sandbox Code Playgroud)

它有用吗?它需要绝对路径还是相对路径?

luk*_*a5z 10

显然Build after other projects are built只是罚款或者与通用管道,多枝,或组织.像Bitbucket Team/Project这样的文件夹.

我的问题与我指的是错误路径的工作有关.

绝对路径:

可以始终在作业屏幕的上半部分找到绝对路径.如果name包含可能被Jenkins替换的特殊字符,这将特别有用.

在此输入图像描述

因此,该properties步骤应该看起来:

properties([pipelineTriggers([upstream(
        threshold: hudson.model.Result.SUCCESS,         
        upstreamProjects: "t/multibranch-job-to-be-triggered/feature%2Ftest")])])
Run Code Online (Sandbox Code Playgroud)

相对路径:

除了绝对路径,你可以用相对路径来指代工作,例如:

  • another-branch
  • ../another-job/branch