Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
5b9b518d9f
commit
f0b765b425
|
|
@ -1,14 +1,17 @@
|
|||
<script>
|
||||
import { GlDropdown, GlDropdownItem, GlDropdownDivider, GlDropdownSectionHeader } from '@gitlab/ui';
|
||||
import { GlDisclosureDropdownGroup, GlDisclosureDropdown } from '@gitlab/ui';
|
||||
import { s__, __ } from '~/locale';
|
||||
import { OPEN_REVERT_MODAL, OPEN_CHERRY_PICK_MODAL } from '../constants';
|
||||
import eventHub from '../event_hub';
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
gitlabTag: s__('CreateTag|Tag'),
|
||||
},
|
||||
|
||||
components: {
|
||||
GlDropdown,
|
||||
GlDropdownItem,
|
||||
GlDropdownDivider,
|
||||
GlDropdownSectionHeader,
|
||||
GlDisclosureDropdown,
|
||||
GlDisclosureDropdownGroup,
|
||||
},
|
||||
inject: {
|
||||
newProjectTagPath: {
|
||||
|
|
@ -43,66 +46,117 @@ export default {
|
|||
showDivider() {
|
||||
return this.canRevert || this.canCherryPick || this.canTag;
|
||||
},
|
||||
cherryPickItem() {
|
||||
return {
|
||||
text: s__('ChangeTypeAction|Cherry-pick'),
|
||||
extraAttrs: {
|
||||
'data-testid': 'cherry-pick-link',
|
||||
'data-qa-selector': 'cherry_pick_button',
|
||||
},
|
||||
action: () => this.showModal(OPEN_CHERRY_PICK_MODAL),
|
||||
};
|
||||
},
|
||||
|
||||
revertLinkItem() {
|
||||
return {
|
||||
text: s__('ChangeTypeAction|Revert'),
|
||||
extraAttrs: {
|
||||
'data-testid': 'revert-link',
|
||||
'data-qa-selector': 'revert_button',
|
||||
},
|
||||
action: () => this.showModal(OPEN_REVERT_MODAL),
|
||||
};
|
||||
},
|
||||
|
||||
tagLinkItem() {
|
||||
return {
|
||||
text: s__('CreateTag|Tag'),
|
||||
href: this.newProjectTagPath,
|
||||
extraAttrs: {
|
||||
'data-testid': 'tag-link',
|
||||
},
|
||||
};
|
||||
},
|
||||
plainDiffItem() {
|
||||
return {
|
||||
text: s__('DownloadCommit|Plain Diff'),
|
||||
href: this.plainDiffPath,
|
||||
extraAttrs: {
|
||||
download: '',
|
||||
rel: 'nofollow',
|
||||
'data-testid': 'plain-diff-link',
|
||||
'data-qa-selector': 'plain_diff',
|
||||
},
|
||||
};
|
||||
},
|
||||
patchesItem() {
|
||||
return {
|
||||
text: __('Patches'),
|
||||
href: this.emailPatchesPath,
|
||||
extraAttrs: {
|
||||
download: '',
|
||||
rel: 'nofollow',
|
||||
'data-testid': 'email-patches-link',
|
||||
'data-qa-selector': 'email_patches',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
downloadsGroup() {
|
||||
const items = [];
|
||||
if (this.canEmailPatches) {
|
||||
items.push(this.patchesItem);
|
||||
}
|
||||
items.push(this.plainDiffItem);
|
||||
return {
|
||||
name: __('Downloads'),
|
||||
items,
|
||||
};
|
||||
},
|
||||
|
||||
optionsGroup() {
|
||||
const items = [];
|
||||
if (this.canRevert) {
|
||||
items.push(this.revertLinkItem);
|
||||
}
|
||||
if (this.canCherryPick) {
|
||||
items.push(this.cherryPickItem);
|
||||
}
|
||||
if (this.canTag) {
|
||||
items.push(this.tagLinkItem);
|
||||
}
|
||||
return {
|
||||
items,
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
showModal(modalId) {
|
||||
eventHub.$emit(modalId);
|
||||
},
|
||||
closeDropdown() {
|
||||
this.$refs.userDropdown.close();
|
||||
},
|
||||
},
|
||||
openRevertModal: OPEN_REVERT_MODAL,
|
||||
openCherryPickModal: OPEN_CHERRY_PICK_MODAL,
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<gl-dropdown
|
||||
:text="__('Options')"
|
||||
<gl-disclosure-dropdown
|
||||
ref="userDropdown"
|
||||
:toggle-text="__('Options')"
|
||||
right
|
||||
data-testid="commit-options-dropdown"
|
||||
data-qa-selector="options_button"
|
||||
class="gl-xs-w-full"
|
||||
class="gl-xs-w-full gl-line-height-20"
|
||||
>
|
||||
<gl-dropdown-item
|
||||
v-if="canRevert"
|
||||
data-testid="revert-link"
|
||||
data-qa-selector="revert_button"
|
||||
@click="showModal($options.openRevertModal)"
|
||||
>
|
||||
{{ s__('ChangeTypeAction|Revert') }}
|
||||
</gl-dropdown-item>
|
||||
<gl-dropdown-item
|
||||
v-if="canCherryPick"
|
||||
data-testid="cherry-pick-link"
|
||||
data-qa-selector="cherry_pick_button"
|
||||
@click="showModal($options.openCherryPickModal)"
|
||||
>
|
||||
{{ s__('ChangeTypeAction|Cherry-pick') }}
|
||||
</gl-dropdown-item>
|
||||
<gl-dropdown-item v-if="canTag" :href="newProjectTagPath" data-testid="tag-link">
|
||||
{{ s__('CreateTag|Tag') }}
|
||||
</gl-dropdown-item>
|
||||
<gl-dropdown-divider v-if="showDivider" />
|
||||
<gl-dropdown-section-header>
|
||||
{{ __('Download') }}
|
||||
</gl-dropdown-section-header>
|
||||
<gl-dropdown-item
|
||||
v-if="canEmailPatches"
|
||||
:href="emailPatchesPath"
|
||||
download
|
||||
rel="nofollow"
|
||||
data-testid="email-patches-link"
|
||||
data-qa-selector="email_patches"
|
||||
>
|
||||
{{ __('Patches') }}
|
||||
</gl-dropdown-item>
|
||||
<gl-dropdown-item
|
||||
:href="plainDiffPath"
|
||||
download
|
||||
rel="nofollow"
|
||||
data-testid="plain-diff-link"
|
||||
data-qa-selector="plain_diff"
|
||||
>
|
||||
{{ s__('DownloadCommit|Plain Diff') }}
|
||||
</gl-dropdown-item>
|
||||
</gl-dropdown>
|
||||
<gl-disclosure-dropdown-group :group="optionsGroup" @action="closeDropdown" />
|
||||
|
||||
<gl-disclosure-dropdown-group
|
||||
:bordered="showDivider"
|
||||
:group="downloadsGroup"
|
||||
@action="closeDropdown"
|
||||
/>
|
||||
</gl-disclosure-dropdown>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -590,14 +590,6 @@ module Ci
|
|||
.append(key: 'CI_JOB_URL', value: Gitlab::Routing.url_helpers.project_job_url(project, self))
|
||||
.append(key: 'CI_JOB_TOKEN', value: token.to_s, public: false, masked: true)
|
||||
.append(key: 'CI_JOB_STARTED_AT', value: started_at&.iso8601)
|
||||
|
||||
if Feature.disabled?(:ci_remove_legacy_predefined_variables, project)
|
||||
variables
|
||||
.append(key: 'CI_BUILD_ID', value: id.to_s)
|
||||
.append(key: 'CI_BUILD_TOKEN', value: token.to_s, public: false, masked: true)
|
||||
end
|
||||
|
||||
variables
|
||||
.append(key: 'CI_REGISTRY_USER', value: ::Gitlab::Auth::CI_JOB_USER)
|
||||
.append(key: 'CI_REGISTRY_PASSWORD', value: token.to_s, public: false, masked: true)
|
||||
.append(key: 'CI_REPOSITORY_URL', value: repo_url.to_s, public: false)
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: ci_remove_legacy_predefined_variables
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/116606
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/404533
|
||||
milestone: '15.11'
|
||||
type: development
|
||||
group: group::pipeline authoring
|
||||
default_enabled: true
|
||||
|
|
@ -139,14 +139,6 @@ module Gitlab
|
|||
|
||||
# Set environment name here so we can access it when evaluating the job's rules
|
||||
variables.append(key: 'CI_ENVIRONMENT_NAME', value: job.environment) if job.environment
|
||||
|
||||
if Feature.disabled?(:ci_remove_legacy_predefined_variables, project)
|
||||
# legacy variables
|
||||
variables.append(key: 'CI_BUILD_NAME', value: job.name)
|
||||
variables.append(key: 'CI_BUILD_STAGE', value: job.stage_name)
|
||||
variables.append(key: 'CI_BUILD_TRIGGERED', value: 'true') if job.trigger_request
|
||||
variables.append(key: 'CI_BUILD_MANUAL', value: 'true') if job.action?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ module Gitlab
|
|||
|
||||
attr_reader :pipeline
|
||||
|
||||
def predefined_commit_variables # rubocop:disable Metrics/AbcSize - Remove this rubocop:disable when FF `ci_remove_legacy_predefined_variables` is removed.
|
||||
def predefined_commit_variables
|
||||
Gitlab::Ci::Variables::Collection.new.tap do |variables|
|
||||
next variables unless pipeline.sha.present?
|
||||
|
||||
|
|
@ -56,24 +56,10 @@ module Gitlab
|
|||
variables.append(key: 'CI_COMMIT_REF_PROTECTED', value: (!!pipeline.protected_ref?).to_s)
|
||||
variables.append(key: 'CI_COMMIT_TIMESTAMP', value: pipeline.git_commit_timestamp.to_s)
|
||||
variables.append(key: 'CI_COMMIT_AUTHOR', value: pipeline.git_author_full_text.to_s)
|
||||
|
||||
if Feature.disabled?(:ci_remove_legacy_predefined_variables, pipeline.project)
|
||||
variables.concat(legacy_predefined_commit_variables)
|
||||
end
|
||||
end
|
||||
end
|
||||
strong_memoize_attr :predefined_commit_variables
|
||||
|
||||
def legacy_predefined_commit_variables
|
||||
Gitlab::Ci::Variables::Collection.new.tap do |variables|
|
||||
variables.append(key: 'CI_BUILD_REF', value: pipeline.sha)
|
||||
variables.append(key: 'CI_BUILD_BEFORE_SHA', value: pipeline.before_sha)
|
||||
variables.append(key: 'CI_BUILD_REF_NAME', value: pipeline.source_ref)
|
||||
variables.append(key: 'CI_BUILD_REF_SLUG', value: pipeline.source_ref_slug)
|
||||
end
|
||||
end
|
||||
strong_memoize_attr :legacy_predefined_commit_variables
|
||||
|
||||
def predefined_commit_tag_variables
|
||||
Gitlab::Ci::Variables::Collection.new.tap do |variables|
|
||||
git_tag = pipeline.project.repository.find_tag(pipeline.ref)
|
||||
|
|
@ -82,21 +68,10 @@ module Gitlab
|
|||
|
||||
variables.append(key: 'CI_COMMIT_TAG', value: pipeline.ref)
|
||||
variables.append(key: 'CI_COMMIT_TAG_MESSAGE', value: git_tag.message)
|
||||
|
||||
if Feature.disabled?(:ci_remove_legacy_predefined_variables, pipeline.project)
|
||||
variables.concat(legacy_predefined_commit_tag_variables)
|
||||
end
|
||||
end
|
||||
end
|
||||
strong_memoize_attr :predefined_commit_tag_variables
|
||||
|
||||
def legacy_predefined_commit_tag_variables
|
||||
Gitlab::Ci::Variables::Collection.new.tap do |variables|
|
||||
variables.append(key: 'CI_BUILD_TAG', value: pipeline.ref)
|
||||
end
|
||||
end
|
||||
strong_memoize_attr :legacy_predefined_commit_tag_variables
|
||||
|
||||
def predefined_merge_request_variables
|
||||
Gitlab::Ci::Variables::Collection.new.tap do |variables|
|
||||
variables.append(key: 'CI_MERGE_REQUEST_EVENT_TYPE', value: pipeline.merge_request_event_type.to_s)
|
||||
|
|
|
|||
|
|
@ -16251,6 +16251,9 @@ msgstr ""
|
|||
msgid "DownloadSource|Download"
|
||||
msgstr ""
|
||||
|
||||
msgid "Downloads"
|
||||
msgstr ""
|
||||
|
||||
msgid "Downstream"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ module QA
|
|||
end
|
||||
|
||||
def go_to_repository_contributors
|
||||
return go_to_contributor_statistics if Runtime::Env.super_sidebar_enabled?
|
||||
|
||||
hover_repository do
|
||||
within_submenu do
|
||||
click_element(:sidebar_menu_item_link, menu_item: 'Contributor statistics')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import { GlDropdownDivider, GlDropdownSectionHeader } from '@gitlab/ui';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
|
||||
import { mountExtended } from 'helpers/vue_test_utils_helper';
|
||||
import CommitOptionsDropdown from '~/projects/commit/components/commit_options_dropdown.vue';
|
||||
import { OPEN_REVERT_MODAL, OPEN_CHERRY_PICK_MODAL } from '~/projects/commit/constants';
|
||||
import eventHub from '~/projects/commit/event_hub';
|
||||
|
|
@ -14,18 +12,16 @@ describe('BranchesDropdown', () => {
|
|||
};
|
||||
|
||||
const createComponent = (props = {}) => {
|
||||
wrapper = extendedWrapper(
|
||||
shallowMount(CommitOptionsDropdown, {
|
||||
provide,
|
||||
propsData: {
|
||||
canRevert: true,
|
||||
canCherryPick: true,
|
||||
canTag: true,
|
||||
canEmailPatches: true,
|
||||
...props,
|
||||
},
|
||||
}),
|
||||
);
|
||||
wrapper = mountExtended(CommitOptionsDropdown, {
|
||||
provide,
|
||||
propsData: {
|
||||
canRevert: true,
|
||||
canCherryPick: true,
|
||||
canTag: true,
|
||||
canEmailPatches: true,
|
||||
...props,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const findRevertLink = () => wrapper.findByTestId('revert-link');
|
||||
|
|
@ -33,8 +29,6 @@ describe('BranchesDropdown', () => {
|
|||
const findTagItem = () => wrapper.findByTestId('tag-link');
|
||||
const findEmailPatchesItem = () => wrapper.findByTestId('email-patches-link');
|
||||
const findPlainDiffItem = () => wrapper.findByTestId('plain-diff-link');
|
||||
const findDivider = () => wrapper.findComponent(GlDropdownDivider);
|
||||
const findSectionHeader = () => wrapper.findComponent(GlDropdownSectionHeader);
|
||||
|
||||
describe('Everything enabled', () => {
|
||||
beforeEach(() => {
|
||||
|
|
@ -42,7 +36,7 @@ describe('BranchesDropdown', () => {
|
|||
});
|
||||
|
||||
it('has expected dropdown button text', () => {
|
||||
expect(wrapper.attributes('text')).toBe('Options');
|
||||
expect(wrapper.findByTestId('base-dropdown-toggle').text()).toBe('Options');
|
||||
});
|
||||
|
||||
it('has expected items', () => {
|
||||
|
|
@ -51,8 +45,6 @@ describe('BranchesDropdown', () => {
|
|||
findRevertLink().exists(),
|
||||
findCherryPickLink().exists(),
|
||||
findTagItem().exists(),
|
||||
findDivider().exists(),
|
||||
findSectionHeader().exists(),
|
||||
findEmailPatchesItem().exists(),
|
||||
findPlainDiffItem().exists(),
|
||||
].every((exists) => exists),
|
||||
|
|
@ -94,7 +86,6 @@ describe('BranchesDropdown', () => {
|
|||
it('only has the download items', () => {
|
||||
createComponent({ canRevert: false, canCherryPick: false, canTag: false });
|
||||
|
||||
expect(findDivider().exists()).toBe(false);
|
||||
expect(findEmailPatchesItem().exists()).toBe(true);
|
||||
expect(findPlainDiffItem().exists()).toBe(true);
|
||||
});
|
||||
|
|
@ -109,13 +100,13 @@ describe('BranchesDropdown', () => {
|
|||
});
|
||||
|
||||
it('emits openModal for revert', () => {
|
||||
findRevertLink().vm.$emit('click');
|
||||
findRevertLink().trigger('click');
|
||||
|
||||
expect(spy).toHaveBeenCalledWith(OPEN_REVERT_MODAL);
|
||||
});
|
||||
|
||||
it('emits openModal for cherry-pick', () => {
|
||||
findCherryPickLink().vm.$emit('click');
|
||||
findCherryPickLink().trigger('click');
|
||||
|
||||
expect(spy).toHaveBeenCalledWith(OPEN_CHERRY_PICK_MODAL);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,28 +14,12 @@ RSpec.describe Gitlab::Ci::Build::Context::Build, feature_category: :pipeline_co
|
|||
it { is_expected.to include('CI_PROJECT_PATH' => pipeline.project.full_path) }
|
||||
it { is_expected.to include('CI_JOB_NAME' => 'some-job') }
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it { is_expected.to include('CI_BUILD_REF_NAME' => 'master') }
|
||||
end
|
||||
|
||||
context 'without passed build-specific attributes' do
|
||||
let(:context) { described_class.new(pipeline) }
|
||||
|
||||
it { is_expected.to include('CI_JOB_NAME' => nil) }
|
||||
it { is_expected.to include('CI_COMMIT_REF_NAME' => 'master') }
|
||||
it { is_expected.to include('CI_PROJECT_PATH' => pipeline.project.full_path) }
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it { is_expected.to include('CI_BUILD_REF_NAME' => 'master') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when environment:name is provided' do
|
||||
|
|
|
|||
|
|
@ -15,14 +15,6 @@ RSpec.describe Gitlab::Ci::Build::Context::Global, feature_category: :pipeline_c
|
|||
|
||||
it { is_expected.not_to have_key('CI_JOB_NAME') }
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it { is_expected.not_to have_key('CI_BUILD_REF_NAME') }
|
||||
end
|
||||
|
||||
context 'with passed yaml variables' do
|
||||
let(:yaml_variables) { [{ key: 'SUPPORTED', value: 'parsed', public: true }] }
|
||||
|
||||
|
|
|
|||
|
|
@ -909,30 +909,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build, feature_category: :pipeline_co
|
|||
end
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
context 'with an explicit `when: on_failure`' do
|
||||
where(:rule_set) do
|
||||
[
|
||||
[[{ if: '$CI_JOB_NAME == "rspec" && $VAR == null', when: 'on_failure' }]],
|
||||
[[{ if: '$VARIABLE != null', when: 'delayed', start_in: '1 day' }, { if: '$CI_JOB_NAME == "rspec"', when: 'on_failure' }]],
|
||||
[[{ if: '$VARIABLE == "the wrong value"', when: 'delayed', start_in: '1 day' }, { if: '$CI_BUILD_NAME == "rspec"', when: 'on_failure' }]]
|
||||
]
|
||||
end
|
||||
|
||||
with_them do
|
||||
it { is_expected.to be_included }
|
||||
|
||||
it 'correctly populates when:' do
|
||||
expect(seed_build.attributes).to include(when: 'on_failure')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with an explicit `when: delayed`' do
|
||||
where(:rule_set) do
|
||||
[
|
||||
|
|
|
|||
|
|
@ -33,38 +33,6 @@ RSpec.describe Gitlab::Ci::Variables::Builder::Pipeline, feature_category: :secr
|
|||
])
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it 'includes all predefined variables in a valid order' do
|
||||
keys = subject.pluck(:key)
|
||||
|
||||
expect(keys).to contain_exactly(*%w[
|
||||
CI_PIPELINE_IID
|
||||
CI_PIPELINE_SOURCE
|
||||
CI_PIPELINE_CREATED_AT
|
||||
CI_COMMIT_SHA
|
||||
CI_COMMIT_SHORT_SHA
|
||||
CI_COMMIT_BEFORE_SHA
|
||||
CI_COMMIT_REF_NAME
|
||||
CI_COMMIT_REF_SLUG
|
||||
CI_COMMIT_BRANCH
|
||||
CI_COMMIT_MESSAGE
|
||||
CI_COMMIT_TITLE
|
||||
CI_COMMIT_DESCRIPTION
|
||||
CI_COMMIT_REF_PROTECTED
|
||||
CI_COMMIT_TIMESTAMP
|
||||
CI_COMMIT_AUTHOR
|
||||
CI_BUILD_REF
|
||||
CI_BUILD_BEFORE_SHA
|
||||
CI_BUILD_REF_NAME
|
||||
CI_BUILD_REF_SLUG
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the pipeline is running for a tag' do
|
||||
let(:pipeline) { build(:ci_empty_pipeline, :created, project: project, ref: 'test', tag: true) }
|
||||
|
||||
|
|
@ -90,40 +58,6 @@ RSpec.describe Gitlab::Ci::Variables::Builder::Pipeline, feature_category: :secr
|
|||
CI_COMMIT_TAG_MESSAGE
|
||||
])
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it 'includes all predefined variables in a valid order' do
|
||||
keys = subject.pluck(:key)
|
||||
|
||||
expect(keys).to contain_exactly(*%w[
|
||||
CI_PIPELINE_IID
|
||||
CI_PIPELINE_SOURCE
|
||||
CI_PIPELINE_CREATED_AT
|
||||
CI_COMMIT_SHA
|
||||
CI_COMMIT_SHORT_SHA
|
||||
CI_COMMIT_BEFORE_SHA
|
||||
CI_COMMIT_REF_NAME
|
||||
CI_COMMIT_REF_SLUG
|
||||
CI_COMMIT_MESSAGE
|
||||
CI_COMMIT_TITLE
|
||||
CI_COMMIT_DESCRIPTION
|
||||
CI_COMMIT_REF_PROTECTED
|
||||
CI_COMMIT_TIMESTAMP
|
||||
CI_COMMIT_AUTHOR
|
||||
CI_BUILD_REF
|
||||
CI_BUILD_BEFORE_SHA
|
||||
CI_BUILD_REF_NAME
|
||||
CI_BUILD_REF_SLUG
|
||||
CI_COMMIT_TAG
|
||||
CI_COMMIT_TAG_MESSAGE
|
||||
CI_BUILD_TAG
|
||||
])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when merge request is present' do
|
||||
|
|
@ -365,21 +299,6 @@ RSpec.describe Gitlab::Ci::Variables::Builder::Pipeline, feature_category: :secr
|
|||
'CI_COMMIT_TAG_MESSAGE'
|
||||
)
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it 'does not expose tag variables' do
|
||||
expect(subject.to_hash.keys)
|
||||
.not_to include(
|
||||
'CI_COMMIT_TAG',
|
||||
'CI_COMMIT_TAG_MESSAGE',
|
||||
'CI_BUILD_TAG'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'without a commit' do
|
||||
|
|
|
|||
|
|
@ -154,151 +154,6 @@ RSpec.describe Gitlab::Ci::Variables::Builder, :clean_gitlab_redis_cache, featur
|
|||
|
||||
it { expect(subject.to_runner_variables).to eq(predefined_variables) }
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
let(:predefined_variables) do
|
||||
[
|
||||
{ key: 'CI_JOB_NAME',
|
||||
value: 'rspec:test 1' },
|
||||
{ key: 'CI_JOB_NAME_SLUG',
|
||||
value: 'rspec-test-1' },
|
||||
{ key: 'CI_JOB_STAGE',
|
||||
value: job.stage_name },
|
||||
{ key: 'CI_NODE_TOTAL',
|
||||
value: '1' },
|
||||
{ key: 'CI_ENVIRONMENT_NAME',
|
||||
value: 'test' },
|
||||
{ key: 'CI_BUILD_NAME',
|
||||
value: 'rspec:test 1' },
|
||||
{ key: 'CI_BUILD_STAGE',
|
||||
value: job.stage_name },
|
||||
{ key: 'CI',
|
||||
value: 'true' },
|
||||
{ key: 'GITLAB_CI',
|
||||
value: 'true' },
|
||||
{ key: 'CI_SERVER_URL',
|
||||
value: Gitlab.config.gitlab.url },
|
||||
{ key: 'CI_SERVER_HOST',
|
||||
value: Gitlab.config.gitlab.host },
|
||||
{ key: 'CI_SERVER_PORT',
|
||||
value: Gitlab.config.gitlab.port.to_s },
|
||||
{ key: 'CI_SERVER_PROTOCOL',
|
||||
value: Gitlab.config.gitlab.protocol },
|
||||
{ key: 'CI_SERVER_SHELL_SSH_HOST',
|
||||
value: Gitlab.config.gitlab_shell.ssh_host.to_s },
|
||||
{ key: 'CI_SERVER_SHELL_SSH_PORT',
|
||||
value: Gitlab.config.gitlab_shell.ssh_port.to_s },
|
||||
{ key: 'CI_SERVER_NAME',
|
||||
value: 'GitLab' },
|
||||
{ key: 'CI_SERVER_VERSION',
|
||||
value: Gitlab::VERSION },
|
||||
{ key: 'CI_SERVER_VERSION_MAJOR',
|
||||
value: Gitlab.version_info.major.to_s },
|
||||
{ key: 'CI_SERVER_VERSION_MINOR',
|
||||
value: Gitlab.version_info.minor.to_s },
|
||||
{ key: 'CI_SERVER_VERSION_PATCH',
|
||||
value: Gitlab.version_info.patch.to_s },
|
||||
{ key: 'CI_SERVER_REVISION',
|
||||
value: Gitlab.revision },
|
||||
{ key: 'GITLAB_FEATURES',
|
||||
value: project.licensed_features.join(',') },
|
||||
{ key: 'CI_PROJECT_ID',
|
||||
value: project.id.to_s },
|
||||
{ key: 'CI_PROJECT_NAME',
|
||||
value: project.path },
|
||||
{ key: 'CI_PROJECT_TITLE',
|
||||
value: project.title },
|
||||
{ key: 'CI_PROJECT_DESCRIPTION',
|
||||
value: project.description },
|
||||
{ key: 'CI_PROJECT_PATH',
|
||||
value: project.full_path },
|
||||
{ key: 'CI_PROJECT_PATH_SLUG',
|
||||
value: project.full_path_slug },
|
||||
{ key: 'CI_PROJECT_NAMESPACE',
|
||||
value: project.namespace.full_path },
|
||||
{ key: 'CI_PROJECT_NAMESPACE_ID',
|
||||
value: project.namespace.id.to_s },
|
||||
{ key: 'CI_PROJECT_ROOT_NAMESPACE',
|
||||
value: project.namespace.root_ancestor.path },
|
||||
{ key: 'CI_PROJECT_URL',
|
||||
value: project.web_url },
|
||||
{ key: 'CI_PROJECT_VISIBILITY',
|
||||
value: "private" },
|
||||
{ key: 'CI_PROJECT_REPOSITORY_LANGUAGES',
|
||||
value: project.repository_languages.map(&:name).join(',').downcase },
|
||||
{ key: 'CI_PROJECT_CLASSIFICATION_LABEL',
|
||||
value: project.external_authorization_classification_label },
|
||||
{ key: 'CI_DEFAULT_BRANCH',
|
||||
value: project.default_branch },
|
||||
{ key: 'CI_CONFIG_PATH',
|
||||
value: project.ci_config_path_or_default },
|
||||
{ key: 'CI_PAGES_DOMAIN',
|
||||
value: Gitlab.config.pages.host },
|
||||
{ key: 'CI_PAGES_URL',
|
||||
value: project.pages_url },
|
||||
{ key: 'CI_API_V4_URL',
|
||||
value: API::Helpers::Version.new('v4').root_url },
|
||||
{ key: 'CI_API_GRAPHQL_URL',
|
||||
value: Gitlab::Routing.url_helpers.api_graphql_url },
|
||||
{ key: 'CI_TEMPLATE_REGISTRY_HOST',
|
||||
value: template_registry_host },
|
||||
{ key: 'CI_PIPELINE_IID',
|
||||
value: pipeline.iid.to_s },
|
||||
{ key: 'CI_PIPELINE_SOURCE',
|
||||
value: pipeline.source },
|
||||
{ key: 'CI_PIPELINE_CREATED_AT',
|
||||
value: pipeline.created_at.iso8601 },
|
||||
{ key: 'CI_COMMIT_SHA',
|
||||
value: job.sha },
|
||||
{ key: 'CI_COMMIT_SHORT_SHA',
|
||||
value: job.short_sha },
|
||||
{ key: 'CI_COMMIT_BEFORE_SHA',
|
||||
value: job.before_sha },
|
||||
{ key: 'CI_COMMIT_REF_NAME',
|
||||
value: job.ref },
|
||||
{ key: 'CI_COMMIT_REF_SLUG',
|
||||
value: job.ref_slug },
|
||||
{ key: 'CI_COMMIT_BRANCH',
|
||||
value: job.ref },
|
||||
{ key: 'CI_COMMIT_MESSAGE',
|
||||
value: pipeline.git_commit_message },
|
||||
{ key: 'CI_COMMIT_TITLE',
|
||||
value: pipeline.git_commit_title },
|
||||
{ key: 'CI_COMMIT_DESCRIPTION',
|
||||
value: pipeline.git_commit_description },
|
||||
{ key: 'CI_COMMIT_REF_PROTECTED',
|
||||
value: (!!pipeline.protected_ref?).to_s },
|
||||
{ key: 'CI_COMMIT_TIMESTAMP',
|
||||
value: pipeline.git_commit_timestamp },
|
||||
{ key: 'CI_COMMIT_AUTHOR',
|
||||
value: pipeline.git_author_full_text },
|
||||
{ key: 'CI_BUILD_REF',
|
||||
value: job.sha },
|
||||
{ key: 'CI_BUILD_BEFORE_SHA',
|
||||
value: job.before_sha },
|
||||
{ key: 'CI_BUILD_REF_NAME',
|
||||
value: job.ref },
|
||||
{ key: 'CI_BUILD_REF_SLUG',
|
||||
value: job.ref_slug },
|
||||
{ key: 'YAML_VARIABLE',
|
||||
value: 'value' },
|
||||
{ key: 'GITLAB_USER_ID',
|
||||
value: user.id.to_s },
|
||||
{ key: 'GITLAB_USER_EMAIL',
|
||||
value: user.email },
|
||||
{ key: 'GITLAB_USER_LOGIN',
|
||||
value: user.username },
|
||||
{ key: 'GITLAB_USER_NAME',
|
||||
value: user.name }
|
||||
].map { |var| var.merge(public: true, masked: false) }
|
||||
end
|
||||
|
||||
it { expect(subject.to_runner_variables).to eq(predefined_variables) }
|
||||
end
|
||||
|
||||
context 'variables ordering' do
|
||||
def var(name, value)
|
||||
{ key: name, value: value.to_s, public: true, masked: false }
|
||||
|
|
|
|||
|
|
@ -1882,20 +1882,6 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
|
|||
it { is_expected.to eq('review/x') }
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
context 'when using persisted variables' do
|
||||
let(:build) do
|
||||
create(:ci_build, environment: 'review/x$CI_BUILD_ID', pipeline: pipeline)
|
||||
end
|
||||
|
||||
it { is_expected.to eq('review/x') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when environment name uses a nested variable' do
|
||||
let(:yaml_variables) do
|
||||
[
|
||||
|
|
@ -2944,97 +2930,6 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
|
|||
]
|
||||
end
|
||||
|
||||
# Remove this definition when FF `ci_remove_legacy_predefined_variables` is removed
|
||||
let(:predefined_with_legacy_variables) do
|
||||
[
|
||||
{ key: 'CI_PIPELINE_ID', value: pipeline.id.to_s, public: true, masked: false },
|
||||
{ key: 'CI_PIPELINE_URL', value: project.web_url + "/-/pipelines/#{pipeline.id}", public: true, masked: false },
|
||||
{ key: 'CI_JOB_ID', value: build.id.to_s, public: true, masked: false },
|
||||
{ key: 'CI_JOB_URL', value: project.web_url + "/-/jobs/#{build.id}", public: true, masked: false },
|
||||
{ key: 'CI_JOB_TOKEN', value: 'my-token', public: false, masked: true },
|
||||
{ key: 'CI_JOB_STARTED_AT', value: build.started_at&.iso8601, public: true, masked: false },
|
||||
{ key: 'CI_BUILD_ID', value: build.id.to_s, public: true, masked: false },
|
||||
{ key: 'CI_BUILD_TOKEN', value: 'my-token', public: false, masked: true },
|
||||
{ key: 'CI_REGISTRY_USER', value: 'gitlab-ci-token', public: true, masked: false },
|
||||
{ key: 'CI_REGISTRY_PASSWORD', value: 'my-token', public: false, masked: true },
|
||||
{ key: 'CI_REPOSITORY_URL', value: build.repo_url, public: false, masked: false },
|
||||
{ key: 'CI_DEPENDENCY_PROXY_USER', value: 'gitlab-ci-token', public: true, masked: false },
|
||||
{ key: 'CI_DEPENDENCY_PROXY_PASSWORD', value: 'my-token', public: false, masked: true },
|
||||
{ key: 'CI_JOB_JWT', value: 'ci.job.jwt', public: false, masked: true },
|
||||
{ key: 'CI_JOB_JWT_V1', value: 'ci.job.jwt', public: false, masked: true },
|
||||
{ key: 'CI_JOB_JWT_V2', value: 'ci.job.jwtv2', public: false, masked: true },
|
||||
{ key: 'CI_JOB_NAME', value: 'test', public: true, masked: false },
|
||||
{ key: 'CI_JOB_NAME_SLUG', value: 'test', public: true, masked: false },
|
||||
{ key: 'CI_JOB_STAGE', value: 'test', public: true, masked: false },
|
||||
{ key: 'CI_NODE_TOTAL', value: '1', public: true, masked: false },
|
||||
{ key: 'CI_BUILD_NAME', value: 'test', public: true, masked: false },
|
||||
{ key: 'CI_BUILD_STAGE', value: 'test', public: true, masked: false },
|
||||
{ key: 'CI', value: 'true', public: true, masked: false },
|
||||
{ key: 'GITLAB_CI', value: 'true', public: true, masked: false },
|
||||
{ key: 'CI_SERVER_URL', value: Gitlab.config.gitlab.url, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_HOST', value: Gitlab.config.gitlab.host, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_PORT', value: Gitlab.config.gitlab.port.to_s, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_PROTOCOL', value: Gitlab.config.gitlab.protocol, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_SHELL_SSH_HOST', value: Gitlab.config.gitlab_shell.ssh_host.to_s, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_SHELL_SSH_PORT', value: Gitlab.config.gitlab_shell.ssh_port.to_s, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_NAME', value: 'GitLab', public: true, masked: false },
|
||||
{ key: 'CI_SERVER_VERSION', value: Gitlab::VERSION, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_VERSION_MAJOR', value: Gitlab.version_info.major.to_s, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_VERSION_MINOR', value: Gitlab.version_info.minor.to_s, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_VERSION_PATCH', value: Gitlab.version_info.patch.to_s, public: true, masked: false },
|
||||
{ key: 'CI_SERVER_REVISION', value: Gitlab.revision, public: true, masked: false },
|
||||
{ key: 'GITLAB_FEATURES', value: project.licensed_features.join(','), public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_ID', value: project.id.to_s, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_NAME', value: project.path, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_TITLE', value: project.title, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_DESCRIPTION', value: project.description, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_PATH', value: project.full_path, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_PATH_SLUG', value: project.full_path_slug, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_NAMESPACE', value: project.namespace.full_path, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_NAMESPACE_ID', value: project.namespace.id.to_s, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_ROOT_NAMESPACE', value: project.namespace.root_ancestor.path, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_URL', value: project.web_url, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_VISIBILITY', value: 'private', public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_REPOSITORY_LANGUAGES', value: project.repository_languages.map(&:name).join(',').downcase, public: true, masked: false },
|
||||
{ key: 'CI_PROJECT_CLASSIFICATION_LABEL', value: project.external_authorization_classification_label, public: true, masked: false },
|
||||
{ key: 'CI_DEFAULT_BRANCH', value: project.default_branch, public: true, masked: false },
|
||||
{ key: 'CI_CONFIG_PATH', value: project.ci_config_path_or_default, public: true, masked: false },
|
||||
{ key: 'CI_PAGES_DOMAIN', value: Gitlab.config.pages.host, public: true, masked: false },
|
||||
{ key: 'CI_PAGES_URL', value: project.pages_url, public: true, masked: false },
|
||||
{ key: 'CI_DEPENDENCY_PROXY_SERVER', value: Gitlab.host_with_port, public: true, masked: false },
|
||||
{ key: 'CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX',
|
||||
value: "#{Gitlab.host_with_port}/#{project.namespace.root_ancestor.path.downcase}#{DependencyProxy::URL_SUFFIX}",
|
||||
public: true,
|
||||
masked: false },
|
||||
{ key: 'CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX',
|
||||
value: "#{Gitlab.host_with_port}/#{project.namespace.full_path.downcase}#{DependencyProxy::URL_SUFFIX}",
|
||||
public: true,
|
||||
masked: false },
|
||||
{ key: 'CI_API_V4_URL', value: 'http://localhost/api/v4', public: true, masked: false },
|
||||
{ key: 'CI_API_GRAPHQL_URL', value: 'http://localhost/api/graphql', public: true, masked: false },
|
||||
{ key: 'CI_TEMPLATE_REGISTRY_HOST', value: template_registry_host, public: true, masked: false },
|
||||
{ key: 'CI_PIPELINE_IID', value: pipeline.iid.to_s, public: true, masked: false },
|
||||
{ key: 'CI_PIPELINE_SOURCE', value: pipeline.source, public: true, masked: false },
|
||||
{ key: 'CI_PIPELINE_CREATED_AT', value: pipeline.created_at.iso8601, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_SHA', value: build.sha, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_SHORT_SHA', value: build.short_sha, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_BEFORE_SHA', value: build.before_sha, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_REF_NAME', value: build.ref, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_REF_SLUG', value: build.ref_slug, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_BRANCH', value: build.ref, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_MESSAGE', value: pipeline.git_commit_message, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_TITLE', value: pipeline.git_commit_title, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_DESCRIPTION', value: pipeline.git_commit_description, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_REF_PROTECTED', value: (!!pipeline.protected_ref?).to_s, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_TIMESTAMP', value: pipeline.git_commit_timestamp, public: true, masked: false },
|
||||
{ key: 'CI_COMMIT_AUTHOR', value: pipeline.git_author_full_text, public: true, masked: false },
|
||||
{ key: 'CI_BUILD_REF', value: build.sha, public: true, masked: false },
|
||||
{ key: 'CI_BUILD_BEFORE_SHA', value: build.before_sha, public: true, masked: false },
|
||||
{ key: 'CI_BUILD_REF_NAME', value: build.ref, public: true, masked: false },
|
||||
{ key: 'CI_BUILD_REF_SLUG', value: build.ref_slug, public: true, masked: false }
|
||||
]
|
||||
end
|
||||
|
||||
before do
|
||||
allow(Gitlab::Ci::Jwt).to receive(:for_build).and_return('ci.job.jwt')
|
||||
allow(Gitlab::Ci::JwtV2).to receive(:for_build).and_return('ci.job.jwtv2')
|
||||
|
|
@ -3045,14 +2940,6 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
|
|||
it { is_expected.to be_instance_of(Gitlab::Ci::Variables::Collection) }
|
||||
it { expect(subject.to_runner_variables).to eq(predefined_variables) }
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it { expect(subject.to_runner_variables).to eq(predefined_with_legacy_variables) }
|
||||
end
|
||||
|
||||
it 'excludes variables that require an environment or user' do
|
||||
environment_based_variables_collection = subject.filter do |variable|
|
||||
%w[
|
||||
|
|
@ -3194,80 +3081,6 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
context 'when build has environment and user-provided variables' do
|
||||
let(:expected_variables) do
|
||||
predefined_with_legacy_variables.map { |variable| variable.fetch(:key) } +
|
||||
%w[YAML_VARIABLE CI_ENVIRONMENT_NAME CI_ENVIRONMENT_SLUG
|
||||
CI_ENVIRONMENT_ACTION CI_ENVIRONMENT_TIER CI_ENVIRONMENT_URL]
|
||||
end
|
||||
|
||||
before do
|
||||
create(:environment, project: build.project, name: 'staging')
|
||||
|
||||
build.yaml_variables = [{ key: 'YAML_VARIABLE', value: 'var', public: true }]
|
||||
build.environment = 'staging'
|
||||
|
||||
# CI_ENVIRONMENT_NAME is set in predefined_variables when job environment is provided
|
||||
predefined_with_legacy_variables.insert(20, { key: 'CI_ENVIRONMENT_NAME', value: 'staging', public: true, masked: false })
|
||||
end
|
||||
|
||||
it 'matches explicit variables ordering' do
|
||||
received_variables = subject.map { |variable| variable[:key] }
|
||||
|
||||
expect(received_variables).to eq expected_variables
|
||||
end
|
||||
|
||||
describe 'CI_ENVIRONMENT_ACTION' do
|
||||
let(:enviroment_action_variable) { subject.find { |variable| variable[:key] == 'CI_ENVIRONMENT_ACTION' } }
|
||||
|
||||
shared_examples 'defaults value' do
|
||||
it 'value matches start' do
|
||||
expect(enviroment_action_variable[:value]).to eq('start')
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'defaults value'
|
||||
|
||||
context 'when options is set' do
|
||||
before do
|
||||
build.update!(options: options)
|
||||
end
|
||||
|
||||
context 'when options is empty' do
|
||||
let(:options) { {} }
|
||||
|
||||
it_behaves_like 'defaults value'
|
||||
end
|
||||
|
||||
context 'when options is nil' do
|
||||
let(:options) { nil }
|
||||
|
||||
it_behaves_like 'defaults value'
|
||||
end
|
||||
|
||||
context 'when options environment is specified' do
|
||||
let(:options) { { environment: {} } }
|
||||
|
||||
it_behaves_like 'defaults value'
|
||||
end
|
||||
|
||||
context 'when options environment action specified' do
|
||||
let(:options) { { environment: { action: 'stop' } } }
|
||||
|
||||
it 'matches the specified action' do
|
||||
expect(enviroment_action_variable[:value]).to eq('stop')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the build has ID tokens' do
|
||||
|
|
@ -4114,30 +3927,6 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
|
|||
expect(names).not_to include(*keys)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
it 'does not return prohibited variables' do
|
||||
keys = %w[CI_JOB_ID
|
||||
CI_JOB_URL
|
||||
CI_JOB_TOKEN
|
||||
CI_BUILD_ID
|
||||
CI_BUILD_TOKEN
|
||||
CI_REGISTRY_USER
|
||||
CI_REGISTRY_PASSWORD
|
||||
CI_REPOSITORY_URL
|
||||
CI_ENVIRONMENT_URL
|
||||
CI_DEPLOY_USER
|
||||
CI_DEPLOY_PASSWORD]
|
||||
|
||||
build.scoped_variables.map { |env| env[:key] }.tap do |names|
|
||||
expect(names).not_to include(*keys)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with dependency variables' do
|
||||
|
|
|
|||
|
|
@ -810,32 +810,6 @@ RSpec.describe Ci::CreatePipelineService, :yaml_processor_feature_flag_corectnes
|
|||
end
|
||||
end
|
||||
|
||||
context 'when FF `ci_remove_legacy_predefined_variables` is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_remove_legacy_predefined_variables: false)
|
||||
end
|
||||
|
||||
context 'with environment name including persisted variables' do
|
||||
before do
|
||||
config = YAML.dump(
|
||||
deploy: {
|
||||
environment: { name: "review/id1$CI_PIPELINE_ID/id2$CI_BUILD_ID" },
|
||||
script: 'ls'
|
||||
}
|
||||
)
|
||||
|
||||
stub_ci_pipeline_yaml_file(config)
|
||||
end
|
||||
|
||||
it 'skips persisted variables in environment name' do
|
||||
result = execute_service.payload
|
||||
|
||||
expect(result).to be_persisted
|
||||
expect(Environment.find_by(name: "review/id1/id2")).to be_present
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'environment with Kubernetes configuration' do
|
||||
let(:kubernetes_namespace) { 'custom-namespace' }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue