I have the following (simplified) gitlab-ci.yml:
variables:
APP_NAME: "hello-gitlab-ci"
deploy:
stage: deploy
script: some-script
environment:
name: staging
url: http://hostname/$APP_NAME/$CI_BUILD_REF_NAME
The resulting url in the Gitlab UI is e.g.: http://hostname//master. $APP_NAME seems to resolve to an empty String, whereas the runner variable $CI_BUILD_REF_NAME resolves correctly.
GitLab Community Edition 8.13.0, gitlab-runner 1.7.1. What am I missing?
From GitLab doc, the YAML-defined variables are supported with GitLab Runner 0.5.0 or higher and GitLab CI 7.14 or higher, so first, check your GitLab component versions.
Try also enabling debug, to have more clues on why this variable is not resolved:
job1:
variables:
CI_DEBUG_TRACE: "true"
This is most likely a bug in GitLab Runner where the env variables are defined after the environment but before the script. Have you considered opening an issue? https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With