Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-19 18:14:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-19 18:14:05 +0300
commitb22f3af733282394aa18261c073adbec117a1d47 (patch)
treeb1fff6ae393a9f4c0a95d2529f374bb538d90b50
parente67f3f55d2b887e13181a37e34275a82fce28b9a (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab/ci/qa.gitlab-ci.yml9
-rw-r--r--app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue3
-rw-r--r--app/graphql/types/merge_request_type.rb6
-rw-r--r--app/models/ci/build.rb33
-rw-r--r--app/models/commit_status.rb7
-rw-r--r--app/models/issue.rb2
-rw-r--r--app/services/alert_management/alerts/update_service.rb31
-rw-r--r--app/services/ci/retry_build_service.rb10
-rw-r--r--app/services/incident_management/issuable_escalation_statuses/after_update_service.rb2
-rw-r--r--app/services/merge_requests/add_todo_when_build_fails_service.rb4
-rw-r--r--app/workers/ci/build_finished_worker.rb2
-rw-r--r--config/feature_flags/development/ci_skip_legacy_extra_minutes_recalculation.yml (renamed from config/feature_flags/development/optimized_issue_neighbor_queries.yml)10
-rw-r--r--config/feature_flags/development/permitted_attributes_for_import_export.yml8
-rw-r--r--data/deprecations/14-5-deprecate-defaultMergeCommitMessageWithDescription-graphql.yml (renamed from data/deprecations/14-5deprecate-defaultMergeCommitMessageWithDescription-graphql.yml)0
-rw-r--r--data/deprecations/14-6-Enforce-validation-of-security-schemas.yml2
-rw-r--r--data/deprecations/14-6-container-scanning-schemas-below-14.yml2
-rw-r--r--data/deprecations/14-6-coverage-fuzzing-schemas-below-14.yml2
-rw-r--r--data/deprecations/14-6-dast-schemas-below-14.yml2
-rw-r--r--data/deprecations/14-6-dependency-scanning-schemas-below-14.yml2
-rw-r--r--data/deprecations/14-6-deprecation-license-compliance-api-terms.yml2
-rw-r--r--data/deprecations/14-6-deprecation-secure-dependency-scanning-bundler-audit.yml2
-rw-r--r--data/deprecations/14-6-sast-schemas-below-14.yml2
-rw-r--r--data/deprecations/14-6-secret-detection-schemas-below-14.yml2
-rw-r--r--data/deprecations/14-7-deprecate-merged_by-api-field.yml1
-rw-r--r--data/deprecations/14-7-sidekiq-metrics-health-check-donfig.yml4
-rw-r--r--db/post_migrate/20220110231420_remove_requirements_management_test_reports_build_id_fk.rb18
-rw-r--r--db/post_migrate/20220112015940_remove_projects_ci_running_builds_fk.rb17
-rw-r--r--db/schema_migrations/202201102314201
-rw-r--r--db/schema_migrations/202201120159401
-rw-r--r--db/structure.sql6
-rw-r--r--doc/api/graphql/reference/index.md20
-rw-r--r--doc/architecture/blueprints/runner_scaling/gitlab-autoscaling-overview.pngbin0 -> 94088 bytes
-rw-r--r--doc/architecture/blueprints/runner_scaling/index.md239
-rw-r--r--doc/development/index.md3
-rw-r--r--doc/development/merge_request_performance_guidelines.md4
-rw-r--r--doc/development/profiling.md14
-rw-r--r--doc/development/service_ping/metrics_instrumentation.md6
-rw-r--r--doc/development/testing_guide/best_practices.md5
-rw-r--r--doc/update/deprecations.md16
-rw-r--r--doc/user/analytics/repository_analytics.md5
-rw-r--r--doc/user/group/img/group_code_coverage_analytics_v13_9.pngbin29915 -> 0 bytes
-rw-r--r--doc/user/group/repositories_analytics/index.md6
-rw-r--r--lib/gitlab/ci/build/status/reason.rb37
-rw-r--r--lib/gitlab/database/gitlab_loose_foreign_keys.yml4
-rw-r--r--lib/gitlab/import_export/base/relation_factory.rb2
-rw-r--r--lib/gitlab/import_export/group/relation_tree_restorer.rb6
-rw-r--r--locale/gitlab.pot18
-rw-r--r--package.json2
-rw-r--r--spec/graphql/types/merge_request_type_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/build/status/reason_spec.rb75
-rw-r--r--spec/models/ci/build_spec.rb55
-rw-r--r--spec/models/ci/running_build_spec.rb5
-rw-r--r--spec/models/commit_status_spec.rb20
-rw-r--r--spec/models/issue_spec.rb26
-rw-r--r--spec/services/alert_management/alerts/update_service_spec.rb53
-rw-r--r--spec/services/incident_management/issuable_escalation_statuses/after_update_service_spec.rb14
-rw-r--r--spec/workers/ci/build_finished_worker_spec.rb15
-rw-r--r--yarn.lock8
58 files changed, 689 insertions, 164 deletions
diff --git a/.gitlab/ci/qa.gitlab-ci.yml b/.gitlab/ci/qa.gitlab-ci.yml
index 4fec223e66d..b12f76f2823 100644
--- a/.gitlab/ci/qa.gitlab-ci.yml
+++ b/.gitlab/ci/qa.gitlab-ci.yml
@@ -33,6 +33,15 @@ qa:selectors:
script:
- bundle exec bin/qa Test::Sanity::Selectors
+qa:auto_quarantine:
+ extends:
+ - .qa-job-base
+ rules:
+ - if: '$QA_TRIGGER_AUTO_QUARANTINE =~ /true|yes|1/i'
+ script:
+ - bundle exec confiner -r .confiner/quarantine.yml
+ allow_failure: true
+
qa:selectors-as-if-foss:
extends:
- qa:selectors
diff --git a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
index 9393ec68586..d5e00f54e91 100644
--- a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
+++ b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
@@ -794,7 +794,6 @@ export default {
</project-setting-row>
<confirm-danger
v-if="isVisibilityReduced"
- button-class="qa-visibility-features-permissions-save-button"
button-variant="confirm"
:disabled="false"
:phrase="confirmationPhrase"
@@ -807,7 +806,7 @@ export default {
type="submit"
variant="confirm"
data-testid="project-features-save-button"
- button-class="qa-visibility-features-permissions-save-button"
+ data-qa-selector="visibility_features_permissions_save_button"
>
{{ $options.i18n.confirmButtonText }}
</gl-button>
diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb
index 5876068adbd..ea05671c79c 100644
--- a/app/graphql/types/merge_request_type.rb
+++ b/app/graphql/types/merge_request_type.rb
@@ -189,6 +189,8 @@ module Types
description: 'Indicates if the merge request has CI.'
field :mergeable, GraphQL::Types::Boolean, null: false, method: :mergeable?, calls_gitaly: true,
description: 'Indicates if the merge request is mergeable.'
+ field :commits, Types::CommitType.connection_type, null: true,
+ calls_gitaly: true, description: 'Merge request commits.'
field :commits_without_merge_commits, Types::CommitType.connection_type, null: true,
calls_gitaly: true, description: 'Merge request commits excluding merge commits.'
field :security_auto_fix, GraphQL::Types::Boolean, null: true,
@@ -265,6 +267,10 @@ module Types
AutoMergeService.new(object.project, current_user).available_strategies(object)
end
+ def commits
+ object.commits.commits
+ end
+
def commits_without_merge_commits
object.commits.without_merge_commits
end
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index dbfe184c048..c4d1a2c740b 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -397,6 +397,10 @@ module Ci
auto_retry.allowed?
end
+ def auto_retry_expected?
+ failed? && auto_retry_allowed?
+ end
+
def detailed_status(current_user)
Gitlab::Ci::Status::Build::Factory
.new(self.present, current_user)
@@ -1069,12 +1073,7 @@ module Ci
end
def drop_with_exit_code!(failure_reason, exit_code)
- ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/348495') do
- transaction do
- conditionally_allow_failure!(exit_code)
- drop!(failure_reason)
- end
- end
+ drop!(::Gitlab::Ci::Build::Status::Reason.new(self, failure_reason, exit_code))
end
def exit_codes_defined?
@@ -1117,6 +1116,13 @@ module Ci
end
end
+ def allowed_to_fail_with_code?(exit_code)
+ options
+ .dig(:allow_failure_criteria, :exit_codes)
+ .to_a
+ .include?(exit_code)
+ end
+
protected
def run_status_commit_hooks!
@@ -1207,21 +1213,6 @@ module Ci
end
end
- def conditionally_allow_failure!(exit_code)
- return unless exit_code
-
- if allowed_to_fail_with_code?(exit_code)
- update_columns(allow_failure: true)
- end
- end
-
- def allowed_to_fail_with_code?(exit_code)
- options
- .dig(:allow_failure_criteria, :exit_codes)
- .to_a
- .include?(exit_code)
- end
-
def cache_for_online_runners(&block)
Rails.cache.fetch(
['has-online-runners', id],
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index d99058260ec..a1002a0c2e8 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -170,8 +170,11 @@ class CommitStatus < Ci::ApplicationRecord
end
before_transition any => :failed do |commit_status, transition|
- failure_reason = transition.args.first
- commit_status.failure_reason = CommitStatus.failure_reasons[failure_reason]
+ reason = ::Gitlab::Ci::Build::Status::Reason
+ .fabricate(commit_status, transition.args.first)
+
+ commit_status.failure_reason = reason.failure_reason_enum
+ commit_status.allow_failure = true if reason.force_allow_failure?
end
before_transition [:skipped, :manual] => :created do |commit_status, transition|
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 6caf6f4b47e..4f2773f4147 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -233,8 +233,6 @@ class Issue < ApplicationRecord
end
def next_object_by_relative_position(ignoring: nil, order: :asc)
- return super unless Feature.enabled?(:optimized_issue_neighbor_queries, project, default_enabled: :yaml)
-
array_mapping_scope = -> (id_expression) do
relation = Issue.where(Issue.arel_table[:project_id].eq(id_expression))
diff --git a/app/services/alert_management/alerts/update_service.rb b/app/services/alert_management/alerts/update_service.rb
index 089715a42fb..7a9bcf2a52d 100644
--- a/app/services/alert_management/alerts/update_service.rb
+++ b/app/services/alert_management/alerts/update_service.rb
@@ -2,7 +2,7 @@
module AlertManagement
module Alerts
- class UpdateService
+ class UpdateService < ::BaseProjectService
include Gitlab::Utils::StrongMemoize
# @param alert [AlertManagement::Alert]
@@ -10,10 +10,10 @@ module AlertManagement
# @param params [Hash] Attributes of the alert
def initialize(alert, current_user, params)
@alert = alert
- @current_user = current_user
- @params = params
@param_errors = []
@status = params.delete(:status)
+
+ super(project: alert.project, current_user: current_user, params: params)
end
def execute
@@ -36,7 +36,7 @@ module AlertManagement
private
- attr_reader :alert, :current_user, :params, :param_errors, :status
+ attr_reader :alert, :param_errors, :status
def allowed?
current_user&.can?(:update_alert_management_alert, alert)
@@ -109,7 +109,7 @@ module AlertManagement
end
def add_assignee_system_note(old_assignees)
- SystemNoteService.change_issuable_assignees(alert, alert.project, current_user, old_assignees)
+ SystemNoteService.change_issuable_assignees(alert, project, current_user, old_assignees)
end
# ------ Status-related behavior -------
@@ -129,6 +129,7 @@ module AlertManagement
def handle_status_change
add_status_change_system_note
resolve_todos if alert.resolved?
+ sync_to_incident if should_sync_to_incident?
end
def add_status_change_system_note
@@ -139,6 +140,22 @@ module AlertManagement
todo_service.resolve_todos_for_target(alert, current_user)
end
+ def sync_to_incident
+ ::Issues::UpdateService.new(
+ project: project,
+ current_user: current_user,
+ params: { escalation_status: { status: status } }
+ ).execute(alert.issue)
+ end
+
+ def should_sync_to_incident?
+ Feature.enabled?(:incident_escalations, project) &&
+ alert.issue &&
+ alert.issue.supports_escalation? &&
+ alert.issue.escalation_status &&
+ alert.issue.escalation_status.status != alert.status
+ end
+
def filter_duplicate
# Only need to check if changing to an open status
return unless params[:status_event] && AlertManagement::Alert.open_status?(status)
@@ -154,7 +171,7 @@ module AlertManagement
def open_alerts
strong_memoize(:open_alerts) do
- AlertManagement::Alert.for_fingerprint(alert.project, alert.fingerprint).open
+ AlertManagement::Alert.for_fingerprint(project, alert.fingerprint).open
end
end
@@ -166,7 +183,7 @@ module AlertManagement
def open_alert_url_params
open_alert = open_alerts.first
- alert_path = Gitlab::Routing.url_helpers.details_project_alert_management_path(alert.project, open_alert)
+ alert_path = Gitlab::Routing.url_helpers.details_project_alert_management_path(project, open_alert)
{
link_start: '<a href="%{url}">'.html_safe % { url: alert_path },
diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb
index 363b336db4c..7e5d5373648 100644
--- a/app/services/ci/retry_build_service.rb
+++ b/app/services/ci/retry_build_service.rb
@@ -25,10 +25,6 @@ module Ci
Gitlab::OptimisticLocking.retry_lock(new_build, name: 'retry_build', &:enqueue)
AfterRequeueJobService.new(project, current_user).execute(build)
-
- ::MergeRequests::AddTodoWhenBuildFailsService
- .new(project: project, current_user: current_user)
- .close(new_build)
end
end
@@ -43,6 +39,12 @@ module Ci
new_build = clone_build(build)
+ new_build.run_after_commit do
+ ::MergeRequests::AddTodoWhenBuildFailsService
+ .new(project: project)
+ .close(new_build)
+ end
+
if create_deployment_in_separate_transaction?
new_build.run_after_commit do |new_build|
::Deployments::CreateForBuildService.new.execute(new_build)
diff --git a/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb b/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb
index 49d7198d7b0..a7a99f88b32 100644
--- a/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb
+++ b/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb
@@ -27,7 +27,7 @@ module IncidentManagement
def sync_to_alert
return unless alert
- return unless escalation_status.status_previously_changed?
+ return if alert.status == escalation_status.status
::AlertManagement::Alerts::UpdateService.new(
alert,
diff --git a/app/services/merge_requests/add_todo_when_build_fails_service.rb b/app/services/merge_requests/add_todo_when_build_fails_service.rb
index d3ef892875b..47cd19e9d8d 100644
--- a/app/services/merge_requests/add_todo_when_build_fails_service.rb
+++ b/app/services/merge_requests/add_todo_when_build_fails_service.rb
@@ -16,9 +16,7 @@ module MergeRequests
# build is retried
#
def close(commit_status)
- pipeline_merge_requests(commit_status.pipeline) do |merge_request|
- todo_service.merge_request_build_retried(merge_request)
- end
+ close_all(commit_status.pipeline)
end
def close_all(pipeline)
diff --git a/app/workers/ci/build_finished_worker.rb b/app/workers/ci/build_finished_worker.rb
index aa12bdb009e..56cfaa7e674 100644
--- a/app/workers/ci/build_finished_worker.rb
+++ b/app/workers/ci/build_finished_worker.rb
@@ -40,7 +40,7 @@ module Ci
BuildHooksWorker.perform_async(build.id)
ChatNotificationWorker.perform_async(build.id) if build.pipeline.chat?
- if build.failed?
+ if build.failed? && !build.auto_retry_expected?
::Ci::MergeRequests::AddTodoWhenBuildFailsWorker.perform_async(build.id)
end
diff --git a/config/feature_flags/development/optimized_issue_neighbor_queries.yml b/config/feature_flags/development/ci_skip_legacy_extra_minutes_recalculation.yml
index db333dace72..2b10b124c54 100644
--- a/config/feature_flags/development/optimized_issue_neighbor_queries.yml
+++ b/config/feature_flags/development/ci_skip_legacy_extra_minutes_recalculation.yml
@@ -1,8 +1,8 @@
---
-name: optimized_issue_neighbor_queries
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76073
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/345921
-milestone: '14.6'
+name: ci_skip_legacy_extra_minutes_recalculation
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/78476
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/341730
+milestone: '14.8'
type: development
-group: group::project management
+group: group::pipeline execution
default_enabled: false
diff --git a/config/feature_flags/development/permitted_attributes_for_import_export.yml b/config/feature_flags/development/permitted_attributes_for_import_export.yml
deleted file mode 100644
index da5168b6ab8..00000000000
--- a/config/feature_flags/development/permitted_attributes_for_import_export.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: permitted_attributes_for_import_export
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70168
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/340789
-milestone: '14.4'
-type: development
-group: group::import
-default_enabled: true
diff --git a/data/deprecations/14-5deprecate-defaultMergeCommitMessageWithDescription-graphql.yml b/data/deprecations/14-5-deprecate-defaultMergeCommitMessageWithDescription-graphql.yml
index 6fb97cbc7f4..6fb97cbc7f4 100644
--- a/data/deprecations/14-5deprecate-defaultMergeCommitMessageWithDescription-graphql.yml
+++ b/data/deprecations/14-5-deprecate-defaultMergeCommitMessageWithDescription-graphql.yml
diff --git a/data/deprecations/14-6-Enforce-validation-of-security-schemas.yml b/data/deprecations/14-6-Enforce-validation-of-security-schemas.yml
index 68ff6f932df..42de723ee99 100644
--- a/data/deprecations/14-6-Enforce-validation-of-security-schemas.yml
+++ b/data/deprecations/14-6-Enforce-validation-of-security-schemas.yml
@@ -2,6 +2,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
[Security report schemas](https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/releases)
versions earlier than 14.0.0 will no longer be supported in GitLab 15.0. Reports that do not pass validation
@@ -23,4 +24,3 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-container-scanning-schemas-below-14.yml b/data/deprecations/14-6-container-scanning-schemas-below-14.yml
index 255b400d217..b79418d5765 100644
--- a/data/deprecations/14-6-container-scanning-schemas-below-14.yml
+++ b/data/deprecations/14-6-container-scanning-schemas-below-14.yml
@@ -2,6 +2,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
[Container scanning report schemas](https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/releases)
versions earlier than 14.0.0 will no longer be supported in GitLab 15.0. Reports that do not pass validation
@@ -20,4 +21,3 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-coverage-fuzzing-schemas-below-14.yml b/data/deprecations/14-6-coverage-fuzzing-schemas-below-14.yml
index 1150c4b3313..13babcc26ba 100644
--- a/data/deprecations/14-6-coverage-fuzzing-schemas-below-14.yml
+++ b/data/deprecations/14-6-coverage-fuzzing-schemas-below-14.yml
@@ -2,6 +2,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
[Coverage guided fuzzing report schemas](https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/releases)
below version 14.0.0 will no longer be supported in GitLab 15.0. Reports that do not pass validation
@@ -23,4 +24,3 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-dast-schemas-below-14.yml b/data/deprecations/14-6-dast-schemas-below-14.yml
index e89e04b0ade..afd27a1fa7a 100644
--- a/data/deprecations/14-6-dast-schemas-below-14.yml
+++ b/data/deprecations/14-6-dast-schemas-below-14.yml
@@ -2,6 +2,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
[DAST report schemas](https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/releases)
versions earlier than 14.0.0 will no longer be supported in GitLab 15.0. Reports that do not pass validation
@@ -23,4 +24,3 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-dependency-scanning-schemas-below-14.yml b/data/deprecations/14-6-dependency-scanning-schemas-below-14.yml
index 8e9f1fc51b4..226cffc3afc 100644
--- a/data/deprecations/14-6-dependency-scanning-schemas-below-14.yml
+++ b/data/deprecations/14-6-dependency-scanning-schemas-below-14.yml
@@ -2,6 +2,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
[Dependency scanning report schemas](https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/releases)
versions earlier than 14.0.0 will no longer be supported in GitLab 15.0. Reports that do not pass validation
@@ -23,4 +24,3 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-deprecation-license-compliance-api-terms.yml b/data/deprecations/14-6-deprecation-license-compliance-api-terms.yml
index c84844c04b1..55c74ddfabd 100644
--- a/data/deprecations/14-6-deprecation-license-compliance-api-terms.yml
+++ b/data/deprecations/14-6-deprecation-license-compliance-api-terms.yml
@@ -14,4 +14,4 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: 2022-05-22 # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
+ removal_date: "2022-05-22" # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-deprecation-secure-dependency-scanning-bundler-audit.yml b/data/deprecations/14-6-deprecation-secure-dependency-scanning-bundler-audit.yml
index d44cd07048a..8cf0ddc49f4 100644
--- a/data/deprecations/14-6-deprecation-secure-dependency-scanning-bundler-audit.yml
+++ b/data/deprecations/14-6-deprecation-secure-dependency-scanning-bundler-audit.yml
@@ -14,4 +14,4 @@
documentation_url: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/analyzers.html # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: 2022-05-22 # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
+ removal_date: "2022-05-22" # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-sast-schemas-below-14.yml b/data/deprecations/14-6-sast-schemas-below-14.yml
index d3276604d93..02e112ec4b8 100644
--- a/data/deprecations/14-6-sast-schemas-below-14.yml
+++ b/data/deprecations/14-6-sast-schemas-below-14.yml
@@ -2,6 +2,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
[SAST report schemas](https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/releases)
versions earlier than 14.0.0 will no longer be supported in GitLab 15.0. Reports that do not pass validation
@@ -23,4 +24,3 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-6-secret-detection-schemas-below-14.yml b/data/deprecations/14-6-secret-detection-schemas-below-14.yml
index 405cbc28529..d366e08a8c0 100644
--- a/data/deprecations/14-6-secret-detection-schemas-below-14.yml
+++ b/data/deprecations/14-6-secret-detection-schemas-below-14.yml
@@ -2,6 +2,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
body: | # Do not modify this line, instead modify the lines below.
[Secret detection report schemas](https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/releases)
versions earlier than 14.0.0 will no longer be supported in GitLab 15.0. Reports that do not pass validation
@@ -23,4 +24,3 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
- removal_date: # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed
diff --git a/data/deprecations/14-7-deprecate-merged_by-api-field.yml b/data/deprecations/14-7-deprecate-merged_by-api-field.yml
index caf56516eaa..31b2d9c9244 100644
--- a/data/deprecations/14-7-deprecate-merged_by-api-field.yml
+++ b/data/deprecations/14-7-deprecate-merged_by-api-field.yml
@@ -14,6 +14,7 @@
announcement_milestone: "14.7" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
+ removal_date: "2022-05-22" # the date of the milestone release when this feature is planned to be removed
breaking_change: false # If this deprecation is a breaking change, set this value to true
body: | # Do not modify this line, instead modify the lines below.
The `merged_by` field in the [merge request API](https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-requests) is being deprecated and will be removed in GitLab 15.0. This field is being replaced with the `merge_user` field (already present in GraphQL) which more correctly identifies who merged a merge request when performing actions (merge when pipeline succeeds, add to merge train) other than a simple merge.
diff --git a/data/deprecations/14-7-sidekiq-metrics-health-check-donfig.yml b/data/deprecations/14-7-sidekiq-metrics-health-check-donfig.yml
index e81c85a820f..34c262b1539 100644
--- a/data/deprecations/14-7-sidekiq-metrics-health-check-donfig.yml
+++ b/data/deprecations/14-7-sidekiq-metrics-health-check-donfig.yml
@@ -1,7 +1,7 @@
- name: "Sidekiq metrics and health checks configuration"
announcement_milestone: "14.7"
announcement_date: "2021-01-22"
- removal_milestone: "15.0"
+ removal_milestone: "15.0"
removal_date: "2022-05-22"
breaking_change: true
body: | # Do not modify this line, instead modify the lines below.
@@ -25,6 +25,6 @@
Only if they are both set and a different port is provided, a separate metrics server will spin up
to serve the Sidekiq metrics, similar to the way Sidekiq will behave in 15.0.
stage: Enablement
- tiers: [Free, Premium, Ultimate]
+ tiers: [Free, Premium, Ultimate]
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/347509
documentation_url: https://docs.gitlab.com/ee/administration/sidekiq.html
diff --git a/db/post_migrate/20220110231420_remove_requirements_management_test_reports_build_id_fk.rb b/db/post_migrate/20220110231420_remove_requirements_management_test_reports_build_id_fk.rb
new file mode 100644
index 00000000000..dd8c6de4aaf
--- /dev/null
+++ b/db/post_migrate/20220110231420_remove_requirements_management_test_reports_build_id_fk.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveRequirementsManagementTestReportsBuildIdFk < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ CONSTRAINT_NAME = 'fk_rails_e67d085910'
+
+ def up
+ with_lock_retries do
+ execute('LOCK ci_builds, requirements_management_test_reports IN ACCESS EXCLUSIVE MODE')
+ remove_foreign_key_if_exists(:requirements_management_test_reports, :ci_builds, name: CONSTRAINT_NAME)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:requirements_management_test_reports, :ci_builds, column: :build_id, on_delete: :nullify, name: CONSTRAINT_NAME)
+ end
+end
diff --git a/db/post_migrate/20220112015940_remove_projects_ci_running_builds_fk.rb b/db/post_migrate/20220112015940_remove_projects_ci_running_builds_fk.rb
new file mode 100644
index 00000000000..79d864e2c2a
--- /dev/null
+++ b/db/post_migrate/20220112015940_remove_projects_ci_running_builds_fk.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveProjectsCiRunningBuildsFk < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ execute('LOCK projects, ci_running_builds IN ACCESS EXCLUSIVE MODE')
+
+ remove_foreign_key_if_exists(:ci_running_builds, :projects, name: "fk_rails_dc1d0801e8")
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:ci_running_builds, :projects, name: "fk_rails_dc1d0801e8", column: :project_id, target_column: :id, on_delete: "cascade")
+ end
+end
diff --git a/db/schema_migrations/20220110231420 b/db/schema_migrations/20220110231420
new file mode 100644
index 00000000000..b46bcdfd802
--- /dev/null
+++ b/db/schema_migrations/20220110231420
@@ -0,0 +1 @@
+768f97a38c0b741f7de99082ce7c8efb1578ac6600c3af4b30019bc987968bc9 \ No newline at end of file
diff --git a/db/schema_migrations/20220112015940 b/db/schema_migrations/20220112015940
new file mode 100644
index 00000000000..0d012793ba0
--- /dev/null
+++ b/db/schema_migrations/20220112015940
@@ -0,0 +1 @@
+e4417c3367115d6adba023e18657d8aecd476b8d1c4227c73e06f97d05af07ad \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 04a978db1a9..b035e62d6ee 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -31338,9 +31338,6 @@ ALTER TABLE ONLY issues_prometheus_alert_events
ALTER TABLE ONLY board_user_preferences
ADD CONSTRAINT fk_rails_dbebdaa8fe FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ci_running_builds
- ADD CONSTRAINT fk_rails_dc1d0801e8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY vulnerability_occurrence_pipelines
ADD CONSTRAINT fk_rails_dc3ae04693 FOREIGN KEY (occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
@@ -31407,9 +31404,6 @@ ALTER TABLE ONLY approval_merge_request_rule_sources
ALTER TABLE ONLY prometheus_alerts
ADD CONSTRAINT fk_rails_e6351447ec FOREIGN KEY (prometheus_metric_id) REFERENCES prometheus_metrics(id) ON DELETE CASCADE;
-ALTER TABLE ONLY requirements_management_test_reports
- ADD CONSTRAINT fk_rails_e67d085910 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE SET NULL;
-
ALTER TABLE ONLY merge_request_metrics
ADD CONSTRAINT fk_rails_e6d7c24d1b FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index 738732f111a..3148fd1a6df 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -4336,6 +4336,25 @@ Input type: `TerraformStateUnlockInput`
| <a id="mutationterraformstateunlockclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationterraformstateunlockerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |
+### `Mutation.timelineEventDestroy`
+
+Input type: `TimelineEventDestroyInput`
+
+#### Arguments
+
+| Name | Type | Description |
+| ---- | ---- | ----------- |
+| <a id="mutationtimelineeventdestroyclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
+| <a id="mutationtimelineeventdestroyid"></a>`id` | [`IncidentManagementTimelineEventID!`](#incidentmanagementtimelineeventid) | Timeline event ID to remove. |
+
+#### Fields
+
+| Name | Type | Description |
+| ---- | ---- | ----------- |
+| <a id="mutationtimelineeventdestroyclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
+| <a id="mutationtimelineeventdestroyerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |
+| <a id="mutationtimelineeventdestroytimelineevent"></a>`timelineEvent` | [`TimelineEventType`](#timelineeventtype) | Timeline event. |
+
### `Mutation.todoCreate`
Input type: `TodoCreateInput`
@@ -11837,6 +11856,7 @@ Maven metadata.
| <a id="mergerequestautomergestrategy"></a>`autoMergeStrategy` | [`String`](#string) | Selected auto merge strategy. |
| <a id="mergerequestavailableautomergestrategies"></a>`availableAutoMergeStrategies` | [`[String!]`](#string) | Array of available auto merge strategies. |
| <a id="mergerequestcommitcount"></a>`commitCount` | [`Int`](#int) | Number of commits in the merge request. |
+| <a id="mergerequestcommits"></a>`commits` | [`CommitConnection`](#commitconnection) | Merge request commits. (see [Connections](#connections)) |
| <a id="mergerequestcommitswithoutmergecommits"></a>`commitsWithoutMergeCommits` | [`CommitConnection`](#commitconnection) | Merge request commits excluding merge commits. (see [Connections](#connections)) |
| <a id="mergerequestconflicts"></a>`conflicts` | [`Boolean!`](#boolean) | Indicates if the merge request has conflicts. |
| <a id="mergerequestcreatedat"></a>`createdAt` | [`Time!`](#time) | Timestamp of when the merge request was created. |
diff --git a/doc/architecture/blueprints/runner_scaling/gitlab-autoscaling-overview.png b/doc/architecture/blueprints/runner_scaling/gitlab-autoscaling-overview.png
new file mode 100644
index 00000000000..c3ba615784f
--- /dev/null
+++ b/doc/architecture/blueprints/runner_scaling/gitlab-autoscaling-overview.png
Binary files differ
diff --git a/doc/architecture/blueprints/runner_scaling/index.md b/doc/architecture/blueprints/runner_scaling/index.md
new file mode 100644
index 00000000000..8e47b5fda8c
--- /dev/null
+++ b/doc/architecture/blueprints/runner_scaling/index.md
@@ -0,0 +1,239 @@
+---
+stage: none
+group: unassigned
+comments: false
+description: 'Next Runner Auto-scaling Architecture'
+---
+
+# Next Runner Auto-scaling Architecture
+
+## Summary
+
+GitLab Runner is a core component of GitLab CI/CD. It makes it possible to run
+CI/CD jobs in a reliable and concurrent environment. It has been initially
+introduced by Kamil Trzciński in early 2015 to replace a Ruby version of the
+same service. GitLab Runner written in Go turned out to be easier to use by the
+wider community, it was more efficient and reliable than the previous,
+Ruby-based, version.
+
+In February 2016 Kamil Trzciński [implemented an auto-scaling feature](https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/53)
+to leverage cloud infrastructure to run many CI/CD jobs in parallel. This
+feature has become a foundation supporting CI/CD adoption on GitLab.com over
+the years, where we now run around 4 million builds per day at peak.
+
+During the initial implementation a decision was made to use Docker Machine:
+
+> Is easy to use. Is well documented. Is well supported and constantly
+> extended. It supports almost any cloud provider or virtualization
+> infrastructure. We need minimal amount of changes to support Docker Machine:
+> machine enumeration and inspection. We don't need to implement any "cloud
+> specific" features.
+
+This design choice was crucial for the GitLab Runner success. Since that time
+the auto-scaling feature has been used by many users and customers and enabled
+rapid growth of CI/CD adoption on GitLab.com.
+
+We can not, however, continue using Docker Machine. Work on that project [was
+paused in July 2018](https://github.com/docker/machine/issues/4537) and there
+was no development made since that time (except for some highly important
+security fixes). In 2018, after Docker Machine entered the “maintenance mode”,
+we decided to create [our own fork](https://gitlab.com/gitlab-org/ci-cd/docker-machine)
+to be able to keep using this and ship fixes and updates needed for our use case.
+[On September 26th, 2021 the project got archived](https://github.com/docker/docker.github.io/commit/2dc8b49dcbe85686cc7230e17aff8e9944cb47a5)
+and the documentation for it has been removed from the official page. This
+means that the original reason to use Docker Machine is no longer valid too.
+
+To keep supporting our customers and the wider community we need to design a
+new mechanism for GitLab Runner autoscaling. It not only needs to support
+auto-scaling, but it also needs to do that in the way to enable us to build on
+top of it to improve efficiency, reliability and availability.
+
+We call this new mechanism the “next GitLab Runner Scaling architecture”.
+
+_Disclaimer The following contain information related to upcoming products,
+features, and functionality._
+
+_It is important to note that the information presented is for informational
+purposes only. Please do not rely on this information for purchasing or
+planning purposes._
+
+_As with all projects, the items mentioned in this document and linked pages are
+subject to change or delay. The development, release and timing of any
+products, features, or functionality remain at the sole discretion of GitLab
+Inc._
+
+## Proposal
+
+Currently, GitLab Runner auto-scaling can be configured in a few ways. Some
+customers are successfully using an auto-scaled environment in Kubernetes. We
+know that a custom and unofficial GitLab Runner version has been built to make
+auto-scaling on Kubernetes more reliable. We recognize the importance of having
+a really good Kubernetes solution for running multiple jobs in parallel, but
+refinements in this area are out of scope for this architectural initiative.
+
+We want to focus on resolving problems with Docker Machine and replacing this
+mechanism with a reliable and flexible mechanism. We might be unable to build a
+drop-in replacement for Docker Machine, as there are presumably many reasons
+why it has been deprecated. It is very difficult to maintain compatibility with
+so many cloud providers, and it seems that Docker Machine has been deprecated
+in favor of Docker Desktop, which is not a viable replacement for us. [This
+issue](https://github.com/docker/roadmap/issues/245) contains a discussion
+about how people are using Docker Machine right now, and it seems that GitLab
+CI is one of the most frequent reasons for people to keep using Docker Machine.
+
+There is also an opportunity in being able to optionally run multiple jobs in a
+single, larger virtual machine. We can’t do that today, but we know that this
+can potentially significantly improve efficiency. We might want to build a new
+architecture that makes it easier and allows us to test how efficient it is
+with PoCs. Running multiple jobs on a single machine can also make it possible
+to reuse what we call a “sticky context” - a space for build artifacts / user
+data that can be shared between job runs.
+
+### 💡 Design a simple abstraction that users will be able to build on top of
+
+Because there is no viable replacement and we might be unable to support all
+cloud providers that Docker Machine used to support, the key design requirement
+is to make it really simple and easy for the wider community to write a custom
+GitLab auto-scaling plugin, whatever cloud provider they might be using. We
+want to design a simple abstraction that users will be able to build on top, as
+will we to support existing workflows on GitLab.com.
+
+The designed mechanism should abstract what Docker Machine executor has been doing:
+providing a way to create an external Docker environment, waiting to execute
+jobs by provisioning this environment and returning credentials required to
+perform these operations.
+
+The new plugin system should be available for all major platforms: Linux,
+Windows, MacOS.
+
+### 💡 Migrate existing Docker Machine solution to a plugin
+
+Once we design and implement the new abstraction, we should be able to migrate
+existing Docker Machine mechanisms to a plugin. This will make it possible for
+users and customers to immediately start using the new architecture, but still
+keep their existing workflows and configuration for Docker Machine. This will
+give everyone time to migrate to the new architecture before we drop support
+for the legacy auto-scaling entirely.
+
+### 💡 Build plugins for AWS, Google Cloud Platform and Azure
+
+Although we might be unable to add support for all the cloud providers that
+Docker Machine used to support, it seems to be important to provide
+GitLab-maintained plugins for the major cloud providers like AWS, Google Cloud
+Platform and Azure.
+
+We should build them, presumably in separate repositories, in a way that they
+are easy to contribute to, fork, modify for certain needs the wider community
+team members might have. It should be also easy to install a new plugin without
+the need of rebuilding GitLab Runner whenever it happens.
+
+### 💡 Write a solid documentation about how to build your own plugin
+
+It is important to show users how to build an auto-scaling plugin, so that they
+can implement support for their own cloud infrastructure.
+
+Building new plugins should be simple, and with the support of great
+documentation it should not require advanced skills, like understanding how
+gRPC works. We want to design the plugin system in a way that the entry barrier
+for contributing new plugins is very low.
+
+### 💡 Build a PoC to run multiple builds on a single machine
+
+We want to better understand what kind of efficiency can running multiple jobs
+on a single machine bring. It is difficult to predict that, so ideally we
+should build a PoC that will help us to better understand what we can expect
+from this.
+
+To run this experiement we most likely we will need to build an experimental
+plugin, that not only allows us to schedule running multiple builds on a single
+machine, but also has a set of comprehensive metrics built into it, to make it
+easier to understand how it performs.
+
+## Details
+
+How the abstraction for the custom provider will look exactly is something that
+we will need to prototype, PoC and decide in a data-informed way. There are a
+few proposals that we should describe in detail, develop requirements for, PoC
+and score. We will choose the solution that seems to support our goals the
+most.
+
+In order to describe the proposals we first need to better explain what part of
+the GitLab Runner needs to be abstracted away. To make this easier to grasp
+these concepts, let's take a look at the current auto-scaling architecture and
+sequence diagram.
+
+![GitLab Runner Autoscaling Overview](gitlab-autoscaling-overview.png)
+
+On the diagrams above we see that currently a GitLab Runner Manager runs on a
+machine that has access to a cloud provider’s API. It is using Docker Machine
+to provision new Virtual Machines with Docker Engine installed and it
+configures the Docker daemon there to allow external authenticated requests. It
+stores credentials to such ephemeral Docker environments on disk. Once a
+machine has been provisioned and made available for GitLab Runner Manager to
+run builds, it is using one of the existing executors to run a user-provided
+script. In auto-scaling, this is typically done using Docker executor.
+
+### Custom provider
+
+In order to reduce the scope of work, we only want to introduce the new
+abstraction layer in one place.
+
+A few years ago we introduced the [Custom Executor](https://docs.gitlab.com/runner/executors/custom.html)
+feature in GitLab Runner. It allows users to design custom build execution
+methods. The custom executor driver can be implemented in any way - from a
+simple shell script to a dedicated binary - that is then used by a Runner
+through os/exec system calls.
+
+Thanks to the custom executor abstraction there is no more need to implement
+new executors internally in Runner. Users who have specific needs can implement
+their own drivers and don’t need to wait for us to make their work part of the
+“official” GitLab Runner. As each driver is a separate project, it also makes
+it easier to create communities around them, where interested people can
+collaborate together on improvements and bug fixes.
+
+We want to design the new Custom Provider to replicate the success of the
+Custom Executor. It will make it easier for users to build their own ways to
+provide a context and an environment in which a build will be executed by one
+of the Custom Executors.
+
+There are multiple solutions to implementing a custom provider abstraction. We
+can use raw Go plugins, Hashcorp’s Go Plugin, HTTP interface or gRPC based
+facade service. There are many solutions, and we want to choose the most
+optimal one. In order to do that, we will describe the solutions in a separate
+document, define requirements and score the solution accordingly. This will
+allow us to choose a solution that will work best for us and the wider
+community.
+
+## Status
+
+Status: RFC.
+
+## Who
+
+Proposal:
+
+<!-- vale gitlab.Spelling = NO -->
+
+| Role | Who
+|------------------------------|------------------------------------------|
+| Authors | Grzegorz Bizon, Tomasz Maczukin |
+| Architecture Evolution Coach | Kamil Trzciński |
+| Engineering Leader | Elliot Rushton, Cheryl Li |
+| Product Manager | Darren Eastman, Jackie Porter |
+| Domain Expert / Runner | Arran Walker |
+
+DRIs:
+
+| Role | Who
+|------------------------------|------------------------|
+| Leadership | Elliot Rushton |
+| Product | Darren Eastman |
+| Engineering | Tomasz Maczukin |
+
+Domain experts:
+
+| Area | Who
+|------------------------------|------------------------|
+| Domain Expert / Runner | Arran Walker |
+
+<!-- vale gitlab.Spelling = YES -->
diff --git a/doc/development/index.md b/doc/development/index.md
index a31bc2d5a6f..197c7f48398 100644
--- a/doc/development/index.md
+++ b/doc/development/index.md
@@ -264,8 +264,7 @@ the [reviewer values](https://about.gitlab.com/handbook/engineering/workflow/rev
- [Caching guidelines](caching.md) for using caching in Rails under a GitLab environment.
- [Merge request performance guidelines](merge_request_performance_guidelines.md)
for ensuring merge requests do not negatively impact GitLab performance
-- [Profiling](profiling.md) a URL, measuring performance using Sherlock, or
- tracking down N+1 queries using Bullet.
+- [Profiling](profiling.md) a URL or tracking down N+1 queries using Bullet.
- [Cached queries guidelines](cached_queries.md), for tracking down N+1 queries
masked by query caching, memory profiling and why should we avoid cached
queries.
diff --git a/doc/development/merge_request_performance_guidelines.md b/doc/development/merge_request_performance_guidelines.md
index 69e9f7d16e3..106db862122 100644
--- a/doc/development/merge_request_performance_guidelines.md
+++ b/doc/development/merge_request_performance_guidelines.md
@@ -13,9 +13,7 @@ _every_ merge request **should** adhere to the guidelines outlined in this
document. There are no exceptions to this rule unless specifically discussed
with and agreed upon by backend maintainers and performance specialists.
-To measure the impact of a merge request you can use
-[Sherlock](profiling.md#sherlock). It's also highly recommended that you read
-the following guides:
+It's also highly recommended that you read the following guides:
- [Performance Guidelines](performance.md)
- [Avoiding downtime in migrations](avoiding_downtime_in_migrations.md)
diff --git a/doc/development/profiling.md b/doc/development/profiling.md
index 656b30402a6..789e0640933 100644
--- a/doc/development/profiling.md
+++ b/doc/development/profiling.md
@@ -108,20 +108,6 @@ Find more information about different sampling modes in the [Stackprof docs](htt
This is enabled for all users that can access the performance bar.
-## Sherlock
-
-Sherlock is a custom profiling tool built into GitLab. Sherlock is _only_
-available when running GitLab in development mode _and_ when setting the
-environment variable `ENABLE_SHERLOCK` to a non empty value. For example:
-
-```shell
-ENABLE_SHERLOCK=1 bundle exec rails s
-```
-
-Sherlock is also [available though the GitLab GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/sherlock.md).
-
-Recorded transactions can be found by navigating to `/sherlock/transactions`.
-
## Bullet
Bullet is a Gem that can be used to track down N+1 query problems. Bullet section is
diff --git a/doc/development/service_ping/metrics_instrumentation.md b/doc/development/service_ping/metrics_instrumentation.md
index 6fdbd1eea31..c98b0df92aa 100644
--- a/doc/development/service_ping/metrics_instrumentation.md
+++ b/doc/development/service_ping/metrics_instrumentation.md
@@ -33,6 +33,12 @@ We have built a domain-specific language (DSL) to define the metrics instrumenta
## Database metrics
+- `operation`: Operations for the given `relation`, one of `count`, `distinct_count`.
+- `relation`: `ActiveRecord::Relation` for the objects we want to perform the `operation`.
+- `start`: Specifies the start value of the batch counting, by default is `relation.minimum(:id)`.
+- `finish`: Specifies the end value of the batch counting, by default is `relation.maximum(:id)`.
+- `cache_start_and_finish_as`: Specifies the cache key for `start` and `finish` values and sets up caching them. Use this call when `start` and `finish` are expensive queries that should be reused between different metric calculations.
+
[Example of a merge request that adds a database metric](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60022).
```ruby
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md
index 0f768a51b66..fe0c4c13ba2 100644
--- a/doc/development/testing_guide/best_practices.md
+++ b/doc/development/testing_guide/best_practices.md
@@ -642,6 +642,11 @@ should either:
It takes around one second to load tests that are using `fast_spec_helper`
instead of 30+ seconds in case of a regular `spec_helper`.
+WARNING:
+To verify that code and its specs are well-isolated from Rails, run the spec
+individually via `bin/rspec`. Don't use `bin/spring rspec` as it loads
+`spec_helper` automatically.
+
### `subject` and `let` variables
The GitLab RSpec suite has made extensive use of `let`(along with its strict, non-lazy
diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md
index 371018896ed..7388f4baf83 100644
--- a/doc/update/deprecations.md
+++ b/doc/update/deprecations.md
@@ -487,7 +487,7 @@ To help with the transition, from GitLab 14.10, non-compliant reports will displ
[warning](https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_672853791)
in the Vulnerability Report.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
### Coverage guided fuzzing schemas below 14.0.0
@@ -505,7 +505,7 @@ To help with the transition, from GitLab 14.10, non-compliant reports will displ
[warning](https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_672853791)
in the Vulnerability Report.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
### DAST schemas below 14.0.0
@@ -523,7 +523,7 @@ To help with the transition, from GitLab 14.10, non-compliant reports will cause
[warning to be displayed](https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_672853791)
in the Vulnerability Report.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
### Dependency scanning schemas below 14.0.0
@@ -541,7 +541,7 @@ To help with the transition, from GitLab 14.10, non-compliant reports will cause
[warning to be displayed](https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_672853791)
in the Vulnerability Report.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
### Enforced validation of security report schemas
@@ -559,7 +559,7 @@ To help with the transition, from GitLab 14.10, non-compliant reports will displ
[warning](https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_672853791)
in the Vulnerability Report.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
### Godep support in License Compliance
@@ -635,7 +635,7 @@ To help with the transition, from GitLab 14.10, non-compliant reports will displ
[warning](https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_672853791)
in the Vulnerability Report.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
### Secret detection schemas below 14.0.0
@@ -653,7 +653,7 @@ To help with the transition, from GitLab 14.10, non-compliant reports will displ
[warning](https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_672853791)
in the Vulnerability Report.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
### Sidekiq metrics and health checks configuration
@@ -701,7 +701,7 @@ Tracing in GitLab is an integration with Jaeger, an open-source end-to-end distr
The `merged_by` field in the [merge request API](https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-requests) is being deprecated and will be removed in GitLab 15.0. This field is being replaced with the `merge_user` field (already present in GraphQL) which more correctly identifies who merged a merge request when performing actions (merge when pipeline succeeds, add to merge train) other than a simple merge.
-**Planned removal milestone: 15.0 ()**
+**Planned removal milestone: 15.0 (2022-05-22)**
## 14.8
diff --git a/doc/user/analytics/repository_analytics.md b/doc/user/analytics/repository_analytics.md
index 42b3e96c340..5fd4a567b58 100644
--- a/doc/user/analytics/repository_analytics.md
+++ b/doc/user/analytics/repository_analytics.md
@@ -4,7 +4,7 @@ group: Optimize
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# Repository analytics **(FREE)**
+# Repository analytics for projects **(FREE)**
Use repository analytics to view information about a project's Git repository:
@@ -35,4 +35,5 @@ To review repository analytics for a project:
## How repository analytics chart data is updated
-Data in the charts are queued. Background workers update the charts 10 minutes after each commit in the default branch. Depending on the size of the GitLab installation, it may take longer for data to refresh due to variations in the size of background job queues.
+Data in the charts are queued. Background workers update the charts 10 minutes after each commit in the default branch.
+Depending on the size of the GitLab installation, it may take longer for data to refresh due to variations in the size of background job queues.
diff --git a/doc/user/group/img/group_code_coverage_analytics_v13_9.png b/doc/user/group/img/group_code_coverage_analytics_v13_9.png
deleted file mode 100644
index 8cd71396381..00000000000
--- a/doc/user/group/img/group_code_coverage_analytics_v13_9.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/group/repositories_analytics/index.md b/doc/user/group/repositories_analytics/index.md
index 763b8eb1ae3..2487ab188e8 100644
--- a/doc/user/group/repositories_analytics/index.md
+++ b/doc/user/group/repositories_analytics/index.md
@@ -9,7 +9,11 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215104) in GitLab 13.4.
-![Group repositories analytics](../img/group_code_coverage_analytics_v13_9.png)
+Repositories analytics for groups provides information about test coverage for all projects in a group. An
+[issue exists](https://gitlab.com/gitlab-org/gitlab/-/issues/273527) to also extend support for all projects in
+subgroups.
+
+It is similar to [repository analytics for projects](../../analytics/repository_analytics.md).
## Current group code coverage
diff --git a/lib/gitlab/ci/build/status/reason.rb b/lib/gitlab/ci/build/status/reason.rb
new file mode 100644
index 00000000000..82e07faef63
--- /dev/null
+++ b/lib/gitlab/ci/build/status/reason.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Build
+ module Status
+ class Reason
+ attr_reader :build, :failure_reason, :exit_code
+
+ def initialize(build, failure_reason, exit_code = nil)
+ @build = build
+ @failure_reason = failure_reason
+ @exit_code = exit_code
+ end
+
+ def failure_reason_enum
+ ::CommitStatus.failure_reasons[failure_reason]
+ end
+
+ def force_allow_failure?
+ return false if exit_code.nil?
+
+ !build.allow_failure? && build.allowed_to_fail_with_code?(exit_code)
+ end
+
+ def self.fabricate(build, reason)
+ if reason.is_a?(self)
+ new(build, reason.failure_reason, reason.exit_code)
+ else
+ new(build, reason)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/database/gitlab_loose_foreign_keys.yml b/lib/gitlab/database/gitlab_loose_foreign_keys.yml
index 2275159da98..93e43073b0a 100644
--- a/lib/gitlab/database/gitlab_loose_foreign_keys.yml
+++ b/lib/gitlab/database/gitlab_loose_foreign_keys.yml
@@ -57,6 +57,10 @@ ci_runner_namespaces:
- table: namespaces
column: namespace_id
on_delete: async_delete
+ci_running_builds:
+ - table: projects
+ column: project_id
+ on_delete: async_delete
ci_namespace_mirrors:
- table: namespaces
column: namespace_id
diff --git a/lib/gitlab/import_export/base/relation_factory.rb b/lib/gitlab/import_export/base/relation_factory.rb
index 6749ef4e276..8a8c74c302d 100644
--- a/lib/gitlab/import_export/base/relation_factory.rb
+++ b/lib/gitlab/import_export/base/relation_factory.rb
@@ -196,7 +196,7 @@ module Gitlab
end
def use_attributes_permitter?
- Feature.enabled?(:permitted_attributes_for_import_export, default_enabled: :yaml)
+ true
end
def existing_or_new_object
diff --git a/lib/gitlab/import_export/group/relation_tree_restorer.rb b/lib/gitlab/import_export/group/relation_tree_restorer.rb
index ef19db70552..c2cbd2fdf47 100644
--- a/lib/gitlab/import_export/group/relation_tree_restorer.rb
+++ b/lib/gitlab/import_export/group/relation_tree_restorer.rb
@@ -118,7 +118,7 @@ module Gitlab
end
def filter_attributes(params)
- if use_attributes_permitter? && attributes_permitter.permitted_attributes_defined?(importable_class_sym)
+ if attributes_permitter.permitted_attributes_defined?(importable_class_sym)
attributes_permitter.permit(importable_class_sym, params)
else
Gitlab::ImportExport::AttributeCleaner.clean(
@@ -132,10 +132,6 @@ module Gitlab
@attributes_permitter ||= Gitlab::ImportExport::AttributesPermitter.new
end
- def use_attributes_permitter?
- Feature.enabled?(:permitted_attributes_for_import_export, default_enabled: :yaml)
- end
-
def present_override_params
# we filter out the empty strings from the overrides
# keeping the default values configured
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 9503fd1c402..0c10c5022f7 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -5370,6 +5370,9 @@ msgstr ""
msgid "Based on"
msgstr ""
+msgid "Basic information"
+msgstr ""
+
msgid "Be careful. Changing the project's namespace can have unintended side effects."
msgstr ""
@@ -8959,6 +8962,9 @@ msgstr ""
msgid "ComplianceReport|Less than 2 approvers"
msgstr ""
+msgid "ComplianceReport|No violations found"
+msgstr ""
+
msgid "Component"
msgstr ""
@@ -23550,9 +23556,6 @@ msgstr ""
msgid "NetworkPolicies|To enable alerts, %{installLinkStart}install an agent%{installLinkEnd} first."
msgstr ""
-msgid "NetworkPolicies|Traffic that does not match any rule will be blocked."
-msgstr ""
-
msgid "NetworkPolicies|all DNS names"
msgstr ""
@@ -30449,7 +30452,7 @@ msgstr ""
msgid "Resync"
msgstr ""
-msgid "Retrieving the compliance report failed. Please refresh the page and try again."
+msgid "Retrieving the compliance report failed. Refresh the page and try again."
msgstr ""
msgid "Retry"
@@ -31681,10 +31684,10 @@ msgstr ""
msgid "SecurityOrchestration|Policy editor"
msgstr ""
-msgid "SecurityOrchestration|Policy preview"
+msgid "SecurityOrchestration|Policy status"
msgstr ""
-msgid "SecurityOrchestration|Policy status"
+msgid "SecurityOrchestration|Policy summary"
msgstr ""
msgid "SecurityOrchestration|Policy type"
@@ -40968,6 +40971,9 @@ msgstr ""
msgid "You have insufficient permissions to create an on-call schedule for this project"
msgstr ""
+msgid "You have insufficient permissions to manage timeline events for this incident"
+msgstr ""
+
msgid "You have insufficient permissions to remove an on-call rotation from this project"
msgstr ""
diff --git a/package.json b/package.json
index 7c7ce52d8b6..94221488036 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,7 @@
"@gitlab/favicon-overlay": "2.0.0",
"@gitlab/svgs": "2.2.0",
"@gitlab/tributejs": "1.0.0",
- "@gitlab/ui": "32.67.0",
+ "@gitlab/ui": "32.68.0",
"@gitlab/visual-review-tools": "1.6.1",
"@rails/actioncable": "6.1.4-1",
"@rails/ujs": "6.1.4-1",
diff --git a/spec/graphql/types/merge_request_type_spec.rb b/spec/graphql/types/merge_request_type_spec.rb
index f2804f4727c..5ab8845246a 100644
--- a/spec/graphql/types/merge_request_type_spec.rb
+++ b/spec/graphql/types/merge_request_type_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
total_time_spent human_time_estimate human_total_time_spent reference author merged_at
commit_count current_user_todos conflicts auto_merge_enabled approved_by source_branch_protected
default_merge_commit_message_with_description squash_on_merge available_auto_merge_strategies
- has_ci mergeable commits_without_merge_commits squash security_auto_fix default_squash_commit_message
+ has_ci mergeable commits commits_without_merge_commits squash security_auto_fix default_squash_commit_message
auto_merge_strategy merge_user
]
diff --git a/spec/lib/gitlab/ci/build/status/reason_spec.rb b/spec/lib/gitlab/ci/build/status/reason_spec.rb
new file mode 100644
index 00000000000..64f35c3f464
--- /dev/null
+++ b/spec/lib/gitlab/ci/build/status/reason_spec.rb
@@ -0,0 +1,75 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Build::Status::Reason do
+ let(:build) { double('build') }
+
+ describe '.fabricate' do
+ context 'when failure symbol reason is being passed' do
+ it 'correctly fabricates a status reason object' do
+ reason = described_class.fabricate(build, :script_failure)
+
+ expect(reason.failure_reason_enum).to eq 1
+ end
+ end
+
+ context 'when another status reason object is being passed' do
+ it 'correctly fabricates a status reason object' do
+ reason = described_class.fabricate(build, :script_failure)
+
+ new_reason = described_class.fabricate(build, reason)
+
+ expect(new_reason.failure_reason_enum).to eq 1
+ end
+ end
+ end
+
+ describe '#failure_reason_enum' do
+ it 'exposes a failure reason enum' do
+ reason = described_class.fabricate(build, :script_failure)
+
+ enum = ::CommitStatus.failure_reasons[:script_failure]
+
+ expect(reason.failure_reason_enum).to eq enum
+ end
+ end
+
+ describe '#force_allow_failure?' do
+ context 'when build is not allowed to fail' do
+ context 'when build is allowed to fail with a given exit code' do
+ it 'returns true' do
+ reason = described_class.new(build, :script_failure, 11)
+
+ allow(build).to receive(:allow_failure?).and_return(false)
+ allow(build).to receive(:allowed_to_fail_with_code?)
+ .with(11)
+ .and_return(true)
+
+ expect(reason.force_allow_failure?).to be true
+ end
+ end
+
+ context 'when build is not allowed to fail regardless of an exit code' do
+ it 'returns false' do
+ reason = described_class.new(build, :script_failure, 11)
+
+ allow(build).to receive(:allow_failure?).and_return(false)
+ allow(build).to receive(:allowed_to_fail_with_code?)
+ .with(11)
+ .and_return(false)
+
+ expect(reason.force_allow_failure?).to be false
+ end
+ end
+
+ context 'when an exit code is not specified' do
+ it 'returns false' do
+ reason = described_class.new(build, :script_failure)
+
+ expect(reason.force_allow_failure?).to be false
+ end
+ end
+ end
+ end
+end
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 9db6fe0279a..b8c5af5a911 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -565,6 +565,26 @@ RSpec.describe Ci::Build do
expect(build.reload.runtime_metadata).not_to be_present
end
end
+
+ context 'when a failure reason is provided' do
+ context 'when a failure reason is a symbol' do
+ it 'correctly sets a failure reason' do
+ build.drop!(:script_failure)
+
+ expect(build.failure_reason).to eq 'script_failure'
+ end
+ end
+
+ context 'when a failure reason is an object' do
+ it 'correctly sets a failure reason' do
+ reason = ::Gitlab::Ci::Build::Status::Reason.new(build, :script_failure)
+
+ build.drop!(reason)
+
+ expect(build.failure_reason).to eq 'script_failure'
+ end
+ end
+ end
end
describe '#schedulable?' do
@@ -2187,6 +2207,28 @@ RSpec.describe Ci::Build do
end
end
+ describe '#auto_retry_expected?' do
+ subject { create(:ci_build, :failed) }
+
+ context 'when build is failed and auto retry is configured' do
+ before do
+ allow(subject)
+ .to receive(:auto_retry_allowed?)
+ .and_return(true)
+ end
+
+ it 'expects auto-retry to happen' do
+ expect(subject.auto_retry_expected?).to be true
+ end
+ end
+
+ context 'when build failed by auto retry is not configured' do
+ it 'does not expect auto-retry to happen' do
+ expect(subject.auto_retry_expected?).to be false
+ end
+ end
+ end
+
describe '#artifacts_file_for_type' do
let(:build) { create(:ci_build, :artifacts) }
let(:file_type) { :archive }
@@ -5279,19 +5321,6 @@ RSpec.describe Ci::Build do
.to change { build.reload.failed? }
end
- it 'is executed inside a transaction' do
- expect(build).to receive(:drop!)
- .with(:unknown_failure)
- .and_raise(ActiveRecord::Rollback)
-
- expect(build).to receive(:conditionally_allow_failure!)
- .with(1)
- .and_call_original
-
- expect { drop_with_exit_code }
- .not_to change { build.reload.allow_failure }
- end
-
context 'when exit_code is nil' do
let(:exit_code) {}
diff --git a/spec/models/ci/running_build_spec.rb b/spec/models/ci/running_build_spec.rb
index 629861e35b8..d2f74494308 100644
--- a/spec/models/ci/running_build_spec.rb
+++ b/spec/models/ci/running_build_spec.rb
@@ -49,4 +49,9 @@ RSpec.describe Ci::RunningBuild do
end
end
end
+
+ it_behaves_like 'cleanup by a loose foreign key' do
+ let!(:parent) { create(:project) }
+ let!(:model) { create(:ci_running_build, project: parent) }
+ end
end
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 7935ea1e6e0..ae4d94ce814 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -773,6 +773,26 @@ RSpec.describe CommitStatus do
expect { commit_status.drop! }.to change { commit_status.status }.from('manual').to('failed')
end
end
+
+ context 'when a failure reason is provided' do
+ context 'when a failure reason is a symbol' do
+ it 'correctly sets a failure reason' do
+ commit_status.drop!(:script_failure)
+
+ expect(commit_status).to be_script_failure
+ end
+ end
+
+ context 'when a failure reason is an object' do
+ it 'correctly sets a failure reason' do
+ reason = ::Gitlab::Ci::Build::Status::Reason.new(commit_status, :script_failure)
+
+ commit_status.drop!(reason)
+
+ expect(commit_status).to be_script_failure
+ end
+ end
+ end
end
describe 'ensure stage assignment' do
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index b49b86dc12a..c105f6c3439 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -1328,28 +1328,10 @@ RSpec.describe Issue do
let_it_be(:issue1) { create(:issue, project: project, relative_position: nil) }
let_it_be(:issue2) { create(:issue, project: project, relative_position: nil) }
- context 'when optimized_issue_neighbor_queries is enabled' do
- before do
- stub_feature_flags(optimized_issue_neighbor_queries: true)
- end
-
- it_behaves_like "a class that supports relative positioning" do
- let_it_be(:project) { reusable_project }
- let(:factory) { :issue }
- let(:default_params) { { project: project } }
- end
- end
-
- context 'when optimized_issue_neighbor_queries is disabled' do
- before do
- stub_feature_flags(optimized_issue_neighbor_queries: false)
- end
-
- it_behaves_like "a class that supports relative positioning" do
- let_it_be(:project) { reusable_project }
- let(:factory) { :issue }
- let(:default_params) { { project: project } }
- end
+ it_behaves_like "a class that supports relative positioning" do
+ let_it_be(:project) { reusable_project }
+ let(:factory) { :issue }
+ let(:default_params) { { project: project } }
end
it 'is not blocked for repositioning by default' do
diff --git a/spec/services/alert_management/alerts/update_service_spec.rb b/spec/services/alert_management/alerts/update_service_spec.rb
index 4b47efca9ed..35697ac79a0 100644
--- a/spec/services/alert_management/alerts/update_service_spec.rb
+++ b/spec/services/alert_management/alerts/update_service_spec.rb
@@ -235,6 +235,59 @@ RSpec.describe AlertManagement::Alerts::UpdateService do
it_behaves_like 'adds a system note'
end
+
+ context 'with an associated issue' do
+ let_it_be(:issue, reload: true) { create(:issue, project: project) }
+
+ before do
+ alert.update!(issue: issue)
+ end
+
+ shared_examples 'does not sync with the incident status' do
+ specify do
+ expect(::Issues::UpdateService).not_to receive(:new)
+ expect { response }.to change { alert.acknowledged? }.to(true)
+ end
+ end
+
+ it_behaves_like 'does not sync with the incident status'
+
+ context 'when the issue is an incident' do
+ before do
+ issue.update!(issue_type: Issue.issue_types[:incident])
+ end
+
+ it_behaves_like 'does not sync with the incident status'
+
+ context 'when the incident has an escalation status' do
+ let_it_be(:escalation_status, reload: true) { create(:incident_management_issuable_escalation_status, issue: issue) }
+
+ it 'updates the incident escalation status with the new alert status' do
+ expect(::Issues::UpdateService).to receive(:new).once.and_call_original
+ expect(described_class).to receive(:new).once.and_call_original
+
+ expect { response }.to change { escalation_status.reload.acknowledged? }.to(true)
+ .and change { alert.reload.acknowledged? }.to(true)
+ end
+
+ context 'when the statuses match' do
+ before do
+ escalation_status.update!(status_event: :acknowledge)
+ end
+
+ it_behaves_like 'does not sync with the incident status'
+ end
+
+ context 'when feature flag is disabled' do
+ before do
+ stub_feature_flags(incident_escalations: false)
+ end
+
+ it_behaves_like 'does not sync with the incident status'
+ end
+ end
+ end
+ end
end
end
end
diff --git a/spec/services/incident_management/issuable_escalation_statuses/after_update_service_spec.rb b/spec/services/incident_management/issuable_escalation_statuses/after_update_service_spec.rb
index 78c93fd4591..e9db6ba8d28 100644
--- a/spec/services/incident_management/issuable_escalation_statuses/after_update_service_spec.rb
+++ b/spec/services/incident_management/issuable_escalation_statuses/after_update_service_spec.rb
@@ -31,14 +31,12 @@ RSpec.describe IncidentManagement::IssuableEscalationStatuses::AfterUpdateServic
end
context 'with status attributes' do
- it 'updates an the associated alert with status changes' do
- expect(::AlertManagement::Alerts::UpdateService)
- .to receive(:new)
- .with(alert, current_user, { status: :acknowledged })
- .and_call_original
+ it 'updates the alert with the new alert status' do
+ expect(::AlertManagement::Alerts::UpdateService).to receive(:new).once.and_call_original
+ expect(described_class).to receive(:new).once.and_call_original
- expect(result).to be_success
- expect(alert.reload.status).to eq(escalation_status.reload.status)
+ expect { result }.to change { escalation_status.reload.acknowledged? }.to(true)
+ .and change { alert.reload.acknowledged? }.to(true)
end
context 'when incident is not associated with an alert' do
@@ -49,7 +47,7 @@ RSpec.describe IncidentManagement::IssuableEscalationStatuses::AfterUpdateServic
it_behaves_like 'does not attempt to update the alert'
end
- context 'when status was not changed' do
+ context 'when new status matches the current status' do
let(:status_event) { :trigger }
it_behaves_like 'does not attempt to update the alert'
diff --git a/spec/workers/ci/build_finished_worker_spec.rb b/spec/workers/ci/build_finished_worker_spec.rb
index 9096b0d2ba9..839723ac2fc 100644
--- a/spec/workers/ci/build_finished_worker_spec.rb
+++ b/spec/workers/ci/build_finished_worker_spec.rb
@@ -50,6 +50,21 @@ RSpec.describe Ci::BuildFinishedWorker do
subject
end
+
+ context 'when a build can be auto-retried' do
+ before do
+ allow(build)
+ .to receive(:auto_retry_allowed?)
+ .and_return(true)
+ end
+
+ it 'does not add a todo' do
+ expect(::Ci::MergeRequests::AddTodoWhenBuildFailsWorker)
+ .not_to receive(:perform_async)
+
+ subject
+ end
+ end
end
context 'when build has a chat' do
diff --git a/yarn.lock b/yarn.lock
index 5071b9a7a93..0917c1690b6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -924,10 +924,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8"
integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw==
-"@gitlab/ui@32.67.0":
- version "32.67.0"
- resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.67.0.tgz#8a6dc9a0aa5fe05855d13251deeb16f6bf07ebd8"
- integrity sha512-7sHVM1aQB+tMxlUCiOq8G0094nWJBhvtwJEeiw+U5+htR5+s5lYuFGPO8UYntjBlNgVSfHuDb5vY5M67W5HvJA==
+"@gitlab/ui@32.68.0":
+ version "32.68.0"
+ resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.68.0.tgz#f7c4ebd2f9b3635db16589b289fdda149ca1cbcc"
+ integrity sha512-rTd0+bNBjPvL1ZMfGEHNoBSZwumu6DMQLBwtPhUaj288nAB4K2xibdhFmsm1yqhnW04VNLyBs9FqKdXRQqFttA==
dependencies:
"@babel/standalone" "^7.0.0"
bootstrap-vue "2.20.1"