Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-11-08 21:10:57 +00:00
parent da576e4a0b
commit 9f9d994f13
31 changed files with 395 additions and 191 deletions

View File

@ -156,7 +156,7 @@ Dangerfile @gl-quality/eng-prod
/app/assets/javascripts/ci/pipeline_schedules/ @gitlab-org/ci-cd/verify/frontend
/app/assets/javascripts/pipeline_editor/ @gitlab-org/ci-cd/verify/frontend
/ee/app/assets/javascripts/ci/ci_minutes_usage/ @gitlab-org/ci-cd/verify/frontend
/ee/app/assets/javascripts/usage_quotas/ci_minutes_usage/ @gitlab-org/ci-cd/verify/frontend
/ee/app/assets/javascripts/ci/usage_quotas/ci_minutes_usage/ @gitlab-org/ci-cd/verify/frontend
/ee/app/assets/javascripts/usage_quotas/pipelines/ @gitlab-org/ci-cd/verify/frontend
/ee/app/assets/javascripts/reports/ @gitlab-org/ci-cd/verify/frontend

View File

@ -208,7 +208,7 @@ ee:instance-parallel-ff-inverse:
QA_KNAPSACK_REPORT_NAME: ee-instance-parallel
GITLAB_QA_OPTS: --set-feature-flags $QA_FEATURE_FLAGS
rules:
- !reference [.rules:test:feature-flags-deleted, rules] # skip job when only change is ff deletion
- !reference [.rules:test:feature-flags-deleted, rules] # skip job when only change is ff deletion
- !reference [.rules:test:feature-flags-set, rules]
# ------------------------------------------
@ -226,7 +226,7 @@ ee:instance-parallel:
- .parallel
- ee:instance
rules:
- !reference [.rules:test:feature-flags-set, rules] # always run instance-parallel to validate ff change
- !reference [.rules:test:feature-flags-set, rules] # always run instance-parallel to validate ff change
- !reference [.rules:test:qa-parallel, rules]
- if: $QA_SUITES =~ /Test::Instance::All/
@ -559,7 +559,7 @@ ee:elasticsearch:
variables:
QA_SCENARIO: "Test::Integration::Elasticsearch"
before_script:
- unset ELASTIC_URL # unset url which is globally defined in .gitlab-ci.yml
- unset ELASTIC_URL # unset url which is globally defined in .gitlab-ci.yml
- !reference [.qa, before_script]
rules:
- !reference [.rules:test:qa, rules]
@ -588,7 +588,7 @@ e2e-test-report:
ALLURE_MERGE_REQUEST_IID: $CI_MERGE_REQUEST_IID
ALLURE_JOB_NAME: e2e-package-and-test
GIT_STRATEGY: none
artifacts: # save rspec results for displaying in parent pipeline
artifacts: # save rspec results for displaying in parent pipeline
expire_in: 1 day
when: always
paths:
@ -658,5 +658,5 @@ notify-slack:
TYPE: "(package-and-test) "
when: on_failure
script:
- bundle exec gitlab-qa-report --prepare-stage-reports "$CI_PROJECT_DIR/gitlab-qa-run-*/**/rspec-*.xml" # generate summary
- bundle exec gitlab-qa-report --prepare-stage-reports "$CI_PROJECT_DIR/gitlab-qa-run-*/**/rspec-*.xml" # generate summary
- !reference [.notify-slack-qa, script]

View File

@ -78,8 +78,8 @@ e2e:package-and-test:
SKIP_MESSAGE: Skipping package-and-test due to mr containing only quarantine changes!
RELEASE: "${REGISTRY_HOST}/${REGISTRY_GROUP}/build/omnibus-gitlab-mirror/gitlab-ee:${CI_COMMIT_SHA}"
GITLAB_QA_IMAGE: "${CI_REGISTRY_IMAGE}/gitlab-ee-qa:${CI_COMMIT_SHA}"
RUN_WITH_BUNDLE: "true" # instructs pipeline to install and run gitlab-qa gem via bundler
QA_PATH: qa # sets the optional path for bundler to run from
RUN_WITH_BUNDLE: "true" # instructs pipeline to install and run gitlab-qa gem via bundler
QA_PATH: qa # sets the optional path for bundler to run from
trigger:
strategy: depend
forward:

View File

@ -91,7 +91,7 @@ review-build-cng:
DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}"
GITLAB_HELM_CHART_REF: "138c146a5ba787942f66d4c7d795d224d6ba206a"
environment:
name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}
on_stop: review-stop
auto_stop_in: 48 hours
@ -172,7 +172,7 @@ review-stop:
extends:
- .review-stop-base
- .review:rules:review-stop
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
stage: deploy
needs: []
script:

View File

