0

i am writing a custom pipeline template for our maven/java pipelines. All projects shold inherit some stages via include:

include:
  - project: 'markus/pipeline-template-java'
    file: '.gitlab-ci.yml'

I can fix the version with e.g. ref: tags/v1 but ideally, I want it floating and be updated whenever the template changes (ref defaults to HEAD of the default branch)

But now I don't know which exact version was underlying. I would like to print the parent's commit-hash while the script is running.

markus
  • 446
  • 1
  • 4
  • 11
  • 1
    You don't have access to this at runtime, but you can probably use the `CI_PIPELINE_CREATED_AT` variable (or get this from the pipelines API) to determine the precise git hash on the template project by cloning it and checking out the default branch [at that particular point in time](https://stackoverflow.com/a/6990682/5747944) -- so long as the default branch does not change or you specify the branch in `ref:`. – sytech Dec 07 '21 at 16:49

0 Answers0