Jenkins multi-branch pipeline and specifying upstream projects

一世执手 提交于 2019-11-30 20:50:23

You should add the branch name to your upstream job (assuming you are using a multi-branch pipeline for the upstream job too).

Suppose you have a folder with two jobs, both multi-branch pipeline jobs: jobA and jobB; jobB should trigger after jobA's master.

You can add this code snippet to jobB's Jenkinsfile:

properties([
  pipelineTriggers([
    upstream(
      threshold: 'SUCCESS',
      upstreamProjects: '../jobA/master'
    )
  ])
])

(Mind that any branch of jobB here will trigger after jobA's master!)

I'm currently trying to get this to work for our deployment. The closest I've got is adding the following to the downstream Jenkinsfile;

properties([
    pipelineTriggers([
        triggers: [
            [
                $class: 'jenkins.triggers.ReverseBuildTrigger',
                upstreamProjects: "some_project", result: hudson.model.Result.SUCCESS
            ]
        ]
    ]),
])

That at least gets Jenkins to acknowledge that it should be triggering when 'some_project' get's built i.e it appears in the "View Configuration" page.

However so far builds of 'some_project' still don't trigger the downstream project as expected.

That being said maybe you'll have more luck. Let me know if it works for you.

(Someone else has asked a similar question here -> Jenkins: Trigger Multi-branch pipeline on upstream change )

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