@ -146,7 +146,7 @@ e2e-test-report:
GIT_STRATEGY: none
allow_failure: true
when: always
artifacts: # re-save rspec results for displaying in parent pipeline
artifacts: # re-save rspec results for displaying in parent pipeline
expire_in: 1 day
when: always
paths:
@ -189,5 +189,5 @@ notify-slack:
STATUS: failed
TYPE: "(review-app) "
script:
- bundle exec gitlab-qa-report --prepare-stage-reports "$CI_PROJECT_DIR/qa/tmp/rspec-*.xml" # generate summary
- bundle exec gitlab-qa-report --prepare-stage-reports "$CI_PROJECT_DIR/qa/tmp/rspec-*.xml" # generate summary
- !reference [.notify-slack-qa, script]

View File

@ -61,7 +61,7 @@
# always trigger smoke suite if review pipeline got triggered by specific changes in application code
- <<: *app-changes
variables:
QA_TESTS: "" # unset QA_TESTS even if specific tests were inferred from stage label
QA_TESTS: "" # unset QA_TESTS even if specific tests were inferred from stage label
- *qa-run-all-tests
- if: $QA_SUITES =~ /Test::Instance::Smoke/
- *qa-manual
@ -77,7 +77,7 @@
# always trigger blocking suite if review pipeline got triggered by specific changes in application code
- <<: *app-changes
variables:
QA_TESTS: "" # unset QA_TESTS even if specific tests were inferred from stage label
QA_TESTS: "" # unset QA_TESTS even if specific tests were inferred from stage label
- !reference [.never-when-specific-specs-always-when-qa-run-all-tests]
- if: $QA_SUITES =~ /Test::Instance::ReviewBlocking/
@ -88,7 +88,7 @@
.rules:qa-non-blocking-parallel:
rules:
- !reference [.never-when-specific-specs-always-when-qa-run-all-tests]
- *all-specs-mr # set full suite to manual when no specific specs passed in mr
- *all-specs-mr # set full suite to manual when no specific specs passed in mr
- if: $QA_SUITES =~ /Test::Instance::ReviewNonBlocking/
# ------------------------------------------

View File

@ -3,10 +3,10 @@ review-cleanup:
- .default-retry
- .review:rules:review-cleanup
image: ${REVIEW_APPS_IMAGE}
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
stage: prepare
environment:
name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
action: stop
before_script:
- source scripts/utils.sh
@ -23,7 +23,7 @@ review-cleanup:
start-review-app-pipeline:
extends:
- .review:rules:start-review-app-pipeline
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
stage: review
needs:
- job: e2e-test-pipeline-generate

View File

