environment:url setting wrong link when a variable comes from the runner
Summary
environment:url
cannot use variables that come from the runner setup.
Steps to reproduce
Register a runner adding --env REVIEW_DOMAIN=example.com --env REVIEW_PORT=81
to the registration CLI.
Verify in the runner config.toml
that both variables are in place.
Define a job such as:
norunbot up:
stage: deploy
variables:
CI_DEBUG_TRACE: "true"
DOMAIN_TEST: $CI_ENVIRONMENT_SLUG.$REVIEW_DOMAIN
environment:
name: review $CI_COMMIT_REF_NAME
url: http://$CI_ENVIRONMENT_SLUG.$REVIEW_DOMAIN:$REVIEW_PORT
script:
- docker-compose up -d
Actual behavior
In the MR that triggered the pipeline, you end up with this broken link:
As you can see, runner variables become empty strings.
Expected behavior
It should fulfill the whole link like here:
I was able to get to that by adding both variables into the job's or global variables:
key, but it should not be needed, since those are defined already by the runner itself.
Relevant logs and/or screenshots
The most interesting thing is that the logs, when the bug happens, show this little thing at the end:
++ export CI_ENVIRONMENT_URL=http://review-10-ci-vpqw6m.example.com:81
++ CI_ENVIRONMENT_URL=http://review-10-ci-vpqw6m.example.com:81
Which is confusing because it seems like it actually exports the variable correctly expanded, but gets broken in some other part...
Environment description
Shared runner, custom installation, docker executor:
# docker info
Containers: 23
Running: 5
Paused: 0
Stopped: 18
Images: 34
Server Version: 17.07.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3addd840653146c90a254301d6c3a663c7fd6429
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.10.0-33-generic
Operating System: Alpine Linux v3.6 (containerized)
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 62.92GiB
Name: dind.gitlab.tecnativa.com
ID: IPJL:Z4JM:QG7D:UC4W:NHXS:E66L:TDG7:YBIU:BFCT:AI4J:SXGL:DKUX
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Used GitLab Runner version
Version: 9.5.0
Git revision: 413da38
Git branch: 9-5-stable
GO version: go1.8.3
Built: Tue, 22 Aug 2017 13:35:13 +0000
OS/Arch: linux/amd64