That GitLab CI/CD variable string interpolation expressions only cover a subset of BASH
E.g.
# .gitlab-ci.yaml
variables:
THE_IMAGE_TAG: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG:-${CI_COMMIT_SHA}}"
Will evaluate to, for example, yourdomain.gitlab.com:
(an invalid tag) even though at least CI_COMMIT_SHA
should be defined.
One solution for this problem is to perform the string interpolation in the script
block where evaluation is done in the shell.