Given a pipeline with multiple stages and some stages running on different agents, if a new commit is push while the pipeline is running, a stage running later in a different agent will implicitly checkout the new commit instead of the commit that originated the pipeline execution.
Steps to reproduce:
- Using this repo https://github.com/nicopaez/ejemplo create a pipeline job
- Start the pipeline, it will wait for you input after stage 1
- Commit+push a change in the repository
- Let the pipeline proceed with the execution
Expected behavior: both stages get the same git commit
Actual behavior: both stages are getting different git commits
I think the issues is in the implicit checkout operations that is perform on each stage. It seems it is checking out the branch when it should checkout the specific commits that was checkout when the pipeline was started.
We verified this issues on 2 different configurations:
- A single instance Jenkins setup using docker agents
- A master-slave Jenkins setup using different server nodes (no docker)