Skip to content
Snippets Groups Projects

Show error message when pipelines disabled and Pipeline must succeed

1 unresolved thread
12 files
+ 110
17
Compare changes
  • Side-by-side
  • Inline
Files
12
  • When there are no CI services found and
    the pipeline must succeed option is turned
    on, this is considered an invalid usecase
    since the pipeline will never be successful.
    Because of this, we add a meaningful message
    to the UI that explain this situation and link
    to our documentation while in the Merge request.
<script>
import { isEmpty } from 'lodash';
import { GlIcon, GlDeprecatedButton } from '@gitlab/ui';
import { GlIcon, GlDeprecatedButton, GlSprintf, GlLink } from '@gitlab/ui';
import successSvg from 'icons/_icon_status_success.svg';
import warningSvg from 'icons/_icon_status_warning.svg';
import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_to_merge';
@@ -26,6 +26,8 @@ export default {
CommitEdit,
CommitMessageDropdown,
GlIcon,
GlSprintf,
GlLink,
GlDeprecatedButton,
MergeImmediatelyConfirmationDialog: () =>
import(
@@ -56,7 +58,7 @@ export default {
status() {
const { pipeline, isPipelineFailed, hasCI, ciStatus } = this.mr;
if (hasCI && !ciStatus) {
if ((hasCI && !ciStatus) || this.hasPipelineMustSucceedConflict) {
return 'failed';
} else if (this.isAutoMergeAvailable) {
return 'pending';
@@ -81,7 +83,7 @@ export default {
this.status === 'failed' ||
!this.commitMessage.length ||
!this.mr.isMergeAllowed ||
this.mr.preventMerge
!this.mr.isApproved
) {
return 'warning';
}
@@ -97,6 +99,9 @@ export default {
return __('Merge');
},
hasPipelineMustSucceedConflict() {
return !this.mr.hasCI && this.mr.onlyAllowMergeIfPipelineSucceeds;
},
isRemoveSourceBranchButtonDisabled() {
return this.isMergeButtonDisabled;
},
@@ -321,7 +326,10 @@ export default {
</li>
</ul>
</span>
<div class="media-body-wrap space-children">
<div
class="media-body-wrap"
:class="{ 'space-children': !hasPipelineMustSucceedConflict }"
>
<template v-if="shouldShowMergeControls">
<label v-if="mr.canRemoveSourceBranch">
<input
@@ -343,9 +351,19 @@ export default {
/>
</template>
<template v-else>
<span class="bold js-resolve-mr-widget-items-message">
{{ mergeDisabledText }}
</span>
<div class="bold js-resolve-mr-widget-items-message">
<gl-sprintf
v-if="hasPipelineMustSucceedConflict"
:message="pipelineMustSucceedConflictText"
>
<template #link="{ content }">
<gl-link :href="mr.pipelineMustSucceedDocsPath" target="_blank">
{{ content }}
</gl-link>
</template>
</gl-sprintf>
<gl-sprintf v-else :message="mergeDisabledText" />
</div>
</template>
</div>
</div>
Loading