Commit 3fe62d8f authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents c8070fcf 4d1e2ec4
......@@ -1032,9 +1032,9 @@ class MergeRequest < ApplicationRecord
def mergeable_ci_state?
return true unless project.only_allow_merge_if_pipeline_succeeds?
return true unless head_pipeline
return false unless actual_head_pipeline
actual_head_pipeline&.success? || actual_head_pipeline&.skipped?
actual_head_pipeline.success? || actual_head_pipeline.skipped?
end
def environments_for(current_user)
......
---
title: Enforce presence of pipeline when "Pipeline must succeed" project setting is enabled
merge_request: 29926
author:
type: fixed
......@@ -108,6 +108,7 @@ description: 'Learn how to contribute to GitLab.'
- [Database Debugging and Troubleshooting](database_debugging.md)
- [Query Count Limits](query_count_limits.md)
- [Database helper modules](database_helpers.md)
- [Code comments](code_comments.md)
## Integration guides
......
# Code comments
Whenever you add comment to the code that is expected to be addressed at any time
in future, please create a technical debt issue for it. Then put a link to it
to the code comment you've created. This will allow other developers to quickly
check if a comment is still relevant and what needs to be done to address it.
Examples:
```rb
# Deprecated scope until code_owner column has been migrated to rule_type.
# To be removed with https://gitlab.com/gitlab-org/gitlab-ee/issues/11834.
scope :code_owner, -> { where(code_owner: true).or(where(rule_type: :code_owner)) }
```
# Operations Dashboard **[PREMIUM]**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/5781)
in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.5.
[Moved](https://gitlab.com/gitlab-org/gitlab-ee/issues/9218) to
[GitLab Premium](https://about.gitlab.com/pricing/) in 11.10.
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/5781) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.5. [Moved](https://gitlab.com/gitlab-org/gitlab-ee/issues/9218) to [GitLab Premium](https://about.gitlab.com/pricing/) in 11.10.
The Operations Dashboard provides a summary of each project's operational health,
including pipeline and alert status.
......@@ -16,9 +13,9 @@ dashboard icon:
## Adding a project to the dashboard
NOTE: **Note:**
For GitLab.com, the Operations Dashboard is available for free for public projects.
If your project is private, the group it belongs to must have a
[Gold](https://about.gitlab.com/pricing/) plan.
For GitLab.com, you can add your project to the Operations Dashboard for free if
your project is public. If your project is private, the group it belongs to must
have a [Silver](https://about.gitlab.com/pricing/) plan.
To add a project to the dashboard:
......
......@@ -42,6 +42,8 @@ Navigate to your project's settings page and expand the **Merge requests** secti
In the **Merge checks** subsection, select the **Pipelines must succeed** check
box and hit **Save** for the changes to take effect.
NOTE: **Note:** This setting also prevents merge requests from being merged if there is no pipeline.
![Pipelines must succeed settings](img/merge_when_pipeline_succeeds_only_if_succeeds_settings.png)
From now on, every time the pipeline fails you will not be able to merge the
......@@ -49,6 +51,21 @@ merge request from the UI, until you make all relevant jobs pass.
![Only allow merge if pipeline succeeds message](img/merge_when_pipeline_succeeds_only_if_succeeds_msg.png)
### Limitations
When this setting is enabled, a merge request is prevented from being merged if there is no pipeline. This may conflict with some use cases where [`only/except`](../../../ci/yaml/README.md#onlyexcept-advanced) rules are used and they don't generate any pipelines.
Users that expect to be able to merge a merge request in this scenario should ensure that [there is always a pipeline](https://gitlab.com/gitlab-org/gitlab-ce/issues/54226) and that it's succesful.
For example, to that on merge requests there is always a passing job even though `only/except` rules may not generate any other jobs:
```yaml
enable_merge:
only: merge_requests
script:
- echo true
```
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
......@@ -2122,7 +2122,7 @@ describe MergeRequest do
allow(subject).to receive(:head_pipeline) { nil }
end
it { expect(subject.mergeable_ci_state?).to be_truthy }
it { expect(subject.mergeable_ci_state?).to be_falsey }
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment