Pipeline job not showing correct git describe for submodule

Problem to solve

The git command “git describe --tags --always --dirty” doesn’t work correctly on a submodule when running in a CI job. The expected result is v0.4.0-54-ge243420 but I only get e243420.

When building locally on my computer I get the expected result.

Steps to reproduce

Run git describe --tags --always --dirty on a submodule in a CI job.

Versions

Please select whether options apply, and add the version information.

  • Self-managed
  • [ x] GitLab.com SaaS
  • Dedicated
  • Self-hosted Runners