I'm trying to call shell command in .gitlab-ci.yml, whose relevant parts are:
image: docker:latest
services:
- docker:dind
stages:
- build
- deploy
...
build:
stage: build
script:
- apt-get update -y
- GIT_TAG=$(git tag | tail -1)
- GIT_TAG=$(/usr/bin/git tag | tail -1)
- docker ...
However all top three shell command callings have failed, all with "command not found" error. The git command being failing is really odd, because it has to get the git repo first before start the script section. I.e., I can see that git is working, but I just can't use it myself.
Is there any way to make it working?
docker:latesthasgitinstalled? Try addingapt-get install -y git.docker:latestis based onalpine:3.9so you needapk add --no-cache git.$CI_COMMIT_TAGthen please see my earlier comment that I've tried and confirmed that it is not available for my specific case in OP.