Use a commit SHA as the branch specifier for downstream job
In a repository 'main-project' I have an 'src/' folder containing the source code of my application.
I also have a submodule 'application-tests' cloned into 'test/'.
The 'application-tests' submodule is continuously updated with new testsuites that are added to the .gitlab-ci.yml file, local to that module.
In the pipeline of main-project I'd like to trigger the pipeline of the applications-tests module.
I can do that with a downstream job by pointing at a branch, of the applications-tests module.
However, if I tag my main-project today and want to re-run the pipeline of that tag in the future, then the pipeline script will be based on the newest version of the downstream branch and not the branch as it was when I tagged my main-project.
Alternatively to branch name, I could use tags as references, but then I'd need to make sure that the checked out version of the submodule, always matches the one pointed to by downstream job.
It would be preferable that the pipeline of my main-project, could get the SHA of the submodule and use that as a reference for the downstream-job.
downstream_pipeline:
trigger:
project: application-tests/.gitlab-ci.yml
branch: "1234abcd" #<- SHA of checked out version of application-tests in the upstream repository
strategy: depend`
The 'branch' specifier could be changed to 'ref' like in the 'includes' section of the pipeline scripts.