Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
d10ab00450
commit
02c151e384
|
|
@ -1 +1 @@
|
|||
b86a2ba3e29e0243f25f1b82f30e8e9ed7f85132
|
||||
22c9b23bfcdeedc373462a54cea5ee55790a62b1
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ export default {
|
|||
if (this.showMappingBuilder) {
|
||||
this.resetPayloadAndMappingConfirmed = false;
|
||||
this.parsedPayload = payloadAlertFields;
|
||||
this.samplePayload.json = this.isValidNonEmptyJSON(payloadExample) ? payloadExample : null;
|
||||
this.samplePayload.json = this.getPrettifiedPayload(payloadExample);
|
||||
this.updateMapping(this.getCleanMapping(payloadAttributeMappings));
|
||||
}
|
||||
this.$el.scrollIntoView({ block: 'center' });
|
||||
|
|
@ -288,6 +288,11 @@ export default {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
getPrettifiedPayload(payload) {
|
||||
return this.isValidNonEmptyJSON(payload)
|
||||
? JSON.stringify(JSON.parse(payload), null, '\t')
|
||||
: null;
|
||||
},
|
||||
triggerValidation() {
|
||||
if (this.isHttp) {
|
||||
this.validationState.apiUrl = true;
|
||||
|
|
|
|||
|
|
@ -51,8 +51,18 @@ export default {
|
|||
|
||||
<template>
|
||||
<gl-button-group class="gl-z-index-1">
|
||||
<gl-button icon="dash" :disabled="disableDecrease" @click="decrementScale" />
|
||||
<gl-button icon="redo" :disabled="disableReset" @click="resetScale" />
|
||||
<gl-button icon="plus" :disabled="disableIncrease" @click="incrementScale" />
|
||||
<gl-button
|
||||
icon="dash"
|
||||
:disabled="disableDecrease"
|
||||
:aria-label="__('Decrease')"
|
||||
@click="decrementScale"
|
||||
/>
|
||||
<gl-button icon="redo" :disabled="disableReset" :aria-label="__('Reset')" @click="resetScale" />
|
||||
<gl-button
|
||||
icon="plus"
|
||||
:disabled="disableIncrease"
|
||||
:aria-label="__('Increase')"
|
||||
@click="incrementScale"
|
||||
/>
|
||||
</gl-button-group>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {
|
|||
GlTooltipDirective,
|
||||
GlModalDirective,
|
||||
} from '@gitlab/ui';
|
||||
import { s__, sprintf } from '~/locale';
|
||||
import { __, s__, sprintf } from '~/locale';
|
||||
import timeagoMixin from '~/vue_shared/mixins/timeago';
|
||||
|
||||
export default {
|
||||
|
|
@ -24,11 +24,12 @@ export default {
|
|||
createdTimeagoLabel: s__('UserList|created %{timeago}'),
|
||||
deleteListTitle: s__('UserList|Delete %{name}?'),
|
||||
deleteListMessage: s__('User list %{name} will be removed. Are you sure?'),
|
||||
editUserListLabel: s__('FeatureFlags|Edit User List'),
|
||||
},
|
||||
modal: {
|
||||
id: 'deleteListModal',
|
||||
actionPrimary: {
|
||||
text: s__('Delete user list'),
|
||||
text: __('Delete user list'),
|
||||
attributes: { variant: 'danger', 'data-testid': 'modal-confirm' },
|
||||
},
|
||||
},
|
||||
|
|
@ -93,6 +94,7 @@ export default {
|
|||
:href="list.path"
|
||||
category="secondary"
|
||||
icon="pencil"
|
||||
:aria-label="$options.translations.editUserListLabel"
|
||||
data-testid="edit-user-list"
|
||||
/>
|
||||
<gl-button
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ import { splitCamelCase } from '../../lib/utils/text_utility';
|
|||
import ReplyButton from './note_actions/reply_button.vue';
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
addReactionLabel: __('Add reaction'),
|
||||
editCommentLabel: __('Edit comment'),
|
||||
deleteCommentLabel: __('Delete comment'),
|
||||
moreActionsLabel: __('More actions'),
|
||||
},
|
||||
name: 'NoteActions',
|
||||
components: {
|
||||
GlIcon,
|
||||
|
|
@ -301,9 +307,9 @@ export default {
|
|||
category="tertiary"
|
||||
variant="default"
|
||||
size="small"
|
||||
title="Add reaction"
|
||||
:title="$options.i18n.addReactionLabel"
|
||||
:aria-label="$options.i18n.addReactionLabel"
|
||||
data-position="right"
|
||||
:aria-label="__('Add reaction')"
|
||||
>
|
||||
<span class="reaction-control-icon reaction-control-icon-neutral">
|
||||
<gl-icon name="slight-smile" />
|
||||
|
|
@ -325,7 +331,8 @@ export default {
|
|||
<gl-button
|
||||
v-if="canEdit"
|
||||
v-gl-tooltip
|
||||
title="Edit comment"
|
||||
:title="$options.i18n.editCommentLabel"
|
||||
:aria-label="$options.i18n.editCommentLabel"
|
||||
icon="pencil"
|
||||
size="small"
|
||||
category="tertiary"
|
||||
|
|
@ -336,7 +343,8 @@ export default {
|
|||
<gl-button
|
||||
v-if="showDeleteAction"
|
||||
v-gl-tooltip
|
||||
title="Delete comment"
|
||||
:title="$options.i18n.deleteCommentLabel"
|
||||
:aria-label="$options.i18n.deleteCommentLabel"
|
||||
size="small"
|
||||
icon="remove"
|
||||
category="tertiary"
|
||||
|
|
@ -346,7 +354,8 @@ export default {
|
|||
<div v-else-if="shouldShowActionsDropdown" class="dropdown more-actions">
|
||||
<gl-button
|
||||
v-gl-tooltip
|
||||
title="More actions"
|
||||
:title="$options.i18n.moreActionsLabel"
|
||||
:aria-label="$options.i18n.moreActionsLabel"
|
||||
icon="ellipsis_v"
|
||||
size="small"
|
||||
category="tertiary"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ const i18n = {
|
|||
submitErrorTitle: s__('Pipeline|Pipeline cannot be run.'),
|
||||
warningTitle: __('The form contains the following warning:'),
|
||||
maxWarningsSummary: __('%{total} warnings found: showing first %{warningsDisplayed}'),
|
||||
removeVariableLabel: s__('CiVariables|Remove variable'),
|
||||
};
|
||||
|
||||
export default {
|
||||
|
|
@ -416,15 +417,17 @@ export default {
|
|||
data-testid="remove-ci-variable-row"
|
||||
variant="danger"
|
||||
category="secondary"
|
||||
:aria-label="$options.i18n.removeVariableLabel"
|
||||
@click="removeVariable(index)"
|
||||
>
|
||||
<gl-icon class="gl-mr-0! gl-display-none gl-md-display-block" name="clear" />
|
||||
<span class="gl-md-display-none">{{ s__('CiVariables|Remove variable') }}</span>
|
||||
<span class="gl-md-display-none">{{ $options.i18n.removeVariableLabel }}</span>
|
||||
</gl-button>
|
||||
<gl-button
|
||||
v-else
|
||||
class="gl-md-ml-3 gl-mb-3 gl-display-none gl-md-display-block gl-visibility-hidden"
|
||||
icon="clear"
|
||||
:aria-label="$options.i18n.removeVariableLabel"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ export default {
|
|||
class="gl-absolute gl-top-0 gl-bottom-0 gl-shadow-none! gl-rounded-0!"
|
||||
:class="`js-pipeline-expand-${pipeline.id} ${expandButtonPosition}`"
|
||||
:icon="expandedIcon"
|
||||
:aria-label="__('Expand pipeline')"
|
||||
data-testid="expand-pipeline-button"
|
||||
data-qa-selector="expand_pipeline_button"
|
||||
@click="onClickLinkedPipeline"
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ export default {
|
|||
size="small"
|
||||
class="gl-mr-3 js-back-button"
|
||||
icon="angle-left"
|
||||
:aria-label="__('Go back')"
|
||||
@click="onBackClick"
|
||||
/>
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ export default {
|
|||
category="secondary"
|
||||
variant="danger"
|
||||
icon="remove"
|
||||
:aria-label="__('Remove user')"
|
||||
data-testid="delete-user-id"
|
||||
@click="removeUserId(id)"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Ci
|
||||
class AfterRequeueJobService < ::BaseService
|
||||
def execute(processable)
|
||||
process_subsequent_jobs(processable)
|
||||
reset_ancestor_bridges(processable)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_subsequent_jobs(processable)
|
||||
processable.pipeline.processables.skipped.after_stage(processable.stage_idx).find_each do |processable|
|
||||
process(processable)
|
||||
end
|
||||
end
|
||||
|
||||
def reset_ancestor_bridges(processable)
|
||||
processable.pipeline.reset_ancestor_bridges!
|
||||
end
|
||||
|
||||
def process(processable)
|
||||
Gitlab::OptimisticLocking.retry_lock(processable, name: 'ci_requeue_job') do |processable|
|
||||
processable.process(current_user)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -8,6 +8,10 @@ module Ci
|
|||
bridge.tap do |bridge|
|
||||
bridge.user = current_user
|
||||
bridge.enqueue!
|
||||
|
||||
next unless ::Feature.enabled?(:ci_fix_pipeline_status_for_dag_needs_manual, project, default_enabled: :yaml)
|
||||
|
||||
AfterRequeueJobService.new(project, current_user).execute(bridge)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,13 @@ module Ci
|
|||
# Try to enqueue the build, otherwise create a duplicate.
|
||||
#
|
||||
if build.enqueue
|
||||
build.tap { |action| action.update(user: current_user, job_variables_attributes: job_variables_attributes || []) }
|
||||
build.tap do |build|
|
||||
build.update(user: current_user, job_variables_attributes: job_variables_attributes || [])
|
||||
|
||||
next unless ::Feature.enabled?(:ci_fix_pipeline_status_for_dag_needs_manual, project, default_enabled: :yaml)
|
||||
|
||||
AfterRequeueJobService.new(project, current_user).execute(build)
|
||||
end
|
||||
else
|
||||
Ci::Build.retry(build, current_user)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
module Ci
|
||||
class RetryBuildService < ::BaseService
|
||||
include Gitlab::OptimisticLocking
|
||||
|
||||
def self.clone_accessors
|
||||
%i[pipeline project ref tag options name
|
||||
allow_failure stage stage_id stage_idx trigger_request
|
||||
|
|
@ -16,10 +14,8 @@ module Ci
|
|||
build.ensure_scheduling_type!
|
||||
|
||||
reprocess!(build).tap do |new_build|
|
||||
mark_subsequent_stages_as_processable(build)
|
||||
build.pipeline.reset_ancestor_bridges!
|
||||
|
||||
Gitlab::OptimisticLocking.retry_lock(new_build, name: 'retry_build', &:enqueue)
|
||||
AfterRequeueJobService.new(project, current_user).execute(build)
|
||||
|
||||
::MergeRequests::AddTodoWhenBuildFailsService
|
||||
.new(project, current_user)
|
||||
|
|
@ -65,12 +61,6 @@ module Ci
|
|||
end
|
||||
build
|
||||
end
|
||||
|
||||
def mark_subsequent_stages_as_processable(build)
|
||||
build.pipeline.processables.skipped.after_stage(build.stage_idx).find_each do |skipped|
|
||||
retry_optimistic_lock(skipped, name: 'ci_retry_build_mark_subsequent_stages') { |build| build.process(current_user) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Prettify JSON of sample alert payload
|
||||
merge_request: 58433
|
||||
author:
|
||||
type: added
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add aria labels to icon-only buttons
|
||||
merge_request: 58459
|
||||
author:
|
||||
type: fixed
|
||||
|
|
@ -501,72 +501,6 @@ DELETE /projects/:id/approval_rules/:approval_rule_id
|
|||
| `id` | integer | yes | The ID of a project |
|
||||
| `approval_rule_id` | integer | yes | The ID of a approval rule
|
||||
|
||||
### Change allowed approvers
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/183) in GitLab 10.6.
|
||||
> - Moved to GitLab Premium in 13.9.
|
||||
|
||||
NOTE:
|
||||
This API endpoint has been deprecated. Please use Approval Rule API instead.
|
||||
|
||||
If you are allowed to, you can change approvers and approver groups using
|
||||
the following endpoint:
|
||||
|
||||
```plaintext
|
||||
PUT /projects/:id/approvers
|
||||
```
|
||||
|
||||
**Important:** Approvers and groups not in the request are **removed**
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
| -------------------- | ------- | -------- | --------------------------------------------------- |
|
||||
| `id` | integer | yes | The ID of a project |
|
||||
| `approver_ids` | Array | yes | An array of User IDs that can approve MRs |
|
||||
| `approver_group_ids` | Array | yes | An array of Group IDs whose members can approve MRs |
|
||||
|
||||
```json
|
||||
{
|
||||
"approvers": [
|
||||
{
|
||||
"user": {
|
||||
"id": 5,
|
||||
"name": "John Doe6",
|
||||
"username": "user5",
|
||||
"state":"active","avatar_url":"https://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80\u0026d=identicon","web_url":"http://localhost/user5"
|
||||
}
|
||||
}
|
||||
],
|
||||
"approver_groups": [
|
||||
{
|
||||
"group": {
|
||||
"id": 1,
|
||||
"name": "group1",
|
||||
"path": "group1",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"lfs_enabled": false,
|
||||
"avatar_url": null,
|
||||
"web_url": "http://localhost/groups/group1",
|
||||
"request_access_enabled": false,
|
||||
"full_name": "group1",
|
||||
"full_path": "group1",
|
||||
"parent_id": null,
|
||||
"ldap_cn": null,
|
||||
"ldap_access": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"approvals_before_merge": 2,
|
||||
"reset_approvals_on_push": true,
|
||||
"disable_overriding_approvers_per_merge_request": false,
|
||||
"merge_requests_author_approval": true,
|
||||
"merge_requests_disable_committers_approval": false,
|
||||
"require_password_to_approve": true
|
||||
}
|
||||
```
|
||||
|
||||
## External Project-level MR approvals **(ULTIMATE)**
|
||||
|
||||
Configuration for approvals on a specific Merge Request which makes a call to an external HTTP resource.
|
||||
|
|
@ -769,81 +703,6 @@ POST /projects/:id/merge_requests/:merge_request_iid/approvals
|
|||
}
|
||||
```
|
||||
|
||||
### Change allowed approvers for Merge Request
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/183) in GitLab 10.6.
|
||||
> - Moved to GitLab Premium in 13.9.
|
||||
|
||||
NOTE:
|
||||
This API endpoint has been deprecated. Please use Approval Rule API instead.
|
||||
|
||||
If you are allowed to, you can change approvers and approver groups using
|
||||
the following endpoint:
|
||||
|
||||
```plaintext
|
||||
PUT /projects/:id/merge_requests/:merge_request_iid/approvers
|
||||
```
|
||||
|
||||
**Important:** Approvers and groups not in the request are **removed**
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
|----------------------|---------|----------|-----------------------------------------------------------|
|
||||
| `id` | integer | yes | The ID of a project |
|
||||
| `merge_request_iid` | integer | yes | The IID of MR |
|
||||
| `approver_ids` | Array | yes | An array of User IDs that can approve the MR |
|
||||
| `approver_group_ids` | Array | yes | An array of Group IDs whose members can approve the MR |
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 5,
|
||||
"iid": 5,
|
||||
"project_id": 1,
|
||||
"title": "Approvals API",
|
||||
"description": "Test",
|
||||
"state": "opened",
|
||||
"created_at": "2016-06-08T00:19:52.638Z",
|
||||
"updated_at": "2016-06-08T21:20:42.470Z",
|
||||
"merge_status": "cannot_be_merged",
|
||||
"approvals_required": 2,
|
||||
"approvals_left": 2,
|
||||
"approved_by": [],
|
||||
"approvers": [
|
||||
{
|
||||
"user": {
|
||||
"name": "Administrator",
|
||||
"username": "root",
|
||||
"id": 1,
|
||||
"state": "active",
|
||||
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
|
||||
"web_url": "http://localhost:3000/root"
|
||||
}
|
||||
}
|
||||
],
|
||||
"approver_groups": [
|
||||
{
|
||||
"group": {
|
||||
"id": 5,
|
||||
"name": "group1",
|
||||
"path": "group1",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"lfs_enabled": false,
|
||||
"avatar_url": null,
|
||||
"web_url": "http://localhost/groups/group1",
|
||||
"request_access_enabled": false,
|
||||
"full_name": "group1",
|
||||
"full_path": "group1",
|
||||
"parent_id": null,
|
||||
"ldap_cn": null,
|
||||
"ldap_access": null
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Get the approval state of merge requests
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13712) in GitLab 12.3.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1837
locale/bg/gitlab.po
1837
locale/bg/gitlab.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1873
locale/de/gitlab.po
1873
locale/de/gitlab.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1837
locale/eo/gitlab.po
1837
locale/eo/gitlab.po
File diff suppressed because it is too large
Load Diff
1925
locale/es/gitlab.po
1925
locale/es/gitlab.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1853
locale/fr/gitlab.po
1853
locale/fr/gitlab.po
File diff suppressed because it is too large
Load Diff
|
|
@ -10004,6 +10004,9 @@ msgstr ""
|
|||
msgid "Decompressed archive size validation failed."
|
||||
msgstr ""
|
||||
|
||||
msgid "Decrease"
|
||||
msgstr ""
|
||||
|
||||
msgid "Default CI configuration path"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -12627,6 +12630,9 @@ msgstr ""
|
|||
msgid "Expand panel"
|
||||
msgstr ""
|
||||
|
||||
msgid "Expand pipeline"
|
||||
msgstr ""
|
||||
|
||||
msgid "Expand sidebar"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -16569,6 +16575,9 @@ msgstr ""
|
|||
msgid "Incomplete"
|
||||
msgstr ""
|
||||
|
||||
msgid "Increase"
|
||||
msgstr ""
|
||||
|
||||
msgid "Indent"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1837
locale/it/gitlab.po
1837
locale/it/gitlab.po
File diff suppressed because it is too large
Load Diff
1932
locale/ja/gitlab.po
1932
locale/ja/gitlab.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1837
locale/kab/gitlab.po
1837
locale/kab/gitlab.po
File diff suppressed because it is too large
Load Diff
1834
locale/ko/gitlab.po
1834
locale/ko/gitlab.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2059
locale/ru/gitlab.po
2059
locale/ru/gitlab.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1979
locale/uk/gitlab.po
1979
locale/uk/gitlab.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,38 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Ci::AfterRequeueJobService do
|
||||
let_it_be(:project) { create(:project) }
|
||||
let_it_be(:user) { project.owner }
|
||||
|
||||
let(:pipeline) { create(:ci_pipeline, project: project) }
|
||||
|
||||
let!(:build) { create(:ci_build, pipeline: pipeline, stage_idx: 0) }
|
||||
let!(:test1) { create(:ci_build, :success, pipeline: pipeline, stage_idx: 1) }
|
||||
let!(:test2) { create(:ci_build, :skipped, pipeline: pipeline, stage_idx: 1) }
|
||||
|
||||
subject(:execute_service) { described_class.new(project, user).execute(build) }
|
||||
|
||||
it 'marks subsequent skipped jobs as processable' do
|
||||
expect(test1.reload).to be_success
|
||||
expect(test2.reload).to be_skipped
|
||||
|
||||
execute_service
|
||||
|
||||
expect(test1.reload).to be_success
|
||||
expect(test2.reload).to be_created
|
||||
end
|
||||
|
||||
context 'when the pipeline is a downstream pipeline and the bridge is depended' do
|
||||
let!(:trigger_job) { create(:ci_bridge, :strategy_depend, status: 'success') }
|
||||
|
||||
before do
|
||||
create(:ci_sources_pipeline, pipeline: pipeline, source_job: trigger_job)
|
||||
end
|
||||
|
||||
it 'marks source bridge as pending' do
|
||||
expect { execute_service }.to change { trigger_job.reload.status }.from('success').to('pending')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -49,7 +49,13 @@ RSpec.shared_context 'Pipeline Processing Service Tests With Yaml' do
|
|||
statuses = pipeline.latest_statuses.by_name(job_names).to_a
|
||||
expect(statuses.count).to eq(job_names.count) # ensure that we have the same counts
|
||||
|
||||
statuses.each { |status| status.public_send("#{event}!") }
|
||||
statuses.each do |status|
|
||||
if event == 'play'
|
||||
status.play(user)
|
||||
else
|
||||
status.public_send("#{event}!")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,171 @@
|
|||
config:
|
||||
stages: [build, test, review, deploy, post_deploy]
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script: exit 0
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script: exit 0
|
||||
|
||||
release_test1:
|
||||
stage: test
|
||||
when: manual
|
||||
script: exit 0
|
||||
|
||||
release_test2:
|
||||
stage: test
|
||||
when: manual
|
||||
script: exit 0
|
||||
|
||||
review:
|
||||
stage: review
|
||||
script: exit 0
|
||||
needs: [test, release_test1, release_test2]
|
||||
|
||||
staging:
|
||||
stage: deploy
|
||||
script: exit 0
|
||||
needs: [release_test1]
|
||||
|
||||
production:
|
||||
stage: deploy
|
||||
script: exit 0
|
||||
needs: [release_test2]
|
||||
|
||||
after_deploy:
|
||||
stage: post_deploy
|
||||
script: exit 0
|
||||
needs: [production]
|
||||
|
||||
handle_failure:
|
||||
stage: post_deploy
|
||||
when: on_failure
|
||||
script: exit 0
|
||||
|
||||
init:
|
||||
expect:
|
||||
pipeline: pending
|
||||
stages:
|
||||
build: pending
|
||||
test: created
|
||||
review: created
|
||||
deploy: created
|
||||
post_deploy: created
|
||||
jobs:
|
||||
build: pending
|
||||
test: created
|
||||
release_test1: created
|
||||
release_test2: created
|
||||
review: created
|
||||
staging: created
|
||||
production: created
|
||||
after_deploy: created
|
||||
handle_failure: created
|
||||
|
||||
transitions:
|
||||
- event: success
|
||||
jobs: [build]
|
||||
expect:
|
||||
pipeline: running
|
||||
stages:
|
||||
build: success
|
||||
test: pending
|
||||
review: skipped
|
||||
deploy: skipped
|
||||
post_deploy: pending
|
||||
jobs:
|
||||
build: success
|
||||
test: pending
|
||||
release_test1: manual
|
||||
release_test2: manual
|
||||
review: skipped
|
||||
staging: skipped
|
||||
production: skipped
|
||||
after_deploy: skipped
|
||||
handle_failure: created
|
||||
|
||||
- event: success
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: success
|
||||
stages:
|
||||
build: success
|
||||
test: success
|
||||
review: skipped
|
||||
deploy: skipped
|
||||
post_deploy: skipped
|
||||
jobs:
|
||||
build: success
|
||||
test: success
|
||||
release_test1: manual
|
||||
release_test2: manual
|
||||
review: skipped
|
||||
staging: skipped
|
||||
production: skipped
|
||||
after_deploy: skipped
|
||||
handle_failure: skipped
|
||||
|
||||
- event: play
|
||||
jobs: [release_test1]
|
||||
expect:
|
||||
pipeline: running
|
||||
stages:
|
||||
build: success
|
||||
test: running
|
||||
review: skipped
|
||||
deploy: pending
|
||||
post_deploy: pending
|
||||
jobs:
|
||||
build: success
|
||||
test: success
|
||||
release_test1: pending
|
||||
release_test2: manual
|
||||
review: skipped
|
||||
staging: created
|
||||
production: skipped
|
||||
after_deploy: skipped
|
||||
handle_failure: created
|
||||
|
||||
- event: success
|
||||
jobs: [release_test1]
|
||||
expect:
|
||||
pipeline: running
|
||||
stages:
|
||||
build: success
|
||||
test: success
|
||||
review: skipped
|
||||
deploy: pending
|
||||
post_deploy: pending
|
||||
jobs:
|
||||
build: success
|
||||
test: success
|
||||
release_test1: success
|
||||
release_test2: manual
|
||||
review: skipped
|
||||
staging: pending
|
||||
production: skipped
|
||||
after_deploy: skipped
|
||||
handle_failure: created
|
||||
|
||||
- event: success
|
||||
jobs: [staging]
|
||||
expect:
|
||||
pipeline: success
|
||||
stages:
|
||||
build: success
|
||||
test: success
|
||||
review: skipped
|
||||
deploy: success
|
||||
post_deploy: skipped
|
||||
jobs:
|
||||
build: success
|
||||
test: success
|
||||
release_test1: success
|
||||
release_test2: manual
|
||||
review: skipped
|
||||
staging: success
|
||||
production: skipped
|
||||
after_deploy: skipped
|
||||
handle_failure: skipped
|
||||
|
|
@ -21,7 +21,7 @@ init:
|
|||
deploy: created
|
||||
|
||||
transitions:
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ init:
|
|||
deploy: created
|
||||
|
||||
transitions:
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ init:
|
|||
deploy: created
|
||||
|
||||
transitions:
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ init:
|
|||
deploy: skipped
|
||||
|
||||
transitions:
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
|
|
@ -31,7 +31,7 @@ transitions:
|
|||
deploy: skipped
|
||||
jobs:
|
||||
test: pending
|
||||
deploy: skipped
|
||||
deploy: created
|
||||
|
||||
- event: drop
|
||||
jobs: [test]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ init:
|
|||
deploy: skipped
|
||||
|
||||
transitions:
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
|
|
@ -30,7 +30,7 @@ transitions:
|
|||
deploy: skipped
|
||||
jobs:
|
||||
test: pending
|
||||
deploy: skipped
|
||||
deploy: created
|
||||
|
||||
- event: run
|
||||
jobs: [test]
|
||||
|
|
@ -41,15 +41,26 @@ transitions:
|
|||
deploy: skipped
|
||||
jobs:
|
||||
test: running
|
||||
deploy: skipped
|
||||
deploy: created
|
||||
|
||||
- event: drop
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: running
|
||||
stages:
|
||||
test: success
|
||||
deploy: pending
|
||||
jobs:
|
||||
test: failed
|
||||
deploy: pending
|
||||
|
||||
- event: success
|
||||
jobs: [deploy]
|
||||
expect:
|
||||
pipeline: success
|
||||
stages:
|
||||
test: success
|
||||
deploy: skipped
|
||||
deploy: success
|
||||
jobs:
|
||||
test: failed
|
||||
deploy: skipped
|
||||
deploy: success
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
config:
|
||||
test:
|
||||
stage: test
|
||||
when: manual
|
||||
allow_failure: true
|
||||
script: exit 0
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script: exit 0
|
||||
needs: [test]
|
||||
|
||||
init:
|
||||
expect:
|
||||
pipeline: skipped
|
||||
stages:
|
||||
test: skipped
|
||||
deploy: skipped
|
||||
jobs:
|
||||
test: manual
|
||||
deploy: skipped
|
||||
|
||||
transitions:
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
stages:
|
||||
test: pending
|
||||
deploy: skipped
|
||||
jobs:
|
||||
test: pending
|
||||
deploy: created
|
||||
|
||||
- event: run
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: running
|
||||
stages:
|
||||
test: running
|
||||
deploy: skipped
|
||||
jobs:
|
||||
test: running
|
||||
deploy: created
|
||||
|
||||
- event: success
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: running
|
||||
stages:
|
||||
test: success
|
||||
deploy: pending
|
||||
jobs:
|
||||
test: success
|
||||
deploy: pending
|
||||
|
||||
- event: success
|
||||
jobs: [deploy]
|
||||
expect:
|
||||
pipeline: success
|
||||
stages:
|
||||
test: success
|
||||
deploy: success
|
||||
jobs:
|
||||
test: success
|
||||
deploy: success
|
||||
|
|
@ -20,7 +20,7 @@ init:
|
|||
deploy: created
|
||||
|
||||
transitions:
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ transitions:
|
|||
test: manual
|
||||
deploy: success
|
||||
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: running
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ init:
|
|||
deploy: skipped
|
||||
|
||||
transitions:
|
||||
- event: enqueue
|
||||
- event: play
|
||||
jobs: [test]
|
||||
expect:
|
||||
pipeline: pending
|
||||
|
|
@ -30,7 +30,7 @@ transitions:
|
|||
deploy: skipped
|
||||
jobs:
|
||||
test: pending
|
||||
deploy: skipped
|
||||
deploy: created
|
||||
|
||||
- event: drop
|
||||
jobs: [test]
|
||||
|
|
|
|||
|
|
@ -35,6 +35,28 @@ RSpec.describe Ci::PlayBridgeService, '#execute' do
|
|||
expect(bridge.reload.user).to eq(user)
|
||||
end
|
||||
|
||||
context 'when a subsequent job is skipped' do
|
||||
let!(:job) { create(:ci_build, :skipped, pipeline: pipeline, stage_idx: bridge.stage_idx + 1) }
|
||||
|
||||
before do
|
||||
create(:ci_build_need, build: job, name: bridge.name)
|
||||
end
|
||||
|
||||
it 'marks the subsequent job as processable' do
|
||||
expect { execute_service }.to change { job.reload.status }.from('skipped').to('created')
|
||||
end
|
||||
|
||||
context 'when the FF ci_fix_pipeline_status_for_dag_needs_manual is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_fix_pipeline_status_for_dag_needs_manual: false)
|
||||
end
|
||||
|
||||
it 'does not change the subsequent job' do
|
||||
expect { execute_service }.not_to change { job.reload.status }.from('skipped')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when bridge is not playable' do
|
||||
let(:bridge) { create(:ci_bridge, :failed, pipeline: pipeline, downstream: downstream_project) }
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,28 @@ RSpec.describe Ci::PlayBuildService, '#execute' do
|
|||
expect(build.reload.user).to eq user
|
||||
end
|
||||
|
||||
context 'when a subsequent job is skipped' do
|
||||
let!(:job) { create(:ci_build, :skipped, pipeline: pipeline, stage_idx: build.stage_idx + 1) }
|
||||
|
||||
before do
|
||||
create(:ci_build_need, build: job, name: build.name)
|
||||
end
|
||||
|
||||
it 'marks the subsequent job as processable' do
|
||||
expect { service.execute(build) }.to change { job.reload.status }.from('skipped').to('created')
|
||||
end
|
||||
|
||||
context 'when the FF ci_fix_pipeline_status_for_dag_needs_manual is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_fix_pipeline_status_for_dag_needs_manual: false)
|
||||
end
|
||||
|
||||
it 'does not change the subsequent job' do
|
||||
expect { service.execute(build) }.not_to change { job.reload.status }.from('skipped')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when variables are supplied' do
|
||||
let(:job_variables) do
|
||||
[{ key: 'first', secret_value: 'first' },
|
||||
|
|
|
|||
Loading…
Reference in New Issue