Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-09-02 09:10:27 +00:00
parent 326e1de67f
commit 423309c4ae
24 changed files with 180 additions and 193 deletions

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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**.

View File

@ -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.

View File

@ -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.

View File

@ -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 ¯\_(ツ)_/¯.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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');

View File

@ -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', () => {

View File

@ -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', '')
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'])
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 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
context 'when CI_COMMIT_SHA is set' do
before do
stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', 'ci_merge_request_source_branch_sha')
stub_env('CI_COMMIT_SHA', 'ci_commit_sha')
end
it 'sets GITLAB_VERSION & IMAGE_TAG to ci_merge_request_source_branch_sha' do
it 'sets GITLAB_VERSION & IMAGE_TAG to ci_commit_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
before do
stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', '')
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']
)
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
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 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', '')
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'])
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 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
context 'when CI_COMMIT_SHA is set' do
before do
stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', 'ci_merge_request_source_branch_sha')
stub_env('CI_COMMIT_SHA', 'ci_commit_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
before do
stub_env('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA', nil)
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

View File

@ -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"

1
workhorse/testdata/repo/group/test.git vendored Symbolic link
View File

@ -0,0 +1 @@
../../../../spec/support/gitlab-git-test.git