I have 2 Jenkins (scripted) pipelines: main and e2e. My flow is: run the main pipeline which has a stage that triggers the e2e pipeline
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. 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. But is there any other way to achieve it?
CodePudding user response:
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. 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.