"Merge When Build Succeeds" merges even on failed build
Summary
For builds that are ran with specific order types
, the merge occurs once the first stage passes even if later stages are failures which can lead to unexpected results and failing builds being merged.
Steps to reproduce
- Create blank project.
- Add successful
.gitlab-ci.yml
to repo - Push
master
branch - Create new branch
- Update
.gitlab-ci.yml
to add subsequent failing build - While build is running click "Merge When Build Succeeds"
- First stage will pass and merge will complete
- After merge second stage will fail
I have noticed similar behavior with webhooks and using them to trigger deployments, since each stage fires its own webhook and one could pass and then later ones fail.
This problem does not seem to occur unless a specified order is in the build. If the build is not ordered with the type
option or has only one type then the merge does not complete until all stages have passed.
I have not tested on latest I ran against latest master
because I have not quite determined how to run a ci-runner locally. I tested with the build on gitlab.com
as of 2016-02-01 @ 17:15 CST.master
locally and still an issue.
Expected behavior
The branch should not be merged until all stages (without allowed_to_fail
) pass.
Relevant logs and/or screenshots
Working .gitlab-ci.yml
types:
- one
- two
job1:
type: one
script:
- echo "should pass"
- ls
Failing .gitlab-ci.yml The sleep helps simulate longer build and allows time to click "Merge When Build Succeeds"
types:
- one
- two
job1:
type: one
script:
- sleep 30
- echo "should pass"
- ls
job2:
type: two
script:
- echo "should fail"
- cat not_here
Merge Accepted and Waiting Merge has been accepted and is waiting for build to succeed.
Branch Merged Branch has been merged even though second stage is still running
Build Failed after Merge Branch has been merged and afterwards the build fails