summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-08 06:13:27 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-08 06:13:27 +0000
commit99bcbec56c2f7f8cc3028974ad1d6edcb16a9281 (patch)
tree352560a31119dc737993cce71ed8f5a8f24c698f /app
parent849d5912a8742c628df825043807ad891431cca1 (diff)
downloadgitlab-ce-99bcbec56c2f7f8cc3028974ad1d6edcb16a9281.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/boards/components/board_filtered_search.vue36
-rw-r--r--app/assets/javascripts/boards/components/issue_board_filtered_search.vue10
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/models/commit_status.rb2
-rw-r--r--app/models/concerns/enums/ci/commit_status.rb1
-rw-r--r--app/models/concerns/import_state/sidekiq_job_tracker.rb2
-rw-r--r--app/models/deployment.rb12
-rw-r--r--app/models/environment.rb2
-rw-r--r--app/presenters/commit_status_presenter.rb3
9 files changed, 40 insertions, 30 deletions
diff --git a/app/assets/javascripts/boards/components/board_filtered_search.vue b/app/assets/javascripts/boards/components/board_filtered_search.vue
index 3da50c89fc7..8eaa6eccd8d 100644
--- a/app/assets/javascripts/boards/components/board_filtered_search.vue
+++ b/app/assets/javascripts/boards/components/board_filtered_search.vue
@@ -50,21 +50,21 @@ export default {
if (authorUsername) {
filteredSearchValue.push({
- type: 'author_username',
+ type: 'author',
value: { data: authorUsername, operator: '=' },
});
}
if (assigneeUsername) {
filteredSearchValue.push({
- type: 'assignee_username',
+ type: 'assignee',
value: { data: assigneeUsername, operator: '=' },
});
}
if (types) {
filteredSearchValue.push({
- type: 'types',
+ type: 'type',
value: { data: types, operator: '=' },
});
}
@@ -72,7 +72,7 @@ export default {
if (labelName?.length) {
filteredSearchValue.push(
...labelName.map((label) => ({
- type: 'label_name',
+ type: 'label',
value: { data: label, operator: '=' },
})),
);
@@ -101,7 +101,7 @@ export default {
if (myReactionEmoji) {
filteredSearchValue.push({
- type: 'my_reaction_emoji',
+ type: 'my-reaction',
value: { data: myReactionEmoji, operator: '=' },
});
}
@@ -115,14 +115,14 @@ export default {
if (epicId) {
filteredSearchValue.push({
- type: 'epic_id',
+ type: 'epic',
value: { data: epicId, operator: '=' },
});
}
if (this.filterParams['not[authorUsername]']) {
filteredSearchValue.push({
- type: 'author_username',
+ type: 'author',
value: { data: this.filterParams['not[authorUsername]'], operator: '!=' },
});
}
@@ -150,7 +150,7 @@ export default {
if (this.filterParams['not[assigneeUsername]']) {
filteredSearchValue.push({
- type: 'assignee_username',
+ type: 'assignee',
value: { data: this.filterParams['not[assigneeUsername]'], operator: '!=' },
});
}
@@ -158,7 +158,7 @@ export default {
if (this.filterParams['not[labelName]']) {
filteredSearchValue.push(
...this.filterParams['not[labelName]'].map((label) => ({
- type: 'label_name',
+ type: 'label',
value: { data: label, operator: '!=' },
})),
);
@@ -166,21 +166,21 @@ export default {
if (this.filterParams['not[types]']) {
filteredSearchValue.push({
- type: 'types',
+ type: 'type',
value: { data: this.filterParams['not[types]'], operator: '!=' },
});
}
if (this.filterParams['not[epicId]']) {
filteredSearchValue.push({
- type: 'epic_id',
+ type: 'epic',
value: { data: this.filterParams['not[epicId]'], operator: '!=' },
});
}
if (this.filterParams['not[myReactionEmoji]']) {
filteredSearchValue.push({
- type: 'my_reaction_emoji',
+ type: 'my-reaction',
value: { data: this.filterParams['not[myReactionEmoji]'], operator: '!=' },
});
}
@@ -281,16 +281,16 @@ export default {
filters.forEach((filter) => {
switch (filter.type) {
- case 'author_username':
+ case 'author':
filterParams.authorUsername = filter.value.data;
break;
- case 'assignee_username':
+ case 'assignee':
filterParams.assigneeUsername = filter.value.data;
break;
- case 'types':
+ case 'type':
filterParams.types = filter.value.data;
break;
- case 'label_name':
+ case 'label':
labels.push(filter.value.data);
break;
case 'milestone':
@@ -302,10 +302,10 @@ export default {
case 'weight':
filterParams.weight = filter.value.data;
break;
- case 'epic_id':
+ case 'epic':
filterParams.epicId = filter.value.data;
break;
- case 'my_reaction_emoji':
+ case 'my-reaction':
filterParams.myReactionEmoji = filter.value.data;
break;
case 'release':
diff --git a/app/assets/javascripts/boards/components/issue_board_filtered_search.vue b/app/assets/javascripts/boards/components/issue_board_filtered_search.vue
index 6e786932ca8..da7c21192d6 100644
--- a/app/assets/javascripts/boards/components/issue_board_filtered_search.vue
+++ b/app/assets/javascripts/boards/components/issue_board_filtered_search.vue
@@ -80,7 +80,7 @@ export default {
{
icon: 'user',
title: assignee,
- type: 'assignee_username',
+ type: 'assignee',
operators: OPERATOR_IS_AND_IS_NOT,
token: AuthorToken,
unique: true,
@@ -90,7 +90,7 @@ export default {
{
icon: 'pencil',
title: author,
- type: 'author_username',
+ type: 'author',
operators: OPERATOR_IS_AND_IS_NOT,
symbol: '@',
token: AuthorToken,
@@ -101,7 +101,7 @@ export default {
{
icon: 'labels',
title: label,
- type: 'label_name',
+ type: 'label',
operators: OPERATOR_IS_AND_IS_NOT,
token: LabelToken,
unique: false,
@@ -111,7 +111,7 @@ export default {
...(this.isSignedIn
? [
{
- type: 'my_reaction_emoji',
+ type: 'my-reaction',
title: TOKEN_TITLE_MY_REACTION,
icon: 'thumb-up',
token: EmojiToken,
@@ -146,7 +146,7 @@ export default {
{
icon: 'issues',
title: type,
- type: 'types',
+ type: 'type',
token: GlFilteredSearchToken,
unique: true,
options: [
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 5e689862431..54967910f4d 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -452,7 +452,7 @@ module Ci
end
def retryable?
- return false if retried? || archived?
+ return false if retried? || archived? || deployment_rejected?
success? || failed? || canceled?
end
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 9054a25fdb5..d6a2f62ca9b 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -146,7 +146,7 @@ class CommitStatus < Ci::ApplicationRecord
end
event :drop do
- transition [:created, :waiting_for_resource, :preparing, :pending, :running, :scheduled] => :failed
+ transition [:created, :waiting_for_resource, :preparing, :pending, :running, :manual, :scheduled] => :failed
end
event :success do
diff --git a/app/models/concerns/enums/ci/commit_status.rb b/app/models/concerns/enums/ci/commit_status.rb
index 1b4cc14f4a2..312b88a4d6d 100644
--- a/app/models/concerns/enums/ci/commit_status.rb
+++ b/app/models/concerns/enums/ci/commit_status.rb
@@ -28,6 +28,7 @@ module Enums
trace_size_exceeded: 19,
builds_disabled: 20,
environment_creation_failure: 21,
+ deployment_rejected: 22,
insufficient_bridge_permissions: 1_001,
downstream_bridge_project_not_found: 1_002,
invalid_bridge_trigger: 1_003,
diff --git a/app/models/concerns/import_state/sidekiq_job_tracker.rb b/app/models/concerns/import_state/sidekiq_job_tracker.rb
index b7d0ed0f51b..340bf4279bc 100644
--- a/app/models/concerns/import_state/sidekiq_job_tracker.rb
+++ b/app/models/concerns/import_state/sidekiq_job_tracker.rb
@@ -15,7 +15,7 @@ module ImportState
def refresh_jid_expiration
return unless jid
- Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
+ Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION, value: 2)
end
def self.jid_by(project_id:, status:)
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index bad3a41af2d..4c60ce57f49 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -46,9 +46,10 @@ class Deployment < ApplicationRecord
scope :for_project, -> (project_id) { where(project_id: project_id) }
scope :for_projects, -> (projects) { where(project: projects) }
- scope :visible, -> { where(status: %i[running success failed canceled]) }
+ scope :visible, -> { where(status: %i[running success failed canceled blocked]) }
scope :stoppable, -> { where.not(on_stop: nil).where.not(deployable_id: nil).success }
scope :active, -> { where(status: %i[created running]) }
+ scope :upcoming, -> { where(status: %i[blocked running]) }
scope :older_than, -> (deployment) { where('deployments.id < ?', deployment.id) }
scope :with_api_entity_associations, -> { preload({ deployable: { runner: [], tags: [], user: [], job_artifacts_archive: [] } }) }
@@ -64,6 +65,10 @@ class Deployment < ApplicationRecord
transition created: :running
end
+ event :block do
+ transition created: :blocked
+ end
+
event :succeed do
transition any - [:success] => :success
end
@@ -140,7 +145,8 @@ class Deployment < ApplicationRecord
success: 2,
failed: 3,
canceled: 4,
- skipped: 5
+ skipped: 5,
+ blocked: 6
}
def self.archivables_in(project, limit:)
@@ -391,6 +397,8 @@ class Deployment < ApplicationRecord
cancel!
when 'skipped'
skip!
+ when 'blocked'
+ block!
else
raise ArgumentError, "The status #{status.inspect} is invalid"
end
diff --git a/app/models/environment.rb b/app/models/environment.rb
index f51c9fab8dd..ca1a842d1bd 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -31,7 +31,7 @@ class Environment < ApplicationRecord
has_one :last_visible_deployable, through: :last_visible_deployment, source: 'deployable', source_type: 'CommitStatus', disable_joins: true
has_one :last_visible_pipeline, through: :last_visible_deployable, source: 'pipeline', disable_joins: true
- has_one :upcoming_deployment, -> { running.distinct_on_environment }, class_name: 'Deployment', inverse_of: :environment
+ has_one :upcoming_deployment, -> { upcoming.distinct_on_environment }, class_name: 'Deployment', inverse_of: :environment
has_one :latest_opened_most_severe_alert, -> { order_severity_with_open_prometheus_alert }, class_name: 'AlertManagement::Alert', inverse_of: :environment
before_validation :generate_slug, if: ->(env) { env.slug.blank? }
diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb
index 7919e501bf0..250715d7c9c 100644
--- a/app/presenters/commit_status_presenter.rb
+++ b/app/presenters/commit_status_presenter.rb
@@ -29,7 +29,8 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
no_matching_runner: 'No matching runner available',
trace_size_exceeded: 'The job log size limit was reached',
builds_disabled: 'The CI/CD is disabled for this project',
- environment_creation_failure: 'This job could not be executed because it would create an environment with an invalid parameter.'
+ environment_creation_failure: 'This job could not be executed because it would create an environment with an invalid parameter.',
+ deployment_rejected: 'This deployment job was rejected.'
}.freeze
TROUBLESHOOTING_DOC = {