Check "non-merge-requests pipeline" in a MR
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
(Summarize the bug encountered concisely)
MR should check both "non-merge-request pipeline" and "merge-request pipeline".
Steps to reproduce
(How one can reproduce the issue - this is very important)
I have two jobs in my GitLab CI: check_mr and build_docker_image. I want to:
- Every push will build an image. So I add
build_docker_image - A MR can only be merged if both two jobs are successful.
And here is my .gitlab-ci.yml:
check_mr:
image: python:3.7-stretch
only:
# some environment variables are only available in a "merge-request pipeline"
- merge_requests
script:
- python check_mr.py --targe ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} --source ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
build_docker_image:
image: docker:latest
only:
# Every push should build a image
- branches
# Check this job in MRs
- merge_requests
script:
- echo 'build_docker_image'
If a branch has a MR, every push to this branch will run build_docker_image twice.
Example Project
What is the current bug behavior?
(What actually happens)
MR don't check "non-merge-request pipeline" if a "merge-request pipeline" exists.
What is the expected correct behavior?
(What you should see instead)
MR should check "non-merge-request pipeline" so that I don't have to run build_docker_image twice.
Maybe some UI like below.
Relevant logs and/or screenshots
N/A
Output of checks
N/A
Results of GitLab environment info
N/A
Results of GitLab application Check
N/A
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
N/A
