Multiple jobs for same environment
Summary
It is possible to specify multiple jobs in a pipeline that deploy to the same environment. If in the first job an environment url is specified, there is ~50% chance the CI_ENVIRONMENT_URL variable is defined in the second job.
In practice I use this to first deploy a server, then provision it with some data.
Steps to reproduce
Creat the following .gitlab-ci.yaml:
image: busybox
stages:
- deploy
- provision
deploy:
stage: deploy
environment:
name: test
url: https://example.com
script:
- echo "CI_ENVIRONMENT_URL: $CI_ENVIRONMENT_URL"
provision:
stage: provision
environment:
name: test
script:
- echo "CI_ENVIRONMENT_URL: $CI_ENVIRONMENT_URL"
Example Project
https://gitlab.com/appsemble/appsemble/pipelines/67191004
Notice the review provision job took 2 tries because of this issue.
What is the current bug behavior?
CI_ENVIRONMENT_URL is randomly defined.
What is the expected correct behavior?
CI_ENVIRONMENT_URL is either defined, or not defined.
Relevant logs and/or screenshots
https://gitlab.com/appsemble/appsemble/-/jobs/236213385
Output of checks
This bug happens on GitLab.com