summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-27 09:10:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-27 09:10:46 +0000
commit359bc6940b1205035e14f028b75d0c9c80a1fd5e (patch)
treec98c5db8976bfe1cb3d837a0f2af065fb0986e6d
parentb2382918e433a0ba0e1b4e0d2835abd562cbd103 (diff)
downloadgitlab-ce-359bc6940b1205035e14f028b75d0c9c80a1fd5e.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/cycle_analytics/components/base.vue18
-rw-r--r--app/assets/javascripts/related_issues/components/related_issues_root.vue3
-rw-r--r--app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue2
-rw-r--r--app/models/pages_domain.rb5
-rw-r--r--app/services/environments/stop_service.rb7
-rw-r--r--app/services/merge_requests/base_service.rb2
-rw-r--r--app/services/service_ping/submit_service.rb8
-rw-r--r--config/metrics/schema.json3
-rw-r--r--db/docs/users_statistics.yml4
-rw-r--r--doc/administration/pages/index.md13
-rw-r--r--doc/api/lint.md2
-rw-r--r--doc/ci/chatops/index.md4
-rw-r--r--doc/ci/migration/circleci.md4
-rw-r--r--doc/ci/yaml/includes.md2
-rw-r--r--doc/ci/yaml/index.md10
-rw-r--r--doc/ci/yaml/workflow.md12
-rw-r--r--doc/development/chatops_on_gitlabcom.md6
-rw-r--r--doc/development/dangerbot.md2
-rw-r--r--doc/development/service_ping/metrics_dictionary.md1
-rw-r--r--doc/development/service_ping/metrics_lifecycle.md1
-rw-r--r--doc/user/project/merge_requests/code_quality.md18
-rw-r--r--doc/user/project/merge_requests/load_performance_testing.md4
-rw-r--r--doc/user/project/merge_requests/merge_when_pipeline_succeeds.md4
-rw-r--r--doc/user/project/pages/getting_started/pages_from_scratch.md28
-rw-r--r--doc/user/project/repository/index.md5
-rw-r--r--locale/gitlab.pot3
-rw-r--r--qa/qa/runtime/env.rb4
-rw-r--r--qa/qa/scenario/template.rb53
-rw-r--r--qa/qa/scenario/test/integration/mattermost.rb3
-rw-r--r--qa/spec/scenario/template_spec.rb75
-rw-r--r--qa/spec/scenario/test/integration/mattermost_spec.rb15
-rw-r--r--qa/spec/specs/scenario_shared_examples.rb17
-rw-r--r--spec/frontend/issuable/related_issues/components/related_issues_root_spec.js27
-rw-r--r--spec/lib/gitlab/usage/metric_definition_spec.rb4
-rw-r--r--spec/models/pages_domain_spec.rb2
-rw-r--r--spec/services/environments/stop_service_spec.rb17
-rw-r--r--spec/services/merge_requests/close_service_spec.rb2
-rw-r--r--spec/services/merge_requests/post_merge_service_spec.rb2
38 files changed, 237 insertions, 155 deletions
diff --git a/app/assets/javascripts/cycle_analytics/components/base.vue b/app/assets/javascripts/cycle_analytics/components/base.vue
index 3d7a34581b3..735d8f26794 100644
--- a/app/assets/javascripts/cycle_analytics/components/base.vue
+++ b/app/assets/javascripts/cycle_analytics/components/base.vue
@@ -155,25 +155,25 @@ export default {
<template>
<div>
<h3>{{ $options.i18n.pageTitle }}</h3>
+ <value-stream-filters
+ :group-id="endpoints.groupId"
+ :group-path="endpoints.groupPath"
+ :has-project-filter="false"
+ :start-date="createdAfter"
+ :end-date="createdBefore"
+ @setDateRange="onSetDateRange"
+ />
<div class="gl-display-flex gl-flex-direction-column gl-md-flex-direction-row">
<path-navigation
v-if="displayPathNavigation"
data-testid="vsa-path-navigation"
- class="gl-w-full gl-pb-2"
+ class="gl-w-full gl-mt-4"
:loading="isLoading || isLoadingStage"
:stages="pathNavigationData"
:selected-stage="selectedStage"
@selected="onSelectStage"
/>
</div>
- <value-stream-filters
- :group-id="endpoints.groupId"
- :group-path="endpoints.groupPath"
- :has-project-filter="false"
- :start-date="createdAfter"
- :end-date="createdBefore"
- @setDateRange="onSetDateRange"
- />
<value-stream-metrics
:request-path="endpoints.fullPath"
:request-params="filterParams"
diff --git a/app/assets/javascripts/related_issues/components/related_issues_root.vue b/app/assets/javascripts/related_issues/components/related_issues_root.vue
index 40d58c04753..da049d68467 100644
--- a/app/assets/javascripts/related_issues/components/related_issues_root.vue
+++ b/app/assets/javascripts/related_issues/components/related_issues_root.vue
@@ -220,7 +220,8 @@ export default {
const startsWithNumber = String(touchedReference).match(/^[0-9]/) !== null;
if (startsWithNumber) {
- this.inputValue = `#${touchedReference}`;
+ const { pathIdSeparator } = this;
+ this.inputValue = `${pathIdSeparator}${touchedReference}`;
} else {
this.inputValue = `${touchedReference}`;
}
diff --git a/app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue b/app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue
index 08fdab04881..01d29da5486 100644
--- a/app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue
+++ b/app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue
@@ -91,7 +91,7 @@ export default {
:class="{
'gl-mb-3': index !== users.length - 1,
}"
- class="assignee-grid gl-display-grid gl-align-items-center"
+ class="assignee-grid gl-display-grid gl-align-items-center gl-w-full"
>
<assignee-avatar-link
:user="user"
diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb
index 2804588be85..93119bbff1f 100644
--- a/app/models/pages_domain.rb
+++ b/app/models/pages_domain.rb
@@ -245,8 +245,9 @@ class PagesDomain < ApplicationRecord
def validate_pages_domain
return unless domain
- if domain.downcase.ends_with?(".#{Settings.pages.host.downcase}") || domain.casecmp(Settings.pages.host) == 0
- self.errors.add(:domain, "#{Settings.pages.host} and its subdomains cannot be used as custom pages domains. Please compare our documentation at https://docs.gitlab.com/ee/administration/pages/#advanced-configuration against your configuration.")
+ if domain.downcase.ends_with?(".#{Settings.pages.host.downcase}")
+ error_template = _("Subdomains of the Pages root domain %{root_domain} are reserved and cannot be used as custom Pages domains.")
+ self.errors.add(:domain, error_template % { root_domain: Settings.pages.host })
end
end
diff --git a/app/services/environments/stop_service.rb b/app/services/environments/stop_service.rb
index 24ae658d3d6..39a43b21405 100644
--- a/app/services/environments/stop_service.rb
+++ b/app/services/environments/stop_service.rb
@@ -18,7 +18,12 @@ module Environments
environments.each { |environment| execute(environment) }
end
- def execute_for_merge_request(merge_request)
+ def execute_for_merge_request_pipeline(merge_request)
+ if ::Feature.enabled?(:fix_related_environments_for_merge_requests, merge_request.target_project,
+ default_enabled: :yaml)
+ return unless merge_request.actual_head_pipeline&.merge_request?
+ end
+
merge_request.environments_in_head_pipeline(deployment_status: :success).each do |environment|
execute(environment)
end
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb
index 8d06a1020c4..e4784d1de79 100644
--- a/app/services/merge_requests/base_service.rb
+++ b/app/services/merge_requests/base_service.rb
@@ -68,7 +68,7 @@ module MergeRequests
def cleanup_environments(merge_request)
Environments::StopService.new(merge_request.source_project, current_user)
- .execute_for_merge_request(merge_request)
+ .execute_for_merge_request_pipeline(merge_request)
end
def cancel_review_app_jobs!(merge_request)
diff --git a/app/services/service_ping/submit_service.rb b/app/services/service_ping/submit_service.rb
index ed6eb071f32..58b46207b8b 100644
--- a/app/services/service_ping/submit_service.rb
+++ b/app/services/service_ping/submit_service.rb
@@ -26,10 +26,10 @@ module ServicePing
error_payload = {
time: Time.current,
- uuid: Gitlab::UsageData.add_metric('UuidMetric'),
- hostname: Gitlab::UsageData.add_metric('HostnameMetric'),
- version: Gitlab::UsageData.alt_usage_data { Gitlab::VERSION },
- message: e.message,
+ uuid: Gitlab::CurrentSettings.uuid,
+ hostname: Gitlab.config.gitlab.host,
+ version: Gitlab.version_info.to_s,
+ message: "#{e.message.presence || e.class} at #{e.backtrace[0]}",
elapsed: (Time.current - start).round(1)
}
submit_payload({ error: error_payload }, path: ERROR_PATH)
diff --git a/config/metrics/schema.json b/config/metrics/schema.json
index 09376e32ef0..bb024eac8c1 100644
--- a/config/metrics/schema.json
+++ b/config/metrics/schema.json
@@ -43,6 +43,9 @@
"introduced_by_url": {
"type": ["string", "null"]
},
+ "removed_by_url": {
+ "type": ["string", "null"]
+ },
"repair_issue_url": {
"type": ["string"]
},
diff --git a/db/docs/users_statistics.yml b/db/docs/users_statistics.yml
index 7ff35cd8726..f2c44cc456e 100644
--- a/db/docs/users_statistics.yml
+++ b/db/docs/users_statistics.yml
@@ -3,7 +3,7 @@ table_name: users_statistics
classes:
- UsersStatistics
feature_categories:
-- product_analytics
-description: TODO
+- utilization
+description: User statistics
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26261
milestone: '12.9'
diff --git a/doc/administration/pages/index.md b/doc/administration/pages/index.md
index 8bd1037c314..8b27fecd161 100644
--- a/doc/administration/pages/index.md
+++ b/doc/administration/pages/index.md
@@ -97,10 +97,9 @@ IPv6 address. If you don't have IPv6, you can omit the `AAAA` record.
#### DNS configuration for custom domains
-If support for custom domains is needed, the Pages root domain and its subdomains should point to
-the secondary IP (which is dedicated for the Pages daemon). `<namespace>.<pages root domain>` should
-point at Pages directly. Without this, users aren't able to use `CNAME` records to point their
-custom domains to their GitLab Pages.
+If support for custom domains is needed, all subdomains of the Pages root domain should point to the
+secondary IP (which is dedicated for the Pages daemon). Without this configuration, users can't use
+`CNAME` records to point their custom domains to their GitLab Pages.
For example, an entry could look like this:
@@ -387,6 +386,12 @@ GitLab supports [custom domain verification](../../user/project/pages/custom_dom
When adding a custom domain, users are required to prove they own it by
adding a GitLab-controlled verification code to the DNS records for that domain.
+WARNING:
+Disabling domain verification is unsafe and can lead to various vulnerabilities.
+If you *do* disable it, either ensure that the Pages root domain itself does not point to the
+secondary IP or add the root domain as custom domain to a project; otherwise, any user can add this
+domain as a custom domain to their project.
+
If your user base is private or otherwise trusted, you can disable the
verification requirement:
diff --git a/doc/api/lint.md b/doc/api/lint.md
index a271b75c035..c0d0b69dc77 100644
--- a/doc/api/lint.md
+++ b/doc/api/lint.md
@@ -268,7 +268,7 @@ a JSON payload, you can use `jq`. For example, create a file named `example-gitl
```yaml
.api_test:
rules:
- - if: '$CI_PIPELINE_SOURCE=="merge_request_event"'
+ - if: $CI_PIPELINE_SOURCE=="merge_request_event"
changes:
- src/api/*
deploy:
diff --git a/doc/ci/chatops/index.md b/doc/ci/chatops/index.md
index c785e2f29ea..21b970536bc 100644
--- a/doc/ci/chatops/index.md
+++ b/doc/ci/chatops/index.md
@@ -73,7 +73,7 @@ stages:
hello-world:
stage: chatops
rules:
- - if: '$CI_PIPELINE_SOURCE == "chat"'
+ - if: $CI_PIPELINE_SOURCE == "chat"
script:
- echo "Hello World"
```
@@ -93,7 +93,7 @@ stages:
ls:
stage: chatops
rules:
- - if: '$CI_PIPELINE_SOURCE == "chat"'
+ - if: $CI_PIPELINE_SOURCE == "chat"
script:
- echo "This command will not be shown."
- echo -e "section_start:$( date +%s ):chat_reply\r\033[0K\n$( ls -la )\nsection_end:$( date +%s ):chat_reply\r\033[0K"
diff --git a/doc/ci/migration/circleci.md b/doc/ci/migration/circleci.md
index d95199a70d0..d2f865a160e 100644
--- a/doc/ci/migration/circleci.md
+++ b/doc/ci/migration/circleci.md
@@ -166,7 +166,7 @@ job1:
script:
- make build
rules:
- - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_NAME == "try-schedule-workflow"'
+ - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_NAME == "try-schedule-workflow"
```
After the pipeline configuration is saved, you configure the cron schedule in the [GitLab UI](../pipelines/schedules.md#add-a-pipeline-schedule), and can enable or disable schedules in the UI as well.
@@ -221,7 +221,7 @@ deploy:
script:
- echo "Deploy job"
rules:
- - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /^rc-/'
+ - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /^rc-/
```
### Caching
diff --git a/doc/ci/yaml/includes.md b/doc/ci/yaml/includes.md
index e5a543e7130..838710834ba 100644
--- a/doc/ci/yaml/includes.md
+++ b/doc/ci/yaml/includes.md
@@ -344,7 +344,7 @@ You can only use the following rules with `include` (and only with [certain vari
include:
- local: builds.yml
rules:
- - if: '$INCLUDE_BUILDS == "true"'
+ - if: $INCLUDE_BUILDS == "true"
- local: deploys.yml
rules:
- if: $CI_COMMIT_BRANCH == "main"
diff --git a/doc/ci/yaml/index.md b/doc/ci/yaml/index.md
index 22bcfe5de7b..79fa27db15b 100644
--- a/doc/ci/yaml/index.md
+++ b/doc/ci/yaml/index.md
@@ -3071,12 +3071,12 @@ to configure the job behavior, or with [`workflow`](#workflow) to configure the
job:
script: echo "Hello, Rules!"
rules:
- - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH'
+ - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
when: never
- - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/'
+ - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/
when: manual
allow_failure: true
- - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME'
+ - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
```
**Additional details**:
@@ -3122,7 +3122,7 @@ branch or merge request pipelines.
docker build:
script: docker build -t my-image:$CI_COMMIT_REF_SLUG .
rules:
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- Dockerfile
when: manual
@@ -3203,7 +3203,7 @@ job to run before continuing.
job:
script: echo "Hello, Rules!"
rules:
- - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
+ - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
```
diff --git a/doc/ci/yaml/workflow.md b/doc/ci/yaml/workflow.md
index b46d504edfa..eac3f5a5606 100644
--- a/doc/ci/yaml/workflow.md
+++ b/doc/ci/yaml/workflow.md
@@ -38,7 +38,7 @@ workflow:
rules:
- if: $CI_COMMIT_MESSAGE =~ /-draft$/
when: never
- - if: '$CI_PIPELINE_SOURCE == "push"'
+ - if: $CI_PIPELINE_SOURCE == "push"
```
This example has strict rules, and pipelines do **not** run in any other case.
@@ -50,9 +50,9 @@ All other pipeline types run. For example:
```yaml
workflow:
rules:
- - if: '$CI_PIPELINE_SOURCE == "schedule"'
+ - if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- - if: '$CI_PIPELINE_SOURCE == "push"'
+ - if: $CI_PIPELINE_SOURCE == "push"
when: never
- when: always
```
@@ -81,10 +81,10 @@ but does not run pipelines for any other case. It runs:
```yaml
workflow:
rules:
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- - if: '$CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_BRANCH
```
If the pipeline is triggered by:
diff --git a/doc/development/chatops_on_gitlabcom.md b/doc/development/chatops_on_gitlabcom.md
index e18fcb0061b..2065021c61b 100644
--- a/doc/development/chatops_on_gitlabcom.md
+++ b/doc/development/chatops_on_gitlabcom.md
@@ -20,12 +20,10 @@ tasks such as:
To request access to ChatOps on GitLab.com:
1. Sign in to [Internal GitLab for Operations](https://ops.gitlab.net/users/sign_in)
- with one of the following methods:
+ with one of the following methods (Okta is not supported):
- - The same username you use on GitLab.com. You may have to choose a different
- username later.
+ - The same username you use on GitLab.com. You may have to choose a different username later.
- Clicking the **Sign in with Google** button to sign in with your GitLab.com email address.
- - Clicking the **Sign in with Okta** button to sign in with Okta.
1. Confirm that your username in [Internal GitLab for Operations](https://ops.gitlab.net/)
is the same as your username in [GitLab.com](https://gitlab.com/). If the usernames
diff --git a/doc/development/dangerbot.md b/doc/development/dangerbot.md
index f941e0720c6..fd9378f6d7d 100644
--- a/doc/development/dangerbot.md
+++ b/doc/development/dangerbot.md
@@ -155,7 +155,7 @@ To enable the Dangerfile on another existing GitLab project, complete the follow
file:
- '/ci/danger-review.yml'
rules:
- - if: '$CI_SERVER_HOST == "gitlab.com"'
+ - if: $CI_SERVER_HOST == "gitlab.com"
```
1. If your project is in the `gitlab-org` group, you don't need to set up any token as the `DANGER_GITLAB_API_TOKEN`
diff --git a/doc/development/service_ping/metrics_dictionary.md b/doc/development/service_ping/metrics_dictionary.md
index 46c5cfb56ff..ead11a412fa 100644
--- a/doc/development/service_ping/metrics_dictionary.md
+++ b/doc/development/service_ping/metrics_dictionary.md
@@ -50,6 +50,7 @@ Each metric is defined in a separate YAML file consisting of a number of fields:
| `milestone` | no | The milestone when the metric is introduced and when it's available to self-managed instances with the official GitLab release. |
| `milestone_removed` | no | The milestone when the metric is removed. |
| `introduced_by_url` | no | The URL to the merge request that introduced the metric to be available for self-managed instances. |
+| `removed_by_url` | no | The URL to the merge request that removed the metric. |
| `repair_issue_url` | no | The URL of the issue that was created to repair a metric with a `broken` status. |
| `options` | no | `object`: options information needed to calculate the metric value. |
| `skip_validation` | no | This should **not** be set. [Used for imported metrics until we review, update and make them valid](https://gitlab.com/groups/gitlab-org/-/epics/5425). |
diff --git a/doc/development/service_ping/metrics_lifecycle.md b/doc/development/service_ping/metrics_lifecycle.md
index 844c989c640..c9cc9a4f2d2 100644
--- a/doc/development/service_ping/metrics_lifecycle.md
+++ b/doc/development/service_ping/metrics_lifecycle.md
@@ -113,6 +113,7 @@ To remove a metric:
update the attributes of the metric's YAML definition:
- Set the `status:` to `removed`.
+ - Set `removed_by_url:` to the URL of the MR removing the metric
- Set `milestone_removed:` to the number of the
milestone in which the metric was removed.
diff --git a/doc/user/project/merge_requests/code_quality.md b/doc/user/project/merge_requests/code_quality.md
index 10fc778d5ae..dd7b628e51e 100644
--- a/doc/user/project/merge_requests/code_quality.md
+++ b/doc/user/project/merge_requests/code_quality.md
@@ -257,9 +257,9 @@ The template has these [`rules`](../../../ci/yaml/index.md#rules) for the `code
```yaml
code_quality:
rules:
- - if: '$CODE_QUALITY_DISABLED'
+ - if: $CODE_QUALITY_DISABLED
when: never
- - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_TAG || $CI_COMMIT_BRANCH
```
If you are using merge request pipelines, your `rules` (or [`workflow: rules`](../../../ci/yaml/index.md#workflow))
@@ -268,9 +268,9 @@ might look like this example:
```yaml
job1:
rules:
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # Run job1 in merge request pipelines
- - if: '$CI_COMMIT_BRANCH == "main"' # Run job1 in pipelines on the main branch (but not in other branch pipelines)
- - if: '$CI_COMMIT_TAG' # Run job1 in pipelines for tags
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Run job1 in merge request pipelines
+ - if: $CI_COMMIT_BRANCH == "main" # Run job1 in pipelines on the main branch (but not in other branch pipelines)
+ - if: $CI_COMMIT_TAG # Run job1 in pipelines for tags
```
To make these work together, you need to overwrite the code quality `rules`
@@ -282,11 +282,11 @@ include:
code_quality:
rules:
- - if: '$CODE_QUALITY_DISABLED'
+ - if: $CODE_QUALITY_DISABLED
when: never
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # Run code quality job in merge request pipelines
- - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # Run code quality job in pipelines on the default branch (but not in other branch pipelines)
- - if: '$CI_COMMIT_TAG' # Run code quality job in pipelines for tags
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Run code quality job in merge request pipelines
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run code quality job in pipelines on the default branch (but not in other branch pipelines)
+ - if: $CI_COMMIT_TAG # Run code quality job in pipelines for tags
```
### Configure Code Quality to use a private container image registry
diff --git a/doc/user/project/merge_requests/load_performance_testing.md b/doc/user/project/merge_requests/load_performance_testing.md
index 7861e1e28fc..a5fff4a38be 100644
--- a/doc/user/project/merge_requests/load_performance_testing.md
+++ b/doc/user/project/merge_requests/load_performance_testing.md
@@ -189,7 +189,7 @@ review:
paths:
- review.env
rules:
- - if: '$CI_COMMIT_BRANCH' # Modify to match your pipeline rules, or use `only/except` if needed.
+ - if: $CI_COMMIT_BRANCH # Modify to match your pipeline rules, or use `only/except` if needed.
load_performance:
dependencies:
@@ -197,5 +197,5 @@ load_performance:
variables:
K6_DOCKER_OPTIONS: '--env-file review.env'
rules:
- - if: '$CI_COMMIT_BRANCH' # Modify to match your pipeline rules, or use `only/except` if needed.
+ - if: $CI_COMMIT_BRANCH # Modify to match your pipeline rules, or use `only/except` if needed.
```
diff --git a/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md b/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md
index 7cb5b45230d..ac1c61f2e72 100644
--- a/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md
+++ b/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md
@@ -81,13 +81,13 @@ it could allow code that fails tests to be merged:
```yaml
branch-pipeline-job:
rules:
- - if: '$CI_PIPELINE_SOURCE == "push"'
+ - if: $CI_PIPELINE_SOURCE == "push"
script:
- echo "Code testing scripts here, for example."
merge-request-pipeline-job:
rules:
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- echo "No tests run, but this pipeline always succeeds and enables merge."
- echo true
diff --git a/doc/user/project/pages/getting_started/pages_from_scratch.md b/doc/user/project/pages/getting_started/pages_from_scratch.md
index f08afc924f3..5fd17b5c07e 100644
--- a/doc/user/project/pages/getting_started/pages_from_scratch.md
+++ b/doc/user/project/pages/getting_started/pages_from_scratch.md
@@ -202,7 +202,7 @@ image: ruby:2.7
workflow:
rules:
- - if: '$CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_BRANCH
pages:
script:
@@ -222,7 +222,7 @@ image: ruby:2.7
workflow:
rules:
- - if: '$CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_BRANCH
pages:
script:
@@ -233,7 +233,7 @@ pages:
paths:
- public
rules:
- - if: '$CI_COMMIT_BRANCH == "main"'
+ - if: $CI_COMMIT_BRANCH == "main"
```
### Specify a stage to deploy
@@ -253,7 +253,7 @@ image: ruby:2.7
workflow:
rules:
- - if: '$CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_BRANCH
pages:
stage: deploy
@@ -265,7 +265,7 @@ pages:
paths:
- public
rules:
- - if: '$CI_COMMIT_BRANCH == "main"'
+ - if: $CI_COMMIT_BRANCH == "main"
```
Now add another job to the CI file, telling it to
@@ -276,7 +276,7 @@ image: ruby:2.7
workflow:
rules:
- - if: '$CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_BRANCH
pages:
stage: deploy
@@ -288,7 +288,7 @@ pages:
paths:
- public
rules:
- - if: '$CI_COMMIT_BRANCH == "main"'
+ - if: $CI_COMMIT_BRANCH == "main"
test:
stage: test
@@ -300,7 +300,7 @@ test:
paths:
- test
rules:
- - if: '$CI_COMMIT_BRANCH != "main"'
+ - if: $CI_COMMIT_BRANCH != "main"
```
When the `test` job runs in the `test` stage, Jekyll
@@ -327,7 +327,7 @@ image: ruby:2.7
workflow:
rules:
- - if: '$CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_BRANCH
before_script:
- gem install bundler
@@ -341,7 +341,7 @@ pages:
paths:
- public
rules:
- - if: '$CI_COMMIT_BRANCH == "main"'
+ - if: $CI_COMMIT_BRANCH == "main"
test:
stage: test
@@ -351,7 +351,7 @@ test:
paths:
- test
rules:
- - if: '$CI_COMMIT_BRANCH != "main"'
+ - if: $CI_COMMIT_BRANCH != "main"
```
### Build faster with cached dependencies
@@ -367,7 +367,7 @@ image: ruby:2.7
workflow:
rules:
- - if: '$CI_COMMIT_BRANCH'
+ - if: $CI_COMMIT_BRANCH
cache:
paths:
@@ -385,7 +385,7 @@ pages:
paths:
- public
rules:
- - if: '$CI_COMMIT_BRANCH == "main"'
+ - if: $CI_COMMIT_BRANCH == "main"
test:
stage: test
@@ -395,7 +395,7 @@ test:
paths:
- test
rules:
- - if: '$CI_COMMIT_BRANCH != "main"'
+ - if: $CI_COMMIT_BRANCH != "main"
```
In this case, you need to exclude the `/vendor`
diff --git a/doc/user/project/repository/index.md b/doc/user/project/repository/index.md
index 6ece6e3e4e0..02b5639cae8 100644
--- a/doc/user/project/repository/index.md
+++ b/doc/user/project/repository/index.md
@@ -244,6 +244,11 @@ When you [rename a user](../../profile/index.md#change-your-username),
- The redirects are available as long as the original path is not claimed by
another group, user, or project.
+WARNING:
+The [CI/CD `includes` keyword](../../../ci/yaml/includes.md) can't follow project
+redirects. Pipelines fail with a syntax error when configured to use `includes`
+to fetch configuration from a project that is renamed or moved.
+
## Related topics
- [GitLab Workflow VS Code extension](vscode.md).
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 9bb145d9416..8914d5482a2 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -36352,6 +36352,9 @@ msgstr ""
msgid "Sub-batch size"
msgstr ""
+msgid "Subdomains of the Pages root domain %{root_domain} are reserved and cannot be used as custom Pages domains."
+msgstr ""
+
msgid "Subgroup information"
msgstr ""
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index e4537009406..fbc3727d823 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -25,6 +25,10 @@ module QA
SUPPORTED_FEATURES
end
+ def gitlab_url
+ @gitlab_url ||= ENV["QA_GITLAB_URL"] || "http://127.0.0.1:3000" # default to GDK
+ end
+
def additional_repository_storage
ENV['QA_ADDITIONAL_REPOSITORY_STORAGE']
end
diff --git a/qa/qa/scenario/template.rb b/qa/qa/scenario/template.rb
index 8cf1fa0705f..9cd9a6f438c 100644
--- a/qa/qa/scenario/template.rb
+++ b/qa/qa/scenario/template.rb
@@ -21,16 +21,14 @@ module QA
end
def perform(options, *args)
- extract_address(:gitlab_address, options, args)
-
- gitlab_address = URI(Runtime::Scenario.gitlab_address)
+ gitlab_address = extract_gitlab_address(options, args)
# Define the "About" page as an `about` subdomain.
# @example
# Given *gitlab_address* = 'https://gitlab.com/' #=> https://about.gitlab.com/
# Given *gitlab_address* = 'https://staging.gitlab.com/' #=> https://about.staging.gitlab.com/
# Given *gitlab_address* = 'http://gitlab-abc123.test/' #=> http://about.gitlab-abc123.test/
- Runtime::Scenario.define(:about_address, URI(-> { gitlab_address.host = "about.#{gitlab_address.host}"; gitlab_address }.call).to_s) # rubocop:disable Style/Semicolon
+ Runtime::Scenario.define(:about_address, gitlab_address.tap { |add| add.host = "about.#{add.host}" }.to_s)
# Save the scenario class name
Runtime::Scenario.define(:klass, self.class.name)
@@ -43,11 +41,14 @@ module QA
##
# Perform before hooks, which are different for CE and EE
#
-
Runtime::Release.perform_before_hooks unless Runtime::Env.dry_run
Runtime::Feature.enable(options[:enable_feature]) if options.key?(:enable_feature)
- Runtime::Feature.disable(options[:disable_feature]) if options.key?(:disable_feature) && (@feature_enabled = Runtime::Feature.enabled?(options[:disable_feature]))
+
+ if options.key?(:disable_feature) && (@feature_enabled = Runtime::Feature.enabled?(options[:disable_feature]))
+ Runtime::Feature.disable(options[:disable_feature])
+ end
+
Runtime::Feature.set(options[:set_feature_flags]) if options.key?(:set_feature_flags)
Specs::Runner.perform do |specs|
@@ -60,25 +61,41 @@ module QA
Runtime::Feature.enable(options[:disable_feature]) if options.key?(:disable_feature) && @feature_enabled
end
- def extract_option(name, options, args)
- option = if options.key?(name)
- options[name]
- else
- args.shift
- end
-
- Runtime::Scenario.define(name, option)
+ def extract_address(name, options)
+ address = options[name]
+ validate_address(name, address)
- option
+ Runtime::Scenario.define(name, address)
end
+ private
+
# For backwards-compatibility, if the gitlab instance address is not
# specified as an option parsed by OptionParser, it can be specified as
# the first argument
- def extract_address(name, options, args)
- address = extract_option(name, options, args)
+ def extract_gitlab_address(options, args)
+ opt_name = :gitlab_address
+ address_from_opt = Runtime::Scenario.attributes[opt_name]
+ # return gitlab address if it was set via named option already
+ return validate_address(opt_name, address_from_opt) && URI(address_from_opt) if address_from_opt
+
+ address = if args.first.nil? || File.exist?(args.first)
+ # if first arg is a valid path and not address, it's a spec file, default to environment variable
+ Runtime::Env.gitlab_url
+ else
+ args.shift
+ end
+
+ validate_address(opt_name, address)
+ Runtime::Scenario.define(opt_name, address)
+
+ URI(address)
+ end
- raise ::ArgumentError, "The address provided for `#{name}` is not valid: #{address}" unless Runtime::Address.valid?(address)
+ def validate_address(name, address)
+ Runtime::Address.valid?(address) || raise(
+ ::ArgumentError, "Configured address parameter '#{name}' is not a valid url: #{address}"
+ )
end
end
end
diff --git a/qa/qa/scenario/test/integration/mattermost.rb b/qa/qa/scenario/test/integration/mattermost.rb
index 48ebb51966c..4b1498faa37 100644
--- a/qa/qa/scenario/test/integration/mattermost.rb
+++ b/qa/qa/scenario/test/integration/mattermost.rb
@@ -14,8 +14,7 @@ module QA
attribute :mattermost_address, '--mattermost-address URL', 'Address of the Mattermost server'
def perform(options, *args)
- extract_address(:gitlab_address, options, args)
- extract_address(:mattermost_address, options, args)
+ extract_address(:mattermost_address, options)
super(options, *args)
end
diff --git a/qa/spec/scenario/template_spec.rb b/qa/spec/scenario/template_spec.rb
index 9800f92b306..2b8a00141e4 100644
--- a/qa/spec/scenario/template_spec.rb
+++ b/qa/spec/scenario/template_spec.rb
@@ -1,35 +1,45 @@
# frozen_string_literal: true
RSpec.describe QA::Scenario::Template do
- let(:feature) { spy('Runtime::Feature') }
- let(:release) { spy('Runtime::Release') }
+ let(:release) { spy('QA::Runtime::Release') } # rubocop:disable RSpec/VerifiedDoubles
+ let(:feature) { class_spy('QA::Runtime::Feature') }
+ let(:scenario) { class_spy('QA::Runtime::Scenario') }
+ let(:runner) { class_spy('QA::Specs::Runner') }
+
let(:gitlab_address) { 'https://gitlab.com/' }
+ let(:gitlab_address_from_env) { 'https://staging.gitlab.com/' }
before do
stub_const('QA::Runtime::Release', release)
stub_const('QA::Runtime::Feature', feature)
- allow(QA::Specs::Runner).to receive(:perform)
- allow(QA::Runtime::Address).to receive(:valid?).and_return(true)
+ stub_const('QA::Runtime::Scenario', scenario)
+ stub_const('QA::Specs::Runner', runner)
+
+ allow(QA::Runtime::Env).to receive(:knapsack?).and_return(false)
+ allow(QA::Runtime::Env).to receive(:gitlab_url).and_return(gitlab_address_from_env)
+
+ allow(scenario).to receive(:attributes).and_return({ gitlab_address: gitlab_address })
+ allow(scenario).to receive(:define)
end
it 'allows a feature to be enabled' do
subject.perform({ gitlab_address: gitlab_address, enable_feature: 'a-feature' })
expect(feature).to have_received(:enable).with('a-feature')
+ expect(feature).to have_received(:disable).with('a-feature')
end
it 'allows a feature to be disabled' do
- allow(QA::Runtime::Feature).to receive(:enabled?)
- .with('another-feature').and_return(true)
+ allow(QA::Runtime::Feature).to receive(:enabled?).with('another-feature').and_return(true)
subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' })
expect(feature).to have_received(:disable).with('another-feature')
+ expect(feature).to have_received(:enable).with('another-feature')
end
it 'does not disable a feature if already disabled' do
- allow(QA::Runtime::Feature).to receive(:enabled?)
- .with('another-feature').and_return(false)
+ allow(QA::Runtime::Feature).to receive(:enabled?).with('another-feature').and_return(false)
subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' })
@@ -39,7 +49,8 @@ RSpec.describe QA::Scenario::Template do
it 'ensures an enabled feature is disabled afterwards' do
allow(QA::Specs::Runner).to receive(:perform).and_raise('failed test')
- expect { subject.perform({ gitlab_address: gitlab_address, enable_feature: 'a-feature' }) }.to raise_error('failed test')
+ expect { subject.perform({ gitlab_address: gitlab_address, enable_feature: 'a-feature' }) }
+ .to raise_error('failed test')
expect(feature).to have_received(:enable).with('a-feature')
expect(feature).to have_received(:disable).with('a-feature')
@@ -47,11 +58,10 @@ RSpec.describe QA::Scenario::Template do
it 'ensures a disabled feature is enabled afterwards' do
allow(QA::Specs::Runner).to receive(:perform).and_raise('failed test')
+ allow(QA::Runtime::Feature).to receive(:enabled?).with('another-feature').and_return(true)
- allow(QA::Runtime::Feature).to receive(:enabled?)
- .with('another-feature').and_return(true)
-
- expect { subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' }) }.to raise_error('failed test')
+ expect { subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' }) }
+ .to raise_error('failed test')
expect(feature).to have_received(:disable).with('another-feature')
expect(feature).to have_received(:enable).with('another-feature')
@@ -59,25 +69,42 @@ RSpec.describe QA::Scenario::Template do
it 'ensures a disabled feature is not enabled afterwards if it was disabled earlier' do
allow(QA::Specs::Runner).to receive(:perform).and_raise('failed test')
+ allow(QA::Runtime::Feature).to receive(:enabled?).with('another-feature').and_return(false)
- allow(QA::Runtime::Feature).to receive(:enabled?)
- .with('another-feature').and_return(false)
-
- expect { subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' }) }.to raise_error('failed test')
+ expect { subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' }) }
+ .to raise_error('failed test')
expect(feature).not_to have_received(:disable).with('another-feature')
expect(feature).not_to have_received(:enable).with('another-feature')
end
- it 'defines an about address by default' do
- subject.perform( { gitlab_address: gitlab_address })
+ it 'defines gitlab address from positional argument' do
+ allow(scenario).to receive(:attributes).and_return({})
+
+ subject.perform({}, gitlab_address)
+
+ expect(scenario).to have_received(:define).with(:gitlab_address, gitlab_address)
+ expect(scenario).to have_received(:define).with(:about_address, 'https://about.gitlab.com/')
+ end
+
+ it "defaults to gitlab address from env" do
+ allow(scenario).to receive(:attributes).and_return({})
+
+ subject.perform({})
+
+ expect(scenario).to have_received(:define).with(:gitlab_address, gitlab_address_from_env)
+ end
+
+ it 'defines only about address' do
+ subject.perform({ gitlab_address: gitlab_address })
- expect(QA::Runtime::Scenario.gitlab_address).to eq(gitlab_address)
- expect(QA::Runtime::Scenario.about_address).to eq('https://about.gitlab.com/')
+ expect(scenario).not_to have_received(:define).with(:gitlab_address, gitlab_address)
+ expect(scenario).to have_received(:define).with(:about_address, 'https://about.gitlab.com/')
+ end
- subject.perform({ gitlab_address: 'http://gitlab-abc.test/' })
+ it 'defines klass attribute' do
+ subject.perform({ gitlab_address: gitlab_address })
- expect(QA::Runtime::Scenario.gitlab_address).to eq('http://gitlab-abc.test/')
- expect(QA::Runtime::Scenario.about_address).to eq('http://about.gitlab-abc.test/')
+ expect(scenario).to have_received(:define).with(:klass, 'QA::Scenario::Template')
end
end
diff --git a/qa/spec/scenario/test/integration/mattermost_spec.rb b/qa/spec/scenario/test/integration/mattermost_spec.rb
index 9532ec35b95..20a85598463 100644
--- a/qa/spec/scenario/test/integration/mattermost_spec.rb
+++ b/qa/spec/scenario/test/integration/mattermost_spec.rb
@@ -3,22 +3,15 @@
RSpec.describe QA::Scenario::Test::Integration::Mattermost do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
- let(:args) { %w[gitlab_address mattermost_address] }
- let(:args) do
- {
- gitlab_address: 'http://gitlab_address',
- mattermost_address: 'http://mattermost_address'
- }
- end
-
+ let(:args) { { gitlab_address: 'http://gitlab_address', mattermost_address: 'http://mattermost_address' } }
let(:named_options) { %w[--address http://gitlab_address --mattermost-address http://mattermost_address] }
let(:tags) { [:mattermost] }
- let(:options) { ['path1']}
+ let(:options) { ['path1'] }
- it 'requires a GitHub access token' do
+ it 'defines mattermost address' do
subject.perform(args)
- expect(attributes).to have_received(:define)
+ expect(scenario).to have_received(:define)
.with(:mattermost_address, 'http://mattermost_address')
end
end
diff --git a/qa/spec/specs/scenario_shared_examples.rb b/qa/spec/specs/scenario_shared_examples.rb
index 7d806d50d21..55aae731cd9 100644
--- a/qa/spec/specs/scenario_shared_examples.rb
+++ b/qa/spec/specs/scenario_shared_examples.rb
@@ -2,7 +2,7 @@
module QA
RSpec.shared_examples 'a QA scenario class' do
- let(:attributes) { class_spy('Runtime::Scenario') }
+ let(:scenario) { class_spy('Runtime::Scenario') }
let(:runner) { class_spy('Specs::Runner') }
let(:release) { class_spy('Runtime::Release') }
let(:feature) { class_spy('Runtime::Feature') }
@@ -15,24 +15,17 @@ module QA
before do
stub_const('QA::Specs::Runner', runner)
stub_const('QA::Runtime::Release', release)
- stub_const('QA::Runtime::Scenario', attributes)
+ stub_const('QA::Runtime::Scenario', scenario)
stub_const('QA::Runtime::Feature', feature)
- allow(attributes).to receive(:gitlab_address).and_return(args[:gitlab_address])
+ allow(scenario).to receive(:attributes).and_return(args)
allow(runner).to receive(:perform).and_yield(runner)
- allow(QA::Runtime::Address).to receive(:valid?).and_return(true)
end
it 'responds to perform' do
expect(subject).to respond_to(:perform)
end
- it 'sets an address of the subject' do
- subject.perform(args)
-
- expect(attributes).to have_received(:define).with(:gitlab_address, 'http://gitlab_address').at_least(:once)
- end
-
it 'performs before hooks only once' do
subject.perform(args)
@@ -58,7 +51,7 @@ module QA
described_class.launch!(named_options)
args do |k, v|
- expect(attributes).to have_received(:define).with(k, v)
+ expect(scenario).to have_received(:define).with(k, v)
end
end
@@ -67,7 +60,7 @@ module QA
end
it 'passes on options after --' do
- expect(described_class).to receive(:perform).with(attributes, *%w[--tag quarantine])
+ expect(described_class).to receive(:perform).with(args, *%w[--tag quarantine])
described_class.launch!(named_options.push(*%w[-- --tag quarantine]))
end
diff --git a/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js b/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js
index b59717a1f60..1a03ea58b60 100644
--- a/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js
+++ b/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js
@@ -300,16 +300,27 @@ describe('RelatedIssuesRoot', () => {
expect(wrapper.vm.state.pendingReferences[1]).toEqual('random');
});
- it('prepends # when user enters a numeric value [0-9]', async () => {
- const input = '23';
+ it.each`
+ pathIdSeparator
+ ${'#'}
+ ${'&'}
+ `(
+ 'prepends $pathIdSeparator when user enters a numeric value [0-9]',
+ async ({ pathIdSeparator }) => {
+ const input = '23';
+
+ await wrapper.setProps({
+ pathIdSeparator,
+ });
- wrapper.vm.onInput({
- untouchedRawReferences: input.trim().split(/\s/),
- touchedReference: input,
- });
+ wrapper.vm.onInput({
+ untouchedRawReferences: input.trim().split(/\s/),
+ touchedReference: input,
+ });
- expect(wrapper.vm.inputValue).toBe(`#${input}`);
- });
+ expect(wrapper.vm.inputValue).toBe(`${pathIdSeparator}${input}`);
+ },
+ );
it('prepends # when user enters a number', async () => {
const input = 23;
diff --git a/spec/lib/gitlab/usage/metric_definition_spec.rb b/spec/lib/gitlab/usage/metric_definition_spec.rb
index 0b5d11da398..070586319a5 100644
--- a/spec/lib/gitlab/usage/metric_definition_spec.rb
+++ b/spec/lib/gitlab/usage/metric_definition_spec.rb
@@ -20,7 +20,8 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
distribution: %w(ee ce),
tier: %w(free starter premium ultimate bronze silver gold),
name: 'uuid',
- data_category: 'standard'
+ data_category: 'standard',
+ removed_by_url: 'http://gdk.test'
}
end
@@ -132,6 +133,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
:tier | %w(test ee)
:name | 'count_<adjective_describing>_boards'
:repair_issue_url | nil
+ :removed_by_url | 1
:instrumentation_class | 'Metric_Class'
:instrumentation_class | 'metricClass'
diff --git a/spec/models/pages_domain_spec.rb b/spec/models/pages_domain_spec.rb
index 2ebc9864d9b..7fde8d63947 100644
--- a/spec/models/pages_domain_spec.rb
+++ b/spec/models/pages_domain_spec.rb
@@ -38,7 +38,7 @@ RSpec.describe PagesDomain do
'0123123' => true,
'a-reserved.com' => true,
'a.b-reserved.com' => true,
- 'reserved.com' => false,
+ 'reserved.com' => true,
'_foo.com' => false,
'a.reserved.com' => false,
'a.b.reserved.com' => false,
diff --git a/spec/services/environments/stop_service_spec.rb b/spec/services/environments/stop_service_spec.rb
index 9e9ef127c67..6cfbd765785 100644
--- a/spec/services/environments/stop_service_spec.rb
+++ b/spec/services/environments/stop_service_spec.rb
@@ -161,8 +161,8 @@ RSpec.describe Environments::StopService do
end
end
- describe '#execute_for_merge_request' do
- subject { service.execute_for_merge_request(merge_request) }
+ describe '#execute_for_merge_request_pipeline' do
+ subject { service.execute_for_merge_request_pipeline(merge_request) }
let(:merge_request) { create(:merge_request, source_branch: 'feature', target_branch: 'master') }
let(:project) { merge_request.project }
@@ -199,6 +199,19 @@ RSpec.describe Environments::StopService do
expect(pipeline.environments_in_self_and_descendants.first).to be_stopped
end
+ context 'when pipeline is a branch pipeline for merge request' do
+ let(:pipeline) do
+ create(:ci_pipeline, source: :push, project: project, sha: merge_request.diff_head_sha,
+ merge_requests_as_head_pipeline: [merge_request])
+ end
+
+ it 'does not stop the active environment' do
+ subject
+
+ expect(pipeline.environments_in_self_and_descendants.first).to be_available
+ end
+ end
+
context 'with environment related jobs ' do
let!(:environment) { create(:environment, :available, name: 'staging', project: project) }
let!(:prepare_staging_job) { create(:ci_build, :prepare_staging, pipeline: pipeline, project: project) }
diff --git a/spec/services/merge_requests/close_service_spec.rb b/spec/services/merge_requests/close_service_spec.rb
index d36a2f75cfe..cd1c362a19f 100644
--- a/spec/services/merge_requests/close_service_spec.rb
+++ b/spec/services/merge_requests/close_service_spec.rb
@@ -97,7 +97,7 @@ RSpec.describe MergeRequests::CloseService do
it 'clean up environments for the merge request' do
expect_next_instance_of(::Environments::StopService) do |service|
- expect(service).to receive(:execute_for_merge_request).with(merge_request)
+ expect(service).to receive(:execute_for_merge_request_pipeline).with(merge_request)
end
described_class.new(project: project, current_user: user).execute(merge_request)
diff --git a/spec/services/merge_requests/post_merge_service_spec.rb b/spec/services/merge_requests/post_merge_service_spec.rb
index 8d9a32c3e9e..9a7f36929fc 100644
--- a/spec/services/merge_requests/post_merge_service_spec.rb
+++ b/spec/services/merge_requests/post_merge_service_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe MergeRequests::PostMergeService do
it 'clean up environments for the merge request' do
expect_next_instance_of(::Environments::StopService) do |stop_environment_service|
- expect(stop_environment_service).to receive(:execute_for_merge_request).with(merge_request)
+ expect(stop_environment_service).to receive(:execute_for_merge_request_pipeline).with(merge_request)
end
subject