I try to get the latest tagged release during a pipeline step.
Here is a snippet of my script section:
- rev=“git rev-list --tags --max-count=1”
- echo $rev
The expected behaviour should be that 1. the variable rev gets assigned with “git rev-list --tags --max-count=1”.
2. This is printed in the next line.
3. It should execute and find the latest tagged commit.
However, this is the actual output:
rev="git rev-list --tags --max-count=1"
git rev-list --tags --max-count=1
usage: git rev-list [OPTION] … [ – paths… ]
As expected line 1 and 2 work fine. However line 3 failed and shows the usage text. That would suggest the git command didn’t pick up any of the arguments.
However, I tested it with the docker container itself, where it worked. So I suspect something gets lost in the .gitlab-ci.yml or through the runner…
Maybe someone had something similar or does know what I am missing (probably doing wrong)?