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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-02 12:10:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-02 12:10:27 +0300
commit423309c4aeebaf0415ba6de79599f9b5fd6c57a7 (patch)
tree39e2671ea19b8879859dd69f5e51f05a05e7f081
parent326e1de67f5dc13071b808ce9e3a2fb9d800f782 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab/ci/build-images.gitlab-ci.yml6
-rw-r--r--.gitlab/ci/frontend.gitlab-ci.yml1
-rw-r--r--.gitlab/ci/review-apps/qa.gitlab-ci.yml3
-rw-r--r--app/assets/javascripts/content_editor/components/bubble_menus/link_bubble_menu.vue35
-rw-r--r--app/assets/javascripts/environments/components/deployment.vue7
-rw-r--r--doc/administration/auth/ldap/ldap-troubleshooting.md4
-rw-r--r--doc/administration/whats-new.md10
-rw-r--r--doc/development/database/database_debugging.md2
-rw-r--r--doc/development/documentation/topic_types/troubleshooting.md2
-rw-r--r--doc/development/fe_guide/troubleshooting.md2
-rw-r--r--doc/development/service_ping/troubleshooting.md2
-rw-r--r--doc/development/snowplow/troubleshooting.md2
-rw-r--r--doc/development/testing_guide/end_to_end/index.md15
-rw-r--r--doc/integration/advanced_search/elasticsearch_troubleshooting.md2
-rw-r--r--doc/user/application_security/dast/dast_troubleshooting.md2
-rwxr-xr-xscripts/build_assets_image8
-rwxr-xr-xscripts/checkout-mr-source-sha7
-rwxr-xr-xscripts/generate-e2e-pipeline2
-rwxr-xr-xscripts/trigger-build.rb24
-rw-r--r--spec/frontend/content_editor/components/bubble_menus/link_bubble_menu_spec.js112
-rw-r--r--spec/frontend/environments/deployment_spec.js3
-rw-r--r--spec/scripts/trigger-build_spec.rb119
-rw-r--r--workhorse/main_test.go2
l---------workhorse/testdata/repo/group/test.git1
24 files changed, 180 insertions, 193 deletions
diff --git a/.gitlab/ci/build-images.gitlab-ci.yml b/.gitlab/ci/build-images.gitlab-ci.yml
index 10b8d19e0db..dbd956214dd 100644
--- a/.gitlab/ci/build-images.gitlab-ci.yml
+++ b/.gitlab/ci/build-images.gitlab-ci.yml
@@ -2,8 +2,6 @@
extends: .use-kaniko
variables:
GIT_LFS_SKIP_SMUDGE: 1
- script:
- - scripts/checkout-mr-source-sha
retry: 2
# This image is used by:
@@ -20,8 +18,7 @@ build-qa-image:
# Default latest tag for particular branch
QA_IMAGE_BRANCH: ${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${CI_COMMIT_REF_SLUG}
script:
- - !reference [.base-image-build, script]
- - export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}"
+ - export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${CI_COMMIT_SHA}"
- echo $QA_IMAGE
- echo $QA_IMAGE_BRANCH
- |
@@ -45,7 +42,6 @@ build-assets-image:
stage: build-images
needs: ["compile-production-assets"]
script:
- - !reference [.base-image-build, script]
# TODO: Change the image tag to be the MD5 of assets files and skip image building if the image exists
# We'll also need to pass GITLAB_ASSETS_TAG to the trigerred omnibus-gitlab pipeline similarly to how we do it for trigerred CNG pipelines
# https://gitlab.com/gitlab-org/gitlab/issues/208389
diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml
index 4298482e03d..59a144b952d 100644
--- a/.gitlab/ci/frontend.gitlab-ci.yml
+++ b/.gitlab/ci/frontend.gitlab-ci.yml
@@ -43,7 +43,6 @@ compile-production-assets:
- webpack-report/
when: always
before_script:
- - scripts/checkout-mr-source-sha
- !reference [.default-before_script, before_script]
after_script:
- rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here
diff --git a/.gitlab/ci/review-apps/qa.gitlab-ci.yml b/.gitlab/ci/review-apps/qa.gitlab-ci.yml
index 54f9b183919..e664e556068 100644
--- a/.gitlab/ci/review-apps/qa.gitlab-ci.yml
+++ b/.gitlab/ci/review-apps/qa.gitlab-ci.yml
@@ -42,7 +42,6 @@ include:
GIT_LFS_SKIP_SMUDGE: 1
WD_INSTALL_DIR: /usr/local/bin
before_script:
- - scripts/checkout-mr-source-sha
- !reference [.bundle-base, before_script]
script:
- export EE_LICENSE="$(cat $REVIEW_APPS_EE_LICENSE_FILE)"
@@ -61,7 +60,7 @@ include:
--format RspecJunitFormatter --out tmp/rspec.xml \
]" || qa_run_status=$?
- if [ ${qa_run_status} -ne 0 ]; then
- release_sha=$(echo "${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-${CI_COMMIT_SHA}}" | cut -c1-11);
+ release_sha=$(echo "${CI_COMMIT_SHA}" | cut -c1-11);
echo "Errors can be found at https://sentry.gitlab.net/gitlab/gitlab-review-apps/releases/${release_sha}/all-events/.";
fi
- exit ${qa_run_status}
diff --git a/app/assets/javascripts/content_editor/components/bubble_menus/link_bubble_menu.vue b/app/assets/javascripts/content_editor/components/bubble_menus/link_bubble_menu.vue
index 9f5afe5a8dc..a4713eb3275 100644
--- a/app/assets/javascripts/content_editor/components/bubble_menus/link_bubble_menu.vue
+++ b/app/assets/javascripts/content_editor/components/bubble_menus/link_bubble_menu.vue
@@ -36,18 +36,9 @@ export default {
isEditing: false,
};
},
- watch: {
- linkCanonicalSrc(value) {
- if (!value) this.isEditing = true;
- },
- },
methods: {
shouldShow() {
- const shouldShow = this.tiptapEditor.isActive(Link.name);
-
- if (!shouldShow) this.isEditing = false;
-
- return shouldShow;
+ return this.tiptapEditor.isActive(Link.name);
},
startEditingLink() {
@@ -92,13 +83,23 @@ export default {
},
updateLinkToState() {
- if (!this.tiptapEditor.isActive(Link.name)) return;
+ const editor = this.tiptapEditor;
- const { href, title, canonicalSrc } = this.tiptapEditor.getAttributes(Link.name);
+ const { href, title, canonicalSrc } = editor.getAttributes(Link.name);
+
+ if (
+ canonicalSrc === this.linkCanonicalSrc &&
+ href === this.linkHref &&
+ title === this.linkTitle
+ ) {
+ return;
+ }
this.linkTitle = title;
this.linkHref = href;
this.linkCanonicalSrc = canonicalSrc || href;
+
+ this.isEditing = !this.linkCanonicalSrc;
},
copyLinkHref() {
@@ -108,6 +109,12 @@ export default {
removeLink() {
this.tiptapEditor.chain().focus().extendMarkRange(Link.name).unsetLink().run();
},
+
+ resetBubbleMenuState() {
+ this.linkTitle = undefined;
+ this.linkHref = undefined;
+ this.linkCanonicalSrc = undefined;
+ },
},
tippyOptions: {
placement: 'bottom',
@@ -121,8 +128,10 @@ export default {
plugin-key="bubbleMenuLink"
:should-show="shouldShow"
:tippy-options="$options.tippyOptions"
+ @show="updateLinkToState"
+ @hidden="resetBubbleMenuState"
>
- <editor-state-observer @transaction="updateLinkToState">
+ <editor-state-observer @selectionUpdate="updateLinkToState">
<gl-button-group v-if="!isEditing" class="gl-display-flex gl-align-items-center">
<gl-link
v-gl-tooltip
diff --git a/app/assets/javascripts/environments/components/deployment.vue b/app/assets/javascripts/environments/components/deployment.vue
index 595ae5cb409..71658544382 100644
--- a/app/assets/javascripts/environments/components/deployment.vue
+++ b/app/assets/javascripts/environments/components/deployment.vue
@@ -47,6 +47,9 @@ export default {
commit() {
return this.deployment?.commit;
},
+ commitPath() {
+ return this.commit?.commitPath;
+ },
user() {
return this.deployment?.user;
},
@@ -147,7 +150,9 @@ export default {
class="gl-font-monospace gl-display-flex gl-align-items-center"
>
<gl-icon ref="deployment-commit-icon" name="commit" class="gl-mr-2" />
- <span v-gl-tooltip :title="$options.i18n.commitSha">{{ shortSha }}</span>
+ <gl-link v-gl-tooltip :title="$options.i18n.commitSha" :href="commitPath">
+ {{ shortSha }}
+ </gl-link>
<clipboard-button
:text="shortSha"
category="tertiary"
diff --git a/doc/administration/auth/ldap/ldap-troubleshooting.md b/doc/administration/auth/ldap/ldap-troubleshooting.md
index 702599e0f6e..818c389da51 100644
--- a/doc/administration/auth/ldap/ldap-troubleshooting.md
+++ b/doc/administration/auth/ldap/ldap-troubleshooting.md
@@ -5,7 +5,9 @@ group: Authentication and Authorization
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# LDAP Troubleshooting for Administrators **(FREE SELF)**
+# Troubleshooting LDAP **(FREE SELF)**
+
+If you are an administrator, use the following information to troubleshoot LDAP.
## Common Problems & Workflows
diff --git a/doc/administration/whats-new.md b/doc/administration/whats-new.md
index 9f0b58611ee..d7b5c35b1a8 100644
--- a/doc/administration/whats-new.md
+++ b/doc/administration/whats-new.md
@@ -32,13 +32,13 @@ You can configure **What's new** to display features based on the tier,
or you can hide it. To configure it:
1. On the top bar, select **Menu > Admin**.
-1. On the left sidebar, select **Settings > Preferences**, then expand **What's new**.
-1. Choose one of the following options:
+1. On the left sidebar, select **Settings > Preferences**.
+1. Expand **What's new**, and choose one of the following options:
| Option | Description |
| ------ | ----------- |
- | Enable What's new: All tiers | What's new presents new features from all tiers to help you keep track of all new features. |
- | Enable What's new: Current tier only | What's new presents new features for your current subscription tier, while hiding new features not available to your subscription tier. |
- | Disable What's new | What's new is disabled and can no longer be viewed. |
+ | Enable What's new: All tiers | Presents new features from all tiers. |
+ | Enable What's new: Current tier only | Presents new features for your current subscription tier, and hides new features outside of your tier. |
+ | Disable What's new | Disables this feature, so it no longer displays under the **{question}** icon. |
1. Select **Save changes**.
diff --git a/doc/development/database/database_debugging.md b/doc/development/database/database_debugging.md
index 5921dc942f2..591e526cc96 100644
--- a/doc/development/database/database_debugging.md
+++ b/doc/development/database/database_debugging.md
@@ -4,7 +4,7 @@ group: Database
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# Troubleshooting and Debugging Database
+# Troubleshooting and debugging the database
This section is to help give some copy-pasta you can use as a reference when you
run into some head-banging database problems.
diff --git a/doc/development/documentation/topic_types/troubleshooting.md b/doc/development/documentation/topic_types/troubleshooting.md
index 9e8e3f3792b..35187bd892e 100644
--- a/doc/development/documentation/topic_types/troubleshooting.md
+++ b/doc/development/documentation/topic_types/troubleshooting.md
@@ -8,7 +8,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
Troubleshooting topics should be the last topics on a page.
-If a page has more than five troubleshooting topics, put the content on a separate page that has troubleshooting information exclusively. Name the page `Troubleshoot <featurename>`
+If a page has more than five troubleshooting topics, put the content on a separate page that has troubleshooting information exclusively. Name the page `Troubleshooting <feature>`
and in the left nav, use the word `Troubleshoot` only.
Troubleshooting can be one of three types.
diff --git a/doc/development/fe_guide/troubleshooting.md b/doc/development/fe_guide/troubleshooting.md
index c0894621ed1..ab10c5bf988 100644
--- a/doc/development/fe_guide/troubleshooting.md
+++ b/doc/development/fe_guide/troubleshooting.md
@@ -4,7 +4,7 @@ group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# Troubleshooting
+# Troubleshooting frontend development issues
Running into a problem? Maybe this will help ¯\_(ツ)_/¯.
diff --git a/doc/development/service_ping/troubleshooting.md b/doc/development/service_ping/troubleshooting.md
index 29ab334f867..0653e4299bf 100644
--- a/doc/development/service_ping/troubleshooting.md
+++ b/doc/development/service_ping/troubleshooting.md
@@ -4,7 +4,7 @@ group: Product Intelligence
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# Troubleshooting
+# Troubleshooting Service Ping
## Service Ping Payload drop
diff --git a/doc/development/snowplow/troubleshooting.md b/doc/development/snowplow/troubleshooting.md
index 42a433e6a94..f1425ffbf0e 100644
--- a/doc/development/snowplow/troubleshooting.md
+++ b/doc/development/snowplow/troubleshooting.md
@@ -4,7 +4,7 @@ group: Product Intelligence
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# Troubleshooting
+# Troubleshooting Snowplow
## Good events drop
diff --git a/doc/development/testing_guide/end_to_end/index.md b/doc/development/testing_guide/end_to_end/index.md
index 0eb7f0645bd..40d610cfffc 100644
--- a/doc/development/testing_guide/end_to_end/index.md
+++ b/doc/development/testing_guide/end_to_end/index.md
@@ -100,22 +100,19 @@ A feature proposal to segregate access control regarding running pipelines from
#### With merged results pipelines
In a merged results pipeline, the pipeline runs on a new ref that contains the merge result of the source and target branch.
-However, this ref is not available to the `gitlab-qa-mirror` pipeline.
-For this reason, the end-to-end tests on a merged results pipeline would use the head of the merge request source branch.
+The end-to-end tests on a merged results pipeline would use the new ref instead of the head of the merge request source branch.
```mermaid
graph LR
-A["a1b1c1 - branch HEAD (CI_MERGE_REQUEST_SOURCE_BRANCH_SHA)"]
-B["x1y1z1 - master HEAD"]
-C["d1e1f1 - merged results (CI_COMMIT_SHA)"]
+A["x1y1z1 - master HEAD"]
+B["d1e1f1 - merged results (CI_COMMIT_SHA)"]
-A --> C
-B --> C
+A --> B
-A --> E["E2E tests"]
-C --> D["Merged results pipeline"]
+B --> C["Merged results pipeline"]
+C --> D["E2E tests"]
```
##### Running custom tests
diff --git a/doc/integration/advanced_search/elasticsearch_troubleshooting.md b/doc/integration/advanced_search/elasticsearch_troubleshooting.md
index 4db8d5d7647..7fa297cda15 100644
--- a/doc/integration/advanced_search/elasticsearch_troubleshooting.md
+++ b/doc/integration/advanced_search/elasticsearch_troubleshooting.md
@@ -5,7 +5,7 @@ group: Global Search
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
-# Elasticsearch troubleshooting **(PREMIUM SELF)**
+# Troubleshooting Elasticsearch **(PREMIUM SELF)**
Use the following information to troubleshoot Elasticsearch issues.
diff --git a/doc/user/application_security/dast/dast_troubleshooting.md b/doc/user/application_security/dast/dast_troubleshooting.md
index 0c7a9806c72..4e87f1898cc 100644
--- a/doc/user/application_security/dast/dast_troubleshooting.md
+++ b/doc/user/application_security/dast/dast_troubleshooting.md
@@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
type: reference, howto
---
-# Dynamic Application Security Testing (DAST) Troubleshooting **(ULTIMATE)**
+# Troubleshooting Dynamic Application Security Testing (DAST) **(ULTIMATE)**
The following troubleshooting scenarios have been collected from customer support cases. If you
experience a problem not addressed here, or the information here does not fix your problem, create a
diff --git a/scripts/build_assets_image b/scripts/build_assets_image
index 60bd9190b74..8aa6526061a 100755
--- a/scripts/build_assets_image
+++ b/scripts/build_assets_image
@@ -19,12 +19,8 @@ cp -r public/assets assets_container.build/public/
cp Dockerfile.assets assets_container.build/
COMMIT_REF_SLUG_DESTINATION=${ASSETS_IMAGE_PATH}:${CI_COMMIT_REF_SLUG}
-# Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA (MR HEAD commit) so that the image is in sync with Omnibus/CNG images.
-# Background: Due to the fact that we cannot retrieve the Merged Commit in the downstream omnibus/CNG pipelines,
-# we're building the Omnibus/CNG images for the MR HEAD commit.
-# In turn, the assets image also needs to be built from the MR HEAD commit, so that everything is build from the same commit.
-# For non-MR commits, we fallback to $CI_COMMIT_SHA.
-COMMIT_SHA_DESTINATION=${ASSETS_IMAGE_PATH}:${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}
+
+COMMIT_SHA_DESTINATION=${ASSETS_IMAGE_PATH}:${CI_COMMIT_SHA}
COMMIT_REF_NAME_DESTINATION=${ASSETS_IMAGE_PATH}:${CI_COMMIT_REF_NAME}
DESTINATIONS="--destination=$COMMIT_REF_SLUG_DESTINATION --destination=$COMMIT_SHA_DESTINATION"
diff --git a/scripts/checkout-mr-source-sha b/scripts/checkout-mr-source-sha
deleted file mode 100755
index 962e3f1348d..00000000000
--- a/scripts/checkout-mr-source-sha
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" ]; then
- echo "Checking out \$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA ($CI_MERGE_REQUEST_SOURCE_BRANCH_SHA) instead of \$CI_COMMIT_SHA (merge result commit $CI_COMMIT_SHA) so that code is in sync with gitlab images built upstream."
- echo "See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/index.html#with-pipeline-for-merged-results for more details."
- git checkout -f ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}
-fi
diff --git a/scripts/generate-e2e-pipeline b/scripts/generate-e2e-pipeline
index 0588b923b3b..b6519eff621 100755
--- a/scripts/generate-e2e-pipeline
+++ b/scripts/generate-e2e-pipeline
@@ -15,7 +15,7 @@ fi
variables=$(cat <<YML
variables:
- RELEASE: "${CI_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}"
+ RELEASE: "${CI_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:${CI_COMMIT_SHA}"
SKIP_REPORT_IN_ISSUES: "${SKIP_REPORT_IN_ISSUES:-true}"
OMNIBUS_GITLAB_CACHE_UPDATE: "${OMNIBUS_GITLAB_CACHE_UPDATE:-false}"
COLORIZED_LOGS: "true"
diff --git a/scripts/trigger-build.rb b/scripts/trigger-build.rb
index 03d789e5dae..75f3967cb4a 100755
--- a/scripts/trigger-build.rb
+++ b/scripts/trigger-build.rb
@@ -144,12 +144,10 @@ module Trigger
end
def base_variables
- # Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA for omnibus checkouts due to pipeline for merged results,
- # and fallback to CI_COMMIT_SHA for the `detached` pipelines.
{
'GITLAB_REF_SLUG' => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : ENV['CI_COMMIT_REF_SLUG'],
'TRIGGERED_USER' => ENV['TRIGGERED_USER'] || ENV['GITLAB_USER_NAME'],
- 'TOP_UPSTREAM_SOURCE_SHA' => Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA']
+ 'TOP_UPSTREAM_SOURCE_SHA' => ENV['CI_COMMIT_SHA']
}
end
@@ -186,14 +184,9 @@ module Trigger
end
def extra_variables
- # Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA (MR HEAD commit) so that the image is in sync with the assets and QA images.
- # See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/index.html#with-pipeline-for-merged-results.
- # We also set IMAGE_TAG so the GitLab Docker image is tagged with that SHA.
- source_sha = Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA']
-
{
- 'GITLAB_VERSION' => source_sha,
- 'IMAGE_TAG' => source_sha,
+ 'GITLAB_VERSION' => ENV['CI_COMMIT_SHA'],
+ 'IMAGE_TAG' => ENV['CI_COMMIT_SHA'],
'SKIP_QA_DOCKER' => 'true',
'SKIP_QA_TEST' => 'true',
'ALTERNATIVE_SOURCES' => 'true',
@@ -228,14 +221,11 @@ module Trigger
end
def extra_variables
- # Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA (MR HEAD commit) so that the image is in sync with the assets and QA images.
- source_sha = Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA']
-
{
"TRIGGER_BRANCH" => ref,
- "GITLAB_VERSION" => source_sha,
+ "GITLAB_VERSION" => ENV['CI_COMMIT_SHA'],
"GITLAB_TAG" => ENV['CI_COMMIT_TAG'], # Always set a value, even an empty string, so that the downstream pipeline can correctly check it.
- "GITLAB_ASSETS_TAG" => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : source_sha,
+ "GITLAB_ASSETS_TAG" => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : ENV['CI_COMMIT_SHA'],
"FORCE_RAILS_IMAGE_BUILDS" => 'true',
"CE_PIPELINE" => Trigger.ee? ? nil : "true", # Always set a value, even an empty string, so that the downstream pipeline can correctly check it.
"EE_PIPELINE" => Trigger.ee? ? "true" : nil # Always set a value, even an empty string, so that the downstream pipeline can correctly check it.
@@ -399,9 +389,7 @@ module Trigger
def extra_variables
{
- # Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA for omnibus checkouts due to pipeline for merged results
- # and fallback to CI_COMMIT_SHA for the `detached` pipelines.
- 'GITLAB_COMMIT_SHA' => Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA'],
+ 'GITLAB_COMMIT_SHA' => ENV['CI_COMMIT_SHA'],
'TRIGGERED_USER_LOGIN' => ENV['GITLAB_USER_LOGIN']
}
end
diff --git a/spec/frontend/content_editor/components/bubble_menus/link_bubble_menu_spec.js b/spec/frontend/content_editor/components/bubble_menus/link_bubble_menu_spec.js
index 7f8c770e503..9aa9c6483f4 100644
--- a/spec/frontend/content_editor/components/bubble_menus/link_bubble_menu_spec.js
+++ b/spec/frontend/content_editor/components/bubble_menus/link_bubble_menu_spec.js
@@ -1,11 +1,13 @@
import { GlLink, GlForm } from '@gitlab/ui';
+import { nextTick } from 'vue';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import LinkBubbleMenu from '~/content_editor/components/bubble_menus/link_bubble_menu.vue';
+import EditorStateObserver from '~/content_editor/components/editor_state_observer.vue';
import eventHubFactory from '~/helpers/event_hub_factory';
import BubbleMenu from '~/content_editor/components/bubble_menus/bubble_menu.vue';
import { stubComponent } from 'helpers/stub_component';
import Link from '~/content_editor/extensions/link';
-import { createTestEditor, emitEditorEvent } from '../../test_utils';
+import { createTestEditor } from '../../test_utils';
const createFakeEvent = () => ({ preventDefault: jest.fn(), stopPropagation: jest.fn() });
@@ -13,7 +15,6 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
let wrapper;
let tiptapEditor;
let contentEditor;
- let bubbleMenu;
let eventHub;
const buildEditor = () => {
@@ -35,6 +36,22 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
});
};
+ const showMenu = () => {
+ wrapper.findComponent(BubbleMenu).vm.$emit('show');
+ return nextTick();
+ };
+
+ const buildWrapperAndDisplayMenu = () => {
+ buildWrapper();
+
+ return showMenu();
+ };
+
+ const findBubbleMenu = () => wrapper.findComponent(BubbleMenu);
+ const findLink = () => wrapper.findComponent(GlLink);
+ const findEditorStateObserver = () => wrapper.findComponent(EditorStateObserver);
+ const findEditLinkButton = () => wrapper.findByTestId('edit-link');
+
const expectLinkButtonsToExist = (exist = true) => {
expect(wrapper.findComponent(GlLink).exists()).toBe(exist);
expect(wrapper.findByTestId('copy-link-url').exists()).toBe(exist);
@@ -44,7 +61,6 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
beforeEach(async () => {
buildEditor();
- buildWrapper();
tiptapEditor
.chain()
@@ -53,10 +69,6 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
)
.setTextSelection(14) // put cursor in the middle of the link
.run();
-
- await emitEditorEvent({ event: 'transaction', tiptapEditor });
-
- bubbleMenu = wrapper.findComponent(BubbleMenu);
});
afterEach(() => {
@@ -64,12 +76,15 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
});
it('renders bubble menu component', async () => {
- expect(bubbleMenu.classes()).toEqual(['gl-shadow', 'gl-rounded-base', 'gl-bg-white']);
+ await buildWrapperAndDisplayMenu();
+
+ expect(findBubbleMenu().classes()).toEqual(['gl-shadow', 'gl-rounded-base', 'gl-bg-white']);
});
it('shows a clickable link to the URL in the link node', async () => {
- const link = wrapper.findComponent(GlLink);
- expect(link.attributes()).toEqual(
+ await buildWrapperAndDisplayMenu();
+
+ expect(findLink().attributes()).toEqual(
expect.objectContaining({
href: '/path/to/project/-/wikis/uploads/my_file.pdf',
'aria-label': 'uploads/my_file.pdf',
@@ -77,11 +92,82 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
target: '_blank',
}),
);
- expect(link.text()).toBe('uploads/my_file.pdf');
+ expect(findLink().text()).toBe('uploads/my_file.pdf');
+ });
+
+ it('updates the bubble menu state when @selectionUpdate event is triggered', async () => {
+ const linkUrl = 'https://gitlab.com';
+
+ await buildWrapperAndDisplayMenu();
+
+ expect(findLink().attributes()).toEqual(
+ expect.objectContaining({
+ href: '/path/to/project/-/wikis/uploads/my_file.pdf',
+ }),
+ );
+
+ tiptapEditor
+ .chain()
+ .setContent(
+ `Link to <a href="${linkUrl}" data-canonical-src="${linkUrl}" title="Click here to download">GitLab</a>`,
+ )
+ .setTextSelection(11)
+ .run();
+
+ findEditorStateObserver().vm.$emit('selectionUpdate');
+
+ await nextTick();
+
+ expect(findLink().attributes()).toEqual(
+ expect.objectContaining({
+ href: linkUrl,
+ }),
+ );
+ });
+
+ describe('when the selection changes within the same link', () => {
+ it('does not update the bubble menu state', async () => {
+ await buildWrapperAndDisplayMenu();
+
+ await findEditLinkButton().trigger('click');
+
+ expect(wrapper.findComponent(GlForm).exists()).toBe(true);
+
+ tiptapEditor.commands.setTextSelection(13);
+
+ findEditorStateObserver().vm.$emit('selectionUpdate');
+
+ await nextTick();
+
+ expect(wrapper.findComponent(GlForm).exists()).toBe(true);
+ });
+ });
+
+ it('cleans bubble menu state when hidden event is triggered', async () => {
+ await buildWrapperAndDisplayMenu();
+
+ expect(findLink().attributes()).toEqual(
+ expect.objectContaining({
+ href: '/path/to/project/-/wikis/uploads/my_file.pdf',
+ }),
+ );
+
+ findBubbleMenu().vm.$emit('hidden');
+
+ await nextTick();
+
+ expect(findLink().attributes()).toEqual(
+ expect.objectContaining({
+ href: '#',
+ }),
+ );
+ expect(findLink().text()).toEqual('');
});
describe('copy button', () => {
it('copies the canonical link to clipboard', async () => {
+ await buildWrapperAndDisplayMenu();
+
jest.spyOn(navigator.clipboard, 'writeText');
await wrapper.findByTestId('copy-link-url').vm.$emit('click');
@@ -92,6 +178,7 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
describe('remove link button', () => {
it('removes the link', async () => {
+ await buildWrapperAndDisplayMenu();
await wrapper.findByTestId('remove-link').vm.$emit('click');
expect(tiptapEditor.getHTML()).toBe('<p>Download PDF File</p>');
@@ -109,7 +196,7 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
.setTextSelection(4)
.run();
- await emitEditorEvent({ event: 'transaction', tiptapEditor });
+ await buildWrapperAndDisplayMenu();
});
it('directly opens the edit form for a placeholder link', async () => {
@@ -136,6 +223,7 @@ describe('content_editor/components/bubble_menus/link_bubble_menu', () => {
let linkTitleInput;
beforeEach(async () => {
+ await buildWrapperAndDisplayMenu();
await wrapper.findByTestId('edit-link').vm.$emit('click');
linkHrefInput = wrapper.findByTestId('link-href');
diff --git a/spec/frontend/environments/deployment_spec.js b/spec/frontend/environments/deployment_spec.js
index dff3d9ce285..a825c5bedb5 100644
--- a/spec/frontend/environments/deployment_spec.js
+++ b/spec/frontend/environments/deployment_spec.js
@@ -101,10 +101,11 @@ describe('~/environments/components/deployment.vue', () => {
});
it('shows the short SHA for the commit of the deployment', () => {
- const sha = wrapper.findByTitle(__('Commit SHA'));
+ const sha = wrapper.findByRole('link', { name: __('Commit SHA') });
expect(sha.exists()).toBe(true);
expect(sha.text()).toBe(deployment.commit.shortId);
+ expect(sha.attributes('href')).toBe(deployment.commit.commitPath);
});
it('shows the commit icon', () => {
diff --git a/spec/scripts/trigger-build_spec.rb b/spec/scripts/trigger-build_spec.rb
index f42a728e624..114746c714d 100644
--- a/spec/scripts/trigger-build_spec.rb
+++ b/spec/scripts/trigger-build_spec.rb
@@ -195,33 +195,13 @@ RSpec.describe Trigger do
end
end
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set' do
+ context 'when CI_COMMIT_SHA is set' do
before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', 'ci_merge_request_source_branch_sha')
- end
-
- it 'sets TOP_UPSTREAM_SOURCE_SHA to ci_merge_request_source_branch_sha' do
- expect(subject.variables['TOP_UPSTREAM_SOURCE_SHA']).to eq('ci_merge_request_source_branch_sha')
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set as empty' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', '')
- end
-
- it 'sets TOP_UPSTREAM_SOURCE_SHA to CI_COMMIT_SHA' do
- expect(subject.variables['TOP_UPSTREAM_SOURCE_SHA']).to eq(env['CI_COMMIT_SHA'])
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is not set' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', nil)
+ stub_env('CI_COMMIT_SHA', 'ci_commit_sha')
end
it 'sets TOP_UPSTREAM_SOURCE_SHA to CI_COMMIT_SHA' do
- expect(subject.variables['TOP_UPSTREAM_SOURCE_SHA']).to eq(env['CI_COMMIT_SHA'])
+ expect(subject.variables['TOP_UPSTREAM_SOURCE_SHA']).to eq('ci_commit_sha')
end
end
end
@@ -275,41 +255,15 @@ RSpec.describe Trigger do
)
end
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', 'ci_merge_request_source_branch_sha')
- end
-
- it 'sets GITLAB_VERSION & IMAGE_TAG to ci_merge_request_source_branch_sha' do
- expect(subject.variables).to include(
- 'GITLAB_VERSION' => 'ci_merge_request_source_branch_sha',
- 'IMAGE_TAG' => 'ci_merge_request_source_branch_sha'
- )
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set as empty' do
+ context 'when CI_COMMIT_SHA is set' do
before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', '')
+ stub_env('CI_COMMIT_SHA', 'ci_commit_sha')
end
- it 'sets GITLAB_VERSION & IMAGE_TAG to CI_COMMIT_SHA' do
+ it 'sets GITLAB_VERSION & IMAGE_TAG to ci_commit_sha' do
expect(subject.variables).to include(
- 'GITLAB_VERSION' => env['CI_COMMIT_SHA'],
- 'IMAGE_TAG' => env['CI_COMMIT_SHA']
- )
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is not set' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', nil)
- end
-
- it 'sets GITLAB_VERSION & IMAGE_TAG to CI_COMMIT_SHA' do
- expect(subject.variables).to include(
- 'GITLAB_VERSION' => env['CI_COMMIT_SHA'],
- 'IMAGE_TAG' => env['CI_COMMIT_SHA']
+ 'GITLAB_VERSION' => 'ci_commit_sha',
+ 'IMAGE_TAG' => 'ci_commit_sha'
)
end
end
@@ -483,33 +437,13 @@ RSpec.describe Trigger do
end
describe "GITLAB_VERSION" do
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', 'ci_merge_request_source_branch_sha')
- end
-
- it 'sets GITLAB_VERSION to CI_MERGE_REQUEST_SOURCE_BRANCH_SHA' do
- expect(subject.variables['GITLAB_VERSION']).to eq('ci_merge_request_source_branch_sha')
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set as empty' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', '')
- end
-
- it 'sets GITLAB_VERSION to CI_COMMIT_SHA' do
- expect(subject.variables['GITLAB_VERSION']).to eq(env['CI_COMMIT_SHA'])
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is not set' do
+ context 'when CI_COMMIT_SHA is set' do
before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', nil)
+ stub_env('CI_COMMIT_SHA', 'ci_commit_sha')
end
it 'sets GITLAB_VERSION to CI_COMMIT_SHA' do
- expect(subject.variables['GITLAB_VERSION']).to eq(env['CI_COMMIT_SHA'])
+ expect(subject.variables['GITLAB_VERSION']).to eq('ci_commit_sha')
end
end
end
@@ -547,10 +481,9 @@ RSpec.describe Trigger do
end
end
- context 'when CI_COMMIT_TAG and CI_MERGE_REQUEST_SOURCE_BRANCH_SHA are nil' do
+ context 'when CI_COMMIT_TAG is nil' do
before do
stub_env('CI_COMMIT_TAG', nil)
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', nil)
end
it 'sets GITLAB_ASSETS_TAG to CI_COMMIT_SHA' do
@@ -829,33 +762,13 @@ RSpec.describe Trigger do
end
describe "GITLAB_COMMIT_SHA" do
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', 'ci_merge_request_source_branch_sha')
- end
-
- it 'sets GITLAB_COMMIT_SHA to ci_merge_request_source_branch_sha' do
- expect(subject.variables['GITLAB_COMMIT_SHA']).to eq('ci_merge_request_source_branch_sha')
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set as empty' do
- before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', '')
- end
-
- it 'sets GITLAB_COMMIT_SHA to CI_COMMIT_SHA' do
- expect(subject.variables['GITLAB_COMMIT_SHA']).to eq(env['CI_COMMIT_SHA'])
- end
- end
-
- context 'when CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is not set' do
+ context 'when CI_COMMIT_SHA is set' do
before do
- stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', nil)
+ stub_env('CI_COMMIT_SHA', 'ci_commit_sha')
end
- it 'sets GITLAB_COMMIT_SHA to CI_COMMIT_SHA' do
- expect(subject.variables['GITLAB_COMMIT_SHA']).to eq(env['CI_COMMIT_SHA'])
+ it 'sets GITLAB_COMMIT_SHA to ci_commit_sha' do
+ expect(subject.variables['GITLAB_COMMIT_SHA']).to eq('ci_commit_sha')
end
end
end
diff --git a/workhorse/main_test.go b/workhorse/main_test.go
index ebb9c17999d..5ebc26c7ac7 100644
--- a/workhorse/main_test.go
+++ b/workhorse/main_test.go
@@ -35,7 +35,7 @@ import (
)
const scratchDir = "testdata/scratch"
-const testRepoRoot = "testdata/data"
+const testRepoRoot = "testdata/repo"
const testDocumentRoot = "testdata/public"
const testAltDocumentRoot = "testdata/alt-public"
diff --git a/workhorse/testdata/repo/group/test.git b/workhorse/testdata/repo/group/test.git
new file mode 120000
index 00000000000..5dcbd509206
--- /dev/null
+++ b/workhorse/testdata/repo/group/test.git
@@ -0,0 +1 @@
+../../../../spec/support/gitlab-git-test.git \ No newline at end of file