Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 22
    • Issues 22
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLab FOSSGitLab FOSS
  • Issues
  • #54226
Closed
Open
Issue created Mar 24, 2017 by Daniel Eberli@deberli

Can accept merge request before external build system completion

Summary

Selecting the option Only allow merge requests to be merged if the pipeline succeeds allows for the MR to be merged if the external system has not yet reported a pipeline has started; i.e., I am able to accept a merge request (of a commit that will fail in the future once TeamCity builds it) if the build has not yet started in TeamCity.

I would expect that GitLab does not allow to proceed with a merge request, until TeamCity build has completed (even if it has not started yet.)

Steps to reproduce

  • set Only allow merge requests to be merged if the pipeline succeeds
  • setup TeamCity Integration and unselect Push trigger, set integration to active
  • setup TeamCity commit status publishing
  • create a feature branch 'develop' and make it fail in TeamCity
  • create a merge request

What is the current bug behavior?

If the TeamCity build has not yet started, I am able to accept the merge request.

What is the expected correct behavior?

GitLab should wait for TeamCity build completion before allowing to accept merge request.

Proposal

The most simple solution is to consider the current behavior to be a bug. When only_allow_merge_if_pipeline_succeeds is configured we should always require a green pipeline on a merge request, and that is it. We won't wait for a pipeline created message before we block the merge button, we will block the merge button until we receive a pipeline success message. If we never receive a pipeline success message, the MR will remain blocked.

This is the expected behavior if you click a checkbox requiring a successful pipeline prior to merging.

Limitations

There may be some users relying on treating a noop pipeline (i.e., one that does not produce any jobs due to only/except rules) as a kind of success. We don't have a way to reliably tell whether a merge request will have an external pipeline: we may not even initiate any event on our side, nor have any external CI integrations configured. For example, external CI systems could leverage webhooks to trigger pipelines and then use commit status API to tell us about the pipeline, in the meantime even if only_allow_merge_if_pipeline_succeeds=yes we would still allow merge because there is no pipeline.

Users expecting this behavior should ensure that there is at least one job in their pipelines that runs in order for their pipelines to be considered as successfully having run. For example, something like the following:

enable_merge:
  only: merge_requests
  script:
    - echo true

This will ensure that for any pipeline running for a merge request that at least one job runs.

Relevant logs and/or screenshots

  • The build is pending. I am able to accept the merge request (this is the issue)

image

  • The build is running (fine)

image

  • The build has failed, and merge is not possible.

image

Results of GitLab environment info

System information
System information
System:		Ubuntu 16.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.3.3p222
Gem Version:	2.6.6
Bundler Version:1.13.7
Rake Version:	10.5.0
Redis Version:	3.2.5
Sidekiq Version:4.2.7

GitLab information
Version:	8.17.3-ee
Revision:	33f4b58
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
DB Version:	9.2.18
URL:		*** not for you ***
HTTP Clone URL:	*** not for you ***
SSH Clone URL:	*** not for you ***
Elasticsearch:	no
Geo:		no
Using LDAP:	yes
Using Omniauth:	no

GitLab Shell
Version:	4.1.1
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Checking GitLab Shell ...

GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
5/1 ... ok
6/2 ... repository is empty
7/3 ... ok
9/5 ... ok
10/6 ... repository is empty
12/7 ... repository is empty
13/8 ... repository is empty
9/9 ... ok
5/10 ... ok
1/12 ... ok
17/13 ... ok
11/14 ... ok
1/16 ... ok
23/17 ... ok
1/18 ... ok
17/19 ... ok
1/20 ... ok
9/21 ... ok
9/22 ... ok
3/23 ... repository is empty
17/24 ... ok
17/25 ... ok
1/26 ... ok
32/28 ... ok
33/29 ... ok
17/30 ... ok
11/32 ... ok
1/33 ... ok
17/35 ... ok
17/38 ... ok
33/40 ... ok
11/41 ... ok
11/42 ... ok
11/43 ... ok
1/44 ... ok
38/45 ... ok
11/46 ... repository is empty
11/47 ... ok
17/48 ... ok
17/49 ... ok
11/50 ... ok
17/52 ... ok
17/53 ... ok
16/54 ... ok
16/55 ... ok
42/56 ... repository is empty
1/57 ... ok
1/58 ... ok
11/59 ... ok
9/62 ... ok
45/63 ... ok
17/64 ... ok
11/65 ... ok
23/68 ... ok
1/69 ... ok
11/70 ... ok
47/71 ... ok
47/72 ... ok
3/73 ... ok
17/74 ... ok
11/75 ... ok
47/76 ... ok
51/77 ... ok
2/78 ... ok
2/79 ... ok
3/80 ... ok
3/81 ... ok
11/82 ... ok
3/83 ... ok
54/84 ... ok
2/85 ... ok
2/86 ... ok
3/87 ... ok
54/88 ... ok
54/89 ... ok
54/90 ... ok
15/91 ... ok
1/92 ... ok
58/93 ... ok
58/94 ... ok
58/95 ... ok
58/96 ... ok
3/97 ... ok
3/98 ... ok
17/99 ... ok
3/100 ... ok
1/101 ... ok
17/102 ... ok
17/103 ... ok
33/104 ... ok
43/105 ... ok
17/106 ... ok
17/107 ... ok
11/108 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

Server: *** not for you ***
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
*** not for you ***

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ... 
5/1 ... yes
6/2 ... yes
7/3 ... yes
9/5 ... yes
10/6 ... yes
12/7 ... yes
13/8 ... yes
9/9 ... yes
5/10 ... yes
1/12 ... yes
17/13 ... yes
11/14 ... yes
1/16 ... yes
23/17 ... yes
1/18 ... yes
17/19 ... yes
1/20 ... yes
9/21 ... yes
9/22 ... yes
3/23 ... yes
17/24 ... yes
17/25 ... yes
1/26 ... yes
32/28 ... yes
33/29 ... yes
17/30 ... yes
11/32 ... yes
1/33 ... yes
17/35 ... yes
17/38 ... yes
33/40 ... yes
11/41 ... yes
11/42 ... yes
11/43 ... yes
1/44 ... yes
38/45 ... yes
11/46 ... yes
11/47 ... yes
17/48 ... yes
17/49 ... yes
11/50 ... yes
17/52 ... yes
17/53 ... yes
16/54 ... yes
16/55 ... yes
42/56 ... yes
1/57 ... yes
1/58 ... yes
11/59 ... yes
9/62 ... yes
45/63 ... yes
17/64 ... yes
11/65 ... yes
23/68 ... yes
1/69 ... yes
11/70 ... yes
47/71 ... yes
47/72 ... yes
3/73 ... yes
17/74 ... yes
11/75 ... yes
47/76 ... yes
51/77 ... yes
2/78 ... yes
2/79 ... yes
3/80 ... yes
3/81 ... yes
11/82 ... yes
3/83 ... yes
54/84 ... yes
2/85 ... yes
2/86 ... yes
3/87 ... yes
54/88 ... yes
54/89 ... yes
54/90 ... yes
15/91 ... yes
1/92 ... yes
58/93 ... yes
58/94 ... yes
58/95 ... yes
58/96 ... yes
3/97 ... yes
3/98 ... yes
17/99 ... yes
3/100 ... yes
1/101 ... yes
17/102 ... yes
17/103 ... yes
33/104 ... yes
43/105 ... yes
17/106 ... yes
17/107 ... yes
11/108 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 23

Checking GitLab ... Finished
Edited Jun 18, 2019 by Jason Yavorska
Assignee
Assign to
Time tracking