简体   繁体   English

为分支和提交触发 Jenkins 构建

[英]Trigger a Jenkins build for a branch and a commit

I have 2 Jenkins (scripted) pipelines: main and e2e.我有 2 个 Jenkins(脚本)管道:main 和 e2e。 My flow is: run the main pipeline which has a stage that triggers the e2e pipeline我的流程是:运行具有触发 e2e 管道的阶段的主管道

stage('Trigger e2e') {
  build(
    job: 'e2e/my-repo/master',
    propagate: false,
    wait: false
  )
}

The problem here is that the e2e pipeline always checks out the latest master, which might cause inconsistency.这里的问题是 e2e 管道总是检出最新的 master,这可能会导致不一致。 I want to check out the same revision as the main pipeline (that triggered it).我想检查与主管道(触发它)相同的修订。

Is there a way to trigger a specific revision within a pipeline?有没有办法在管道中触发特定的修订?

One solution I have found is to pass the revision as a parameter to the e2e pipeline and then do checkout scm for that revision.我发现的一种解决方案是将修订作为参数传递给 e2e 管道,然后为该修订执行checkout scm But is there any other way to achieve it?但是还有其他方法可以实现吗?

One solution I have found is to pass the revision as a parameter to the e2e pipeline and then do checkout scm for that revision.我发现的一种解决方案是将修订作为参数传递给 e2e 管道,然后为该修订执行 checkout scm。 But is there any other way to achieve it?但是还有其他方法可以实现吗?

Not that I know of: as explained in " Jenkins pipeline: checkout explicit git commit ", you need a parameter for a checkout step to be able to set your Jenkins workspace with the right version of the code.我不知道:正如“ Jenkins 管道:签出显式 git 提交”中所述,您需要一个用于checkout出步骤的参数,以便能够使用正确版本的代码设置您的 Jenkins 工作区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM