Skip to content

User variable does not resolve in environment section

Summary

Environment variable in gitlab-ci.yml used in environment: url: <VAR> does not resolve.

Steps to reproduce

variables:
  APP_NAME: "hello-gitlab-ci"
deploy:
  stage: deploy
  script: some-script
environment:
  name: staging
  url: http://hostname/$APP_NAME/$CI_BUILD_REF_NAME

Actual behavior

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.

Expected behavior

The resulting url in the Gitlab UI should be: http://hostname/hello-gitlab-ci/master.

Environment description

  • custom installation
    • GitLab Community Edition 8.13.0, gitlab-runner 1.7.1
  • docker executor
Containers: 24
 Running: 0
 Paused: 0
 Stopped: 24
Images: 6
Server Version: 1.12.3
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 72
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge overlay null host
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-45-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.707 GiB
Name: li-ye
ID: VXMA:ZNJU:HJQF:5LXO:Q35Z:C63L:ZXYY:6JDY:7EGX:M76Z:MZA7:UVCW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8

Used GitLab Runner version

Version:      1.7.1
Git revision: f896af7
Git branch:   1-7-stable
GO version:   go1.7.3
Built:        Tue, 25 Oct 2016 16:57:56 +0000
OS/Arch:      linux/amd64

Using Docker executor with image node:latest