@ -431,7 +431,7 @@ module SearchHelper
def search_navigation
{
projects: { sort: 1, label: _("Projects"), data: { qa_selector: 'projects_tab' }, condition: @project.nil? },
blobs: { sort: 2, label: _("Code"), data: { qa_selector: 'code_tab' }, condition: project_search_tabs?(:blobs) || search_service.show_elasticsearch_tabs? || feature_flag_tab_enabled?(:global_search_code_tab) },
blobs: { sort: 2, label: _("Code"), data: { qa_selector: 'code_tab' }, condition: project_search_tabs?(:blobs) || (search_service.show_elasticsearch_tabs? && feature_flag_tab_enabled?(:global_search_code_tab)) },
# sort: 3 is reserved for EE items
issues: { sort: 4, label: _("Issues"), condition: project_search_tabs?(:issues) || feature_flag_tab_enabled?(:global_search_issues_tab) },
merge_requests: { sort: 5, label: _("Merge requests"), condition: project_search_tabs?(:merge_requests) || feature_flag_tab_enabled?(:global_search_merge_requests_tab) },

View File

@ -16,7 +16,7 @@
%div
= _('No authentication methods configured.')
- if Feature.enabled?(:restyle_login_page, @project)
- if Feature.enabled?(:restyle_login_page, @project) && Gitlab::CurrentSettings.current_application_settings.terms
%p.gl-px-5
= html_escape(s_("SignUp|By signing in you accept the %{link_start}Terms of Use and acknowledge the Privacy Policy and Cookie Policy%{link_end}.")) % { link_start: "<a href='#{terms_path}' target='_blank' rel='noreferrer noopener'>".html_safe,
link_end: '</a>'.html_safe }

View File

@ -2703,6 +2703,15 @@
:weight: 1
:idempotent: true
:tags: []
- :name: merge_requests_delete_branch
:worker_name: MergeRequests::DeleteBranchWorker
:feature_category: :source_code_management
:has_external_dependencies: false
:urgency: :high
:resource_boundary: :unknown
:weight: 1
:idempotent: true
:tags: []
- :name: merge_requests_delete_source_branch
:worker_name: MergeRequests::DeleteSourceBranchWorker
:feature_category: :source_code_management

View File

@ -0,0 +1,32 @@
# frozen_string_literal: true
module MergeRequests
class DeleteBranchWorker
include ApplicationWorker
data_consistency :always
feature_category :source_code_management
urgency :high
idempotent!
def perform(merge_request_id, user_id, branch_name, retarget_branch)
merge_request = MergeRequest.find_by_id(merge_request_id)
user = User.find_by_id(user_id)
return unless merge_request.present? && user.present?
delete_service_result = ::Branches::DeleteService.new(merge_request.source_project, user)
.execute(branch_name)
if Feature.enabled?(:track_delete_source_errors, merge_request.source_project) && delete_service_result&.error?
delete_service_result.track_exception
end
return unless retarget_branch
::MergeRequests::RetargetChainService.new(project: merge_request.source_project, current_user: user)
.execute(merge_request)
end
end
end

View File

@ -18,15 +18,19 @@ class MergeRequests::DeleteSourceBranchWorker
# Source branch changed while it's being removed
return if merge_request.source_branch_sha != source_branch_sha
delete_service_result = ::Branches::DeleteService.new(merge_request.source_project, user)
.execute(merge_request.source_branch)
if Feature.enabled?(:add_delete_branch_worker, merge_request.source_project)
::MergeRequests::DeleteBranchWorker.perform_async(merge_request_id, user_id, merge_request.source_branch, true)
else
delete_service_result = ::Branches::DeleteService.new(merge_request.source_project, user)
.execute(merge_request.source_branch)
if Feature.enabled?(:track_delete_source_errors, merge_request.source_project)
delete_service_result.track_exception if delete_service_result&.error?
if Feature.enabled?(:track_delete_source_errors, merge_request.source_project)
delete_service_result.track_exception if delete_service_result&.error?
end
::MergeRequests::RetargetChainService.new(project: merge_request.source_project, current_user: user)
.execute(merge_request)
end
::MergeRequests::RetargetChainService.new(project: merge_request.source_project, current_user: user)
.execute(merge_request)
rescue ActiveRecord::RecordNotFound
end
end

View File

@ -0,0 +1,8 @@
---
name: add_delete_branch_worker
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/102208
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/381640
milestone: '15.6'
type: development
group: group::code review
default_enabled: false

View File

@ -299,6 +299,8 @@
- 1
- - merge_requests_create_approval_note
- 1
- - merge_requests_delete_branch
- 1
- - merge_requests_delete_source_branch
- 1
- - merge_requests_execute_approval_hooks

View File

@ -24,7 +24,7 @@
removal_date: "2023-05-22" # (required) The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
breaking_change: true # (required) If this deprecation is a breaking change, set this value to true
reporter: jheimbuck_gl # (required) GitLab username of the person reporting the deprecation
stage: Verify # (required) String value of the stage that the feature was created in. e.g., Growth
stage: Verify # (required) String value of the stage that the feature was created in. e.g., Growth
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334253 # (required) Link to the deprecation issue in GitLab
body: | # (required) Do not modify this line, instead modify the lines below.
The `job_age` parameter, returned from the `POST /jobs/request` API endpoint used in communication with GitLab Runner, was never used by any GitLab or Runner feature. This parameter will be removed in GitLab 16.0.

View File

@ -2,7 +2,7 @@
announcement_milestone: "15.3" # (required) The milestone when this feature was first announced as deprecated.
announcement_date: "2022-08-22" # (required) 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: "16.0" # (required) The milestone when this feature is planned to be removed
removal_date: "2023-05-22" # (required) The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_date: "2023-05-22" # (required) The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
breaking_change: true # (required) If this deprecation is a breaking change, set this value to true
reporter: tnir
stage: Enablement

View File

@ -2,11 +2,11 @@
announcement_milestone: "15.4" # (required) The milestone when this feature was first announced as deprecated.
announcement_date: "2022-09-22" # (required) 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: "16.0" # (required) The milestone when this feature is planned to be removed
removal_date: "2022-05-22"# (required) The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_date: "2022-05-22" # (required) The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
breaking_change: true # (required) If this deprecation is a breaking change, set this value to true
reporter: phikai # (required) GitLab username of the person reporting the deprecation
stage: create # (required) String value of the stage that the feature was created in. e.g., Growth
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/365365 # (required) Link to the deprecation issue in GitLab
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/365365 # (required) Link to the deprecation issue in GitLab
body: | # (required) Do not modify this line, instead modify the lines below.
In order to make the behavior of toggling the draft status of a merge request more clear via a quick action, we're deprecating and removing the toggle behavior of the `/draft` quick action. Beginning with the 16.0 release of GitLab, `/draft` will only set a merge request to Draft and a new `/ready` quick action will be used to remove the draft status.
documentation_url: # (optional) This is a link to the current documentation page
documentation_url: # (optional) This is a link to the current documentation page

View File

@ -41,9 +41,9 @@
#
end_of_support_milestone: # (optional) Use "XX.YY" format. The milestone when support for this feature will end.
end_of_support_date: # (optional) The date of the milestone release when support for this feature will end.
#
# OTHER OPTIONAL FIELDS
#
#
# OTHER OPTIONAL FIELDS
#
tiers: # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate]
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

View File

@ -17,7 +17,7 @@
gitlab-com: true
available_in: [Premium, Ultimate]
documentation_link: https://docs.gitlab.com/ee/user/group/saml_sso/group_sync.html
image_url: https://about.gitlab.com/images/15_1/SAML_Group_Sync.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
image_url: https://about.gitlab.com/images/15_1/SAML_Group_Sync.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-06-22
release: 15.1
- name: Enhancing visibility into Value Stream with DORA metrics
@ -28,7 +28,7 @@
gitlab-com: true
available_in: [Free, Premium, Ultimate]
documentation_link: https://docs.gitlab.com/ee/user/analytics/ci_cd_analytics.html
image_url: https://about.gitlab.com/images/15_1/vsa_dora_n_ttrs.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
image_url: https://about.gitlab.com/images/15_1/vsa_dora_n_ttrs.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-06-22
release: 15.1
- name: "SLSA-2 attestation included for build artifacts"

View File

@ -1,4 +1,4 @@
- name: "Live preview diagrams in the wiki WYSIWYG editor" # Match the release post entry
- name: "Live preview diagrams in the wiki WYSIWYG editor" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
GitLab Flavored Markdown includes extensions to support [Mermaid, PlantUML, and Kroki diagrams](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) but writing anything other than the most basic diagrams can be cumbersome without a live preview. You can toggle between the raw source and static preview and there are external tools you can use to write these diagrams, but the shift away from your content can be distracting.
@ -11,8 +11,8 @@
image_url: https://about.gitlab.com/images/15_2/create-preview-diagrams-in-wysiwyg.png
published_at: 2022-07-22
release: 15.2
- name: Incident timeline # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
- name: Incident timeline # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
Capturing what happened during an incident is an important practice that facilitates learning and the opportunity for improvement. Yet, asking incident responders to take on additional administrative tasks when they're busy fire-fighting, or trying to reconstruct the timeline of events post incident lead to incomplete or less than accurate information.
GitLab incident timeline is designed to make information capture during an incident, or post incident, easy and efficient. In the Incident timeline MVC, we make it possible to add new timeline events manually, delete a timeline event, and view the incident timeline in a dedicated tab within an incident issue.
@ -24,8 +24,8 @@
image_url: https://img.youtube.com/vi/a0brUwOajvQ/hqdefault.jpg
published_at: 2022-07-22
release: 15.2
- name: "Merge request reports redesign" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
- name: "Merge request reports redesign" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
Merge request reports are an important part of code review, providing insights into the impact of changes and improvements to meet project standards.
Report widgets now all follow design guidelines for layout, hierarchy, and content sections, making them consistent, scannable, and utilitarian. These improvements make it easier for you to find actionable information in each report.
@ -37,8 +37,8 @@
image_url: https://about.gitlab.com/images/15_2/create-merge-request-widget-redesign.png
published_at: 2022-07-22
release: 15.2
- name: "Change failure rate chart for visualizing software stability" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
- name: "Change failure rate chart for visualizing software stability" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
In this release, we added a new trend chart for the DORA [Change failure rate](https://docs.gitlab.com/ee/user/analytics/ci_cd_analytics.html) metric. This chart shows the percentage of deployments that cause an incident in a production environment. GitLab measures the change failure rate as the number of [incidents](https://docs.gitlab.com/ee/operations/incident_management/incidents.html) divided by the number of deployments to a production environment during a given time period.
This is the fourth DORA chart available in GitLab that provides insights into [value stream velocity and reliability trends](https://about.gitlab.com/blog/2022/06/20/gitlab-value-stream-management-and-dora/).
@ -50,8 +50,8 @@
image_url: https://about.gitlab.com/images/15_2/dora4_chart_cfr.png
published_at: 2022-07-22
release: 15.2
- name: "Enforce IP address restrictions for Git over SSH" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
- name: "Enforce IP address restrictions for Git over SSH" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
Limiting access to requests from a trusted set of IP addresses may improve security. Until now, only the API and UI supported such access restrictions; SSH access was blocked entirely. SSH now also adheres to this restriction, and grants access only to requests coming from IP addresses in your list.
stage: create
self-managed: false
@ -61,8 +61,8 @@
image_url: https://img.youtube.com/vi/f60EgVK3mWc/hqdefault.jpg
published_at: 2022-07-22
release: 15.2
- name: "Group and subgroup scan execution policies" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
- name: "Group and subgroup scan execution policies" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
Your security and compliance teams can now apply policies uniformly to all projects by scanning execution policies at the group and subgroup levels. This functionality is especially helpful for large organizations who have a large number of projects. Policies defined for the group or subgroup will flow down and apply to all child projects. To get started, ask your group owner to link a security policy project to your group on the **Security & Compliance > Policies** page.
Currently scan execution policies are the only policy type that is supported at the group and subgroup levels. You can track the efforts to add group and subgroup level support for scan result policies in [this epic](https://gitlab.com/groups/gitlab-org/-/epics/7622).
@ -74,8 +74,8 @@
image_url: https://about.gitlab.com/images/15_2/protect_group_policies.png
published_at: 2022-07-22
release: 15.2
- name: "Set the image pull policy in pipeline configuration" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
- name: "Set the image pull policy in pipeline configuration" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
You can select different [pull policies](https://docs.gitlab.com/runner/executors/docker.html#how-pull-policies-work) for how a GitLab Runner downloads Docker images in CI/CD jobs. `always` (the default behavior) ensures the image is always downloaded, `if-not-present` downloads an image only when a local version does not exist, and `never` only uses the local version (never download an image).
Previously, you could define the pull policy only at the runner level. In this release we've added the ability to define the pull policy at the pipeline level. Use `pull_policy` in your `.gitlab-ci.yml` to define different pull policies at the job or pipeline level. This feature is not supported by shared runners.

View File

@ -1,19 +1,19 @@
- name: "Suggested Reviewers open beta" # Match the release post entry
- name: "Suggested Reviewers open beta" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
Deciding the right person to [review your merge request](https://docs.gitlab.com/ee/user/project/merge_requests/reviews/) isn't always straightforward or obvious. Choosing the wrong reviewer can cause delays, low quality reviews, back and forth reassigning reviewers, or even no review at all.
Now, GitLab can recommend a reviewer with [Suggested Reviewers](https://docs.gitlab.com/ee/user/project/merge_requests/reviews/#suggested-reviewers). Using the changes in a merge request and a project's contribution graph, machine learning powered suggestions appear in the [reviewer dropdown](https://docs.gitlab.com/ee/user/project/merge_requests/getting_started.html#reviewer) in the merge request sidebar.
This feature is currently in [beta](https://about.gitlab.com/handbook/product/gitlab-the-product/#open-beta) behind a [feature flag](https://gitlab.com/gitlab-org/gitlab/-/issues/368356). It will be rolling out to all Ultimate GitLab.com customers over the next week.
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: false # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/project/merge_requests/reviews/#suggested-reviewers' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-code-review-suggested-reviewers.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Improved CI/CD integration in VS Code" # Match the release post entry
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: false # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/project/merge_requests/reviews/#suggested-reviewers' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-code-review-suggested-reviewers.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Improved CI/CD integration in VS Code" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
When you're constructing complicated GitLab CI configurations that may contain `include:` or `extends:` keywords, it's challenging to ensure the configuration is valid and the resulting file has your expected configuration. Use [GitLab Workflow](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow) for Visual Studio Code to preview your merged GitLab CI/CD configuration file directly in VS Code. You can view your changes locally, and ensure your configuration is as you expect, before you commit and push.
@ -21,28 +21,28 @@
* Download artifacts: [commit `f4d027c`](https://gitlab.com/gitlab-org/gitlab-vscode-extension/commit/f4d027c616c884bef9fc42e5f20dfac43b811134), [merge request `!635`](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/635)
* Retry or cancel an existing pipeline: [commit `c2caee4`](https://gitlab.com/gitlab-org/gitlab-vscode-extension/commit/c2caee40cfcbfb5d13cc790f9a2d1cfcf6c6a7ab), [merge request `!637`](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/637)
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: false # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://gitlab.com/gitlab-org/gitlab-vscode-extension#show-merged-gitlab-cicd-configuration' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-vs-code-cicd-improvements.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Users on verified domains can bypass email validation" # Match the release post entry
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: false # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://gitlab.com/gitlab-org/gitlab-vscode-extension#show-merged-gitlab-cicd-configuration' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-vs-code-cicd-improvements.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Users on verified domains can bypass email validation" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
New GitLab users created using SAML or SCIM that belong to a [verified domain](https://docs.gitlab.com/ee/user/project/pages/custom_domains_ssl_tls_certification/#1-add-a-custom-domain) no longer receive the GitLab account verification e-mail.
This reduces account activation friction. Accounts generated through a provisioning process are already verified, so users should not have to individually verify them manually.
stage: manage # String value of the stage that the feature was created in. e.g., Growth
self-managed: false # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/group/saml_sso/index.html#bypass-user-verification-with-verified-domains' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/domain-verification.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Sortable, filterable data-driven tables in Markdown" # Match the release post entry
stage: manage # String value of the stage that the feature was created in. e.g., Growth
self-managed: false # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/group/saml_sso/index.html#bypass-user-verification-with-verified-domains' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/domain-verification.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Sortable, filterable data-driven tables in Markdown" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
Working with tables in Markdown can be a bit cumbersome. Not only is it difficult to figure out the correct number of pipes and empty cells, but the table output is static when you save your document. If you have to sort the table by the third column in an ascending order, you end up rewriting the whole thing.
@ -58,46 +58,46 @@
- Dynamic filtering of data using `"filter" : true`
Now it's as simple as a click when you have to re-sort that 100-row table and as easy as a web search when you have to find that one issue reference lost in a sea of nearly identical URLs.
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/markdown.html#json' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://img.youtube.com/vi/12yWKw1AdKY/hqdefault.jpg # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Getting started with GitLab Pages just got easier" # Match the release post entry
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/markdown.html#json' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://img.youtube.com/vi/12yWKw1AdKY/hqdefault.jpg # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Getting started with GitLab Pages just got easier" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
We've made it much easier to get started with GitLab Pages. Instead of creating configuration files by hand, build them interactively using the GitLab UI. Just answer a few basic questions on how your app is built, and we'll build the `.gitlab-ci.yml` file to get you started.
This is the first time we're using our new [Pipeline Wizard](https://docs.gitlab.com/ee/development/cicd/pipeline_wizard.html), a tool that makes it easy to create `.gitlab-ci.yml` files by building them in the GitLab UI. You can look forward to more simplified onboarding helpers like this one.
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/project/pages/getting_started/pages_ui.html' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-pages-onboarding.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "More powerful Linux machine types for GitLab SaaS runners" # Match the release post entry
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/user/project/pages/getting_started/pages_ui.html' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-pages-onboarding.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "More powerful Linux machine types for GitLab SaaS runners" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
When you run jobs on GitLab SaaS Linux runners, you now have access to more powerful machine types: medium and large. With these two machine types, you have more choices for your GitLab SaaS CI/CD jobs. And with 100% job isolation on an ephemeral virtual machine, and security and autoscaling fully managed by GitLab, you can confidently run your critical CI/CD jobs on GitLab SaaS.
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: false # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/ci/runners/saas/linux_saas_runner.html' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/select-multiple-gitlab-saas-linux-runners.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Limit the maximum number of custom domains per project" # Match the release post entry
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: false # Boolean value (true or false)
gitlab-com: true # Boolean value (true or false)
available_in: [Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/ci/runners/saas/linux_saas_runner.html' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/select-multiple-gitlab-saas-linux-runners.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
- name: "Limit the maximum number of custom domains per project" # Match the release post entry
description: | # Do not modify this line, instead modify the lines below.
You can use GitLab Pages to define custom domains for your website. Too many custom domains, however, can result in slow response times from the Pages API and impact the overall reliability of the service. Now you can limit the maximum number of custom domains per project at the instance level and strike the right balance for your needs. The default value is `0` (unlimited).
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: false # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/administration/pages/#set-maximum-number-of-gitlab-pages-custom-domains-for-a-project' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-pages-domain-limits.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y
stage: create # String value of the stage that the feature was created in. e.g., Growth
self-managed: true # Boolean value (true or false)
gitlab-com: false # Boolean value (true or false)
available_in: [Free, Premium, Ultimate] # Array of strings. The Array brackets are required here. e.g., [Free, Premium, Ultimate]
documentation_link: 'https://docs.gitlab.com/ee/administration/pages/#set-maximum-number-of-gitlab-pages-custom-domains-for-a-project' # This is the documentation URL, but can be a URL to a video if there is one
image_url: https://about.gitlab.com/images/15_4/create-pages-domain-limits.png # This should be a full URL, generally taken from the release post content. If a video, use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
published_at: 2022-09-22 # YYYY-MM-DD
release: 15.4 # XX.Y

View File

@ -219,6 +219,8 @@ The availability objectives for Gitaly clusters assuming a single node failure a
second. Failover requires ten consecutive failed health checks on each
Praefect node.
Improvements to RPO and RTO are proposed in epic [8903](https://gitlab.com/groups/gitlab-org/-/epics/8903).
WARNING:
If complete cluster failure occurs, disaster recovery plans should be executed. These can affect the
RPO and RTO discussed above.

View File

@ -1028,7 +1028,11 @@ Use **setup** as a noun, and **set up** as a verb. For example:
## sign in
Use **sign in** instead of **sign on** or **log on** or **log in**. If the user interface has different words, use those.
Use **sign in** or **sign in to**.
Do not use **sign on** or **sign into**, or **log on**, **log in**, or **log into**.
If the user interface has different words, use those.
You can use **single sign-on**.

View File

@ -76,6 +76,8 @@ Kubernetes version to a supported version at any time:
GitLab aims to support a new minor Kubernetes version three months after its initial release. GitLab supports at least three production-ready Kubernetes minor
versions at any given time.
When installing the agent, use a Helm version compatible with your Kubernetes version. Other versions of Helm might not work. For a list of compatible versions, see the [Helm version support policy](https://helm.sh/docs/topics/version_skew/).
Support for deprecated APIs can be removed from the GitLab codebase when we drop support for the Kubernetes version that only supports the deprecated API.
Some GitLab features might work on versions not listed here. [This epic](https://gitlab.com/groups/gitlab-org/-/epics/4827) tracks support for Kubernetes versions.

View File

@ -38,7 +38,7 @@ kics-iac-sast:
when: never
- if: $SAST_EXCLUDED_ANALYZERS =~ /kics/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
when: never
- if: $CI_COMMIT_BRANCH # If there's no open merge request, add it to a *branch* pipeline instead.

View File

@ -200,7 +200,7 @@ nodejs-scan-sast:
when: never
- if: $SAST_EXCLUDED_ANALYZERS =~ /nodejs-scan/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
exists:
- '**/package.json'
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
@ -221,7 +221,7 @@ phpcs-security-audit-sast:
when: never
- if: $SAST_EXCLUDED_ANALYZERS =~ /phpcs-security-audit/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
exists:
- '**/*.php'
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
@ -242,7 +242,7 @@ pmd-apex-sast:
when: never
- if: $SAST_EXCLUDED_ANALYZERS =~ /pmd-apex/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
exists:
- '**/*.cls'
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
@ -263,7 +263,7 @@ security-code-scan-sast:
when: never
- if: $SAST_EXCLUDED_ANALYZERS =~ /security-code-scan/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
exists:
- '**/*.csproj'
- '**/*.vbproj'
@ -287,7 +287,7 @@ semgrep-sast:
when: never
- if: $SAST_EXCLUDED_ANALYZERS =~ /semgrep/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
exists:
- '**/*.py'
- '**/*.js'
@ -326,7 +326,7 @@ sobelow-sast:
when: never
- if: $SAST_EXCLUDED_ANALYZERS =~ /sobelow/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
exists:
- 'mix.exs'
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
@ -351,7 +351,7 @@ spotbugs-sast:
when: never
- if: $SAST_DISABLED
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
exists:
- '**/*.groovy'
- '**/*.scala'

View File

@ -29,7 +29,7 @@ secret_detection:
rules:
- if: $SECRET_DETECTION_DISABLED
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request.
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
when: never
- if: $CI_COMMIT_BRANCH # If there's no open merge request, add it to a *branch* pipeline instead.

View File

@ -60,7 +60,7 @@ function update_tests_metadata() {
scripts/flaky_examples/prune-old-flaky-examples "${FLAKY_RSPEC_SUITE_REPORT_PATH}"
if [[ "$CI_PIPELINE_SOURCE" == "schedule" ]]; then
scripts/insert-rspec-profiling-data
PGSSLMODE=$RSPEC_PROFILING_PGSSLMODE PGSSLROOTCERT=$RSPEC_PROFILING_PGSSLROOTCERT PGSSLCERT=$RSPEC_PROFILING_PGSSLCERT PGSSLKEY=$RSPEC_PROFILING_PGSSLKEY scripts/insert-rspec-profiling-data
else
echo "Not inserting profiling data as the pipeline is not a scheduled one."
fi

View File

@ -861,8 +861,8 @@ RSpec.describe SearchHelper do
where(:feature_flag_tab_enabled, :show_elasticsearch_tabs, :project_search_tabs, :condition) do
false | false | false | false
true | true | true | true
true | false | false | true
false | true | false | true
true | false | false | false
false | true | false | false
false | false | true | true
true | false | true | true
end

View File

@ -0,0 +1,95 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe MergeRequests::DeleteBranchWorker do
let_it_be(:merge_request) { create(:merge_request) }
let_it_be(:user) { create(:user) }
let(:branch) { merge_request.source_branch }
let(:sha) { merge_request.source_branch_sha }
let(:retarget_branch) { true }
let(:worker) { described_class.new }
describe '#perform' do
context 'with a non-existing merge request' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
worker.perform(non_existing_record_id, user.id, branch, retarget_branch)
end
end
context 'with a non-existing user' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
worker.perform(merge_request.id, non_existing_record_id, branch, retarget_branch)
end
end
context 'with existing user and merge request' do
it 'calls service to delete source branch' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(branch)
end
worker.perform(merge_request.id, user.id, branch, retarget_branch)
end
context 'when retarget branch param is true' do
it 'calls the retarget chain service' do
expect_next_instance_of(::MergeRequests::RetargetChainService) do |instance|
expect(instance).to receive(:execute).with(merge_request)
end
worker.perform(merge_request.id, user.id, branch, retarget_branch)
end
end
context 'when retarget branch param is false' do
let(:retarget_branch) { false }
it 'does not call the retarget chain service' do
expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(merge_request.id, user.id, branch, retarget_branch)
end
end
context 'when delete service returns an error' do
let(:service_result) { ServiceResponse.error(message: 'placeholder') }
it 'tracks the exception' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
end
expect(service_result).to receive(:track_exception).and_call_original
worker.perform(merge_request.id, user.id, branch, retarget_branch)
end
context 'when track_delete_source_errors is disabled' do
before do
stub_feature_flags(track_delete_source_errors: false)
end
it 'does not track the exception' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
end
expect(service_result).not_to receive(:track_exception)
worker.perform(merge_request.id, user.id, branch, retarget_branch)
end
end
end
end
it_behaves_like 'an idempotent worker' do
let(:merge_request) { create(:merge_request) }
let(:job_args) { [merge_request.id, sha, user.id, true] }
end
end
end

View File

@ -10,96 +10,142 @@ RSpec.describe MergeRequests::DeleteSourceBranchWorker do
let(:worker) { described_class.new }
describe '#perform' do
context 'with a non-existing merge request' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(non_existing_record_id, sha, user.id)
end
end
context 'with a non-existing user' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(merge_request.id, sha, non_existing_record_id)
end
end
context 'with existing user and merge request' do
it 'calls service to delete source branch' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch)
end
worker.perform(merge_request.id, sha, user.id)
end
it 'calls service to try retarget merge requests' do
expect_next_instance_of(::MergeRequests::RetargetChainService) do |instance|
expect(instance).to receive(:execute).with(merge_request)
end
worker.perform(merge_request.id, sha, user.id)
end
context 'source branch sha does not match' do
context 'when the add_delete_branch_worker feature flag is enabled' do
context 'with a non-existing merge request' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
expect(::MergeRequests::RetargetChainService).not_to receive(:new)
expect(::MergeRequests::DeleteBranchWorker).not_to receive(:perform_async)
worker.perform(merge_request.id, 'new-source-branch-sha', user.id)
worker.perform(non_existing_record_id, sha, user.id)
end
end
context 'when delete service returns an error' do
let(:service_result) { ServiceResponse.error(message: 'placeholder') }
context 'with a non-existing user' do
it 'does nothing' do
expect(::MergeRequests::DeleteBranchWorker).not_to receive(:perform_async)
it 'tracks the exception' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
end
worker.perform(merge_request.id, sha, non_existing_record_id)
end
end
expect(service_result).to receive(:track_exception).and_call_original
context 'with existing user and merge request' do
it 'creates a new delete branch worker async' do
expect(::MergeRequests::DeleteBranchWorker).to receive(:perform_async).with(merge_request.id, user.id,
merge_request.source_branch, true)
worker.perform(merge_request.id, sha, user.id)
end
context 'when track_delete_source_errors is disabled' do
before do
stub_feature_flags(track_delete_source_errors: false)
end
context 'source branch sha does not match' do
it 'does nothing' do
expect(::MergeRequests::DeleteBranchWorker).not_to receive(:perform_async)
it 'does not track the exception' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
end
expect(service_result).not_to receive(:track_exception)
worker.perform(merge_request.id, sha, user.id)
worker.perform(merge_request.id, 'new-source-branch-sha', user.id)
end
end
end
it 'still retargets the merge request' do
it_behaves_like 'an idempotent worker' do
let(:merge_request) { create(:merge_request) }
let(:job_args) { [merge_request.id, sha, user.id] }
end
end
context 'when the add_delete_branch_worker feature flag is disabled' do
before do
stub_feature_flags(add_delete_branch_worker: false)
end
context 'with a non-existing merge request' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(non_existing_record_id, sha, user.id)
end
end
context 'with a non-existing user' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(merge_request.id, sha, non_existing_record_id)
end
end
context 'with existing user and merge request' do
it 'calls service to delete source branch' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
expect(instance).to receive(:execute).with(merge_request.source_branch)
end
worker.perform(merge_request.id, sha, user.id)
end
it 'calls service to try retarget merge requests' do
expect_next_instance_of(::MergeRequests::RetargetChainService) do |instance|
expect(instance).to receive(:execute).with(merge_request)
end
worker.perform(merge_request.id, sha, user.id)
end
end
end
it_behaves_like 'an idempotent worker' do
let(:merge_request) { create(:merge_request) }
let(:job_args) { [merge_request.id, sha, user.id] }
context 'source branch sha does not match' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(merge_request.id, 'new-source-branch-sha', user.id)
end
end
context 'when delete service returns an error' do
let(:service_result) { ServiceResponse.error(message: 'placeholder') }
it 'tracks the exception' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
end
expect(service_result).to receive(:track_exception).and_call_original
worker.perform(merge_request.id, sha, user.id)
end
context 'when track_delete_source_errors is disabled' do
before do
stub_feature_flags(track_delete_source_errors: false)
end
it 'does not track the exception' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
end
expect(service_result).not_to receive(:track_exception)
worker.perform(merge_request.id, sha, user.id)
end
end
it 'still retargets the merge request' do
expect_next_instance_of(::Branches::DeleteService) do |instance|
expect(instance).to receive(:execute).with(merge_request.source_branch).and_return(service_result)
end
expect_next_instance_of(::MergeRequests::RetargetChainService) do |instance|
expect(instance).to receive(:execute).with(merge_request)
end
worker.perform(merge_request.id, sha, user.id)
end
end
end
it_behaves_like 'an idempotent worker' do
let(:merge_request) { create(:merge_request) }
let(:job_args) { [merge_request.id, sha, user.id] }
end
end
end
end