Auto-cancel pending pipelines
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
(Not able to prevent multiple pipelines to be executed in parallel)
Steps to reproduce
- Create new gitlab project
- Turned on “Auto-cancel redundant, pending pipelines” from the CICD pipeline setting for this project.
- Keep commit the changes or keep clicking on “Run Pipeline” button multiple times
- Make sure that you have multiple shared runners (I have 50 shared runners)
Example Project
stages:
- build
- test
- stage
before_script:
- env | sort
- pwd
- ls -la
build:
stage: build
image: "paciolanadmin/maven-jdk-alpine"
script:
- echo "Starting building...."
- sleep 50
- echo "Done"
test:
stage: test
image: "paciolanadmin/maven-jdk-alpine"
script:
- echo "Starting deploying to test..."
- sleep 50
- echo "Done"
stage:
stage: stage
image: "paciolanadmin/maven-jdk-alpine"
script:
- echo "Starting deploying to stage..."
- sleep 50
- echo "Done"
when: manual
What is the current bug behavior?
None of the pipelines are canceled. All pipelines are executed
What is the expected correct behavior?
Only one pipeline to run at a time All redundant pipeline should be auto canceled and only the last pipeline will be in the queue
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: 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)