Same git commit is not used in all stages during a CI pipeline execution

We may get into a situation when we run a multi-staged CI pipeline with all stages pointing to the same codebase, if there is a code change in the repository after the build job starts, the following stages will not pick up the same commit ID, instead, it will use the latest commit ID which would not match with the version of code used at the earlier stages.

This can happen when we use a generic git connector (platform-agnostic Git Connector) as detailed in the doc . In this case, after cloning the repo as part of the pipeline execution, we check out to a specific branch not to a commit ID.

When you run a multi-staged CI pipeline with all stages pointing to the same codebase and you want all the CI stages to be checked out to a specific commit ID even if there are changes in the repository while the pipeline is running, you would need to use the git connectors specific to the popular git platforms like GitHub, bitbucket, etc with the token access as detailed in the doc

3 Likes