Skip outdated deployment jobs being ignored
Summary
When the environment:
stanza in a job comes after the script:
stanza, the Skip outdated deployment jobs
setting is ignored.
Steps to reproduce
When the Skip outdated deployment jobs
setting is set and a job is defined with the environment:
stanza after the script:
stanza like this:
staging:
stage: deploy
script:
- |
sleep 120
echo "Deploying"
environment:
name: staging
when: manual
the staging job will run in two simultaneously running pipelines even though that job should only run in the latest pipeline.
When the job is defined with the environment:
stanza before the script:
stanza like this:
staging:
stage: deploy
environment:
name: staging
when: manual
script:
- |
sleep 120
echo "Deploying"
the staging:
job in the first pipeline terminates without running, achieving the correct results.
Example Project
https://gitlab.com/midwest-apps/mdxpp/simple-maven-app The project is in a private group and cannot be made public, please ask me for access. There are pipeline runs in groups of two that demonstrate the problem. The last two demonstrate the problem, the prior pairs of pipelines show it working correctly
What is the current bug behavior?
The deploy job runs in multiple, concurrent pipelines.
What is the expected correct behavior?
The deploy job in all pipelines but the latest pipeline should be skipped, cancelled or fail.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)