Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
14fc739c
Commit
14fc739c
authored
Oct 30, 2018
by
Marcel Amirault
Committed by
Grzegorz Bizon
Oct 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming Secret Variables in the codebase
parent
c71c1f03
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
69 additions
and
64 deletions
+69
-64
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
app/assets/javascripts/ci_variable_list/ajax_variable_list.js
...assets/javascripts/ci_variable_list/ajax_variable_list.js
+1
-1
app/assets/javascripts/pages/groups/settings/ci_cd/show/index.js
...ets/javascripts/pages/groups/settings/ci_cd/show/index.js
+1
-1
app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
...s/javascripts/pages/projects/settings/ci_cd/show/index.js
+1
-1
app/controllers/groups/settings/ci_cd_controller.rb
app/controllers/groups/settings/ci_cd_controller.rb
+2
-2
app/controllers/projects/settings/ci_cd_controller.rb
app/controllers/projects/settings/ci_cd_controller.rb
+2
-2
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/models/group.rb
app/models/group.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
app/views/ci/variables/_index.html.haml
app/views/ci/variables/_index.html.haml
+2
-2
app/views/groups/settings/ci_cd/show.html.haml
app/views/groups/settings/ci_cd/show.html.haml
+1
-1
changelogs/unreleased/ravlen-rename-secret-variables-in-codebase.yml
...unreleased/ravlen-rename-secret-variables-in-codebase.yml
+5
-0
qa/qa.rb
qa/qa.rb
+2
-2
qa/qa/factory/resource/ci_variable.rb
qa/qa/factory/resource/ci_variable.rb
+4
-4
qa/qa/page/project/settings/ci_cd.rb
qa/qa/page/project/settings/ci_cd.rb
+2
-2
qa/qa/page/project/settings/ci_variables.rb
qa/qa/page/project/settings/ci_variables.rb
+3
-3
qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
...s/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
+7
-7
qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
...er_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
+1
-1
qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb
...igure/auto_devops/create_project_with_auto_devops_spec.rb
+1
-1
spec/javascripts/ci_variable_list/ajax_variable_list_spec.js
spec/javascripts/ci_variable_list/ajax_variable_list_spec.js
+3
-3
spec/lib/gitlab/ci/build/policy/variables_spec.rb
spec/lib/gitlab/ci/build/policy/variables_spec.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+10
-10
spec/models/group_spec.rb
spec/models/group_spec.rb
+8
-8
spec/models/project_spec.rb
spec/models/project_spec.rb
+6
-6
spec/support/features/variable_list_shared_examples.rb
spec/support/features/variable_list_shared_examples.rb
+1
-1
No files found.
.gitlab-ci.yml
View file @
14fc739c
...
@@ -265,7 +265,7 @@ package-and-qa:
...
@@ -265,7 +265,7 @@ package-and-qa:
SCRIPT_NAME
:
trigger-build-docs
SCRIPT_NAME
:
trigger-build-docs
environment
:
environment
:
name
:
review-docs/$CI_COMMIT_REF_SLUG
name
:
review-docs/$CI_COMMIT_REF_SLUG
# DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are
secret
variables
# DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are
CI
variables
# Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693
# Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693
url
:
http://$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX
url
:
http://$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX
on_stop
:
review-docs-cleanup
on_stop
:
review-docs-cleanup
...
...
app/assets/javascripts/ci_variable_list/ajax_variable_list.js
View file @
14fc739c
...
@@ -47,7 +47,7 @@ export default class AjaxVariableList {
...
@@ -47,7 +47,7 @@ export default class AjaxVariableList {
}
}
onSaveClicked
()
{
onSaveClicked
()
{
const
loadingIcon
=
this
.
saveButton
.
querySelector
(
'
.js-
secret
-variables-save-loading-icon
'
);
const
loadingIcon
=
this
.
saveButton
.
querySelector
(
'
.js-
ci
-variables-save-loading-icon
'
);
loadingIcon
.
classList
.
toggle
(
'
hide
'
,
false
);
loadingIcon
.
classList
.
toggle
(
'
hide
'
,
false
);
this
.
errorBox
.
classList
.
toggle
(
'
hide
'
,
true
);
this
.
errorBox
.
classList
.
toggle
(
'
hide
'
,
true
);
// We use this to prevent a user from changing a key before we have a chance
// We use this to prevent a user from changing a key before we have a chance
...
...
app/assets/javascripts/pages/groups/settings/ci_cd/show/index.js
View file @
14fc739c
...
@@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', () => {
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
AjaxVariableList
({
new
AjaxVariableList
({
container
:
variableListEl
,
container
:
variableListEl
,
saveButton
:
variableListEl
.
querySelector
(
'
.js-
secret
-variables-save-button
'
),
saveButton
:
variableListEl
.
querySelector
(
'
.js-
ci
-variables-save-button
'
),
errorBox
:
variableListEl
.
querySelector
(
'
.js-ci-variable-error-box
'
),
errorBox
:
variableListEl
.
querySelector
(
'
.js-ci-variable-error-box
'
),
saveEndpoint
:
variableListEl
.
dataset
.
saveEndpoint
,
saveEndpoint
:
variableListEl
.
dataset
.
saveEndpoint
,
});
});
...
...
app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
View file @
14fc739c
...
@@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', () => {
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
AjaxVariableList
({
new
AjaxVariableList
({
container
:
variableListEl
,
container
:
variableListEl
,
saveButton
:
variableListEl
.
querySelector
(
'
.js-
secret
-variables-save-button
'
),
saveButton
:
variableListEl
.
querySelector
(
'
.js-
ci
-variables-save-button
'
),
errorBox
:
variableListEl
.
querySelector
(
'
.js-ci-variable-error-box
'
),
errorBox
:
variableListEl
.
querySelector
(
'
.js-ci-variable-error-box
'
),
saveEndpoint
:
variableListEl
.
dataset
.
saveEndpoint
,
saveEndpoint
:
variableListEl
.
dataset
.
saveEndpoint
,
});
});
...
...
app/controllers/groups/settings/ci_cd_controller.rb
View file @
14fc739c
...
@@ -7,7 +7,7 @@ module Groups
...
@@ -7,7 +7,7 @@ module Groups
before_action
:authorize_admin_pipeline!
before_action
:authorize_admin_pipeline!
def
show
def
show
define_
secret
_variables
define_
ci
_variables
end
end
def
reset_registration_token
def
reset_registration_token
...
@@ -19,7 +19,7 @@ module Groups
...
@@ -19,7 +19,7 @@ module Groups
private
private
def
define_
secret
_variables
def
define_
ci
_variables
@variable
=
Ci
::
GroupVariable
.
new
(
group:
group
)
@variable
=
Ci
::
GroupVariable
.
new
(
group:
group
)
.
present
(
current_user:
current_user
)
.
present
(
current_user:
current_user
)
@variables
=
group
.
variables
.
order_key_asc
@variables
=
group
.
variables
.
order_key_asc
...
...
app/controllers/projects/settings/ci_cd_controller.rb
View file @
14fc739c
...
@@ -68,7 +68,7 @@ module Projects
...
@@ -68,7 +68,7 @@ module Projects
def
define_variables
def
define_variables
define_runners_variables
define_runners_variables
define_
secret
_variables
define_
ci
_variables
define_triggers_variables
define_triggers_variables
define_badges_variables
define_badges_variables
define_auto_devops_variables
define_auto_devops_variables
...
@@ -90,7 +90,7 @@ module Projects
...
@@ -90,7 +90,7 @@ module Projects
@group_runners
=
::
Ci
::
Runner
.
belonging_to_parent_group_of_project
(
@project
.
id
)
@group_runners
=
::
Ci
::
Runner
.
belonging_to_parent_group_of_project
(
@project
.
id
)
end
end
def
define_
secret
_variables
def
define_
ci
_variables
@variable
=
::
Ci
::
Variable
.
new
(
project:
project
)
@variable
=
::
Ci
::
Variable
.
new
(
project:
project
)
.
present
(
current_user:
current_user
)
.
present
(
current_user:
current_user
)
@variables
=
project
.
variables
.
order_key_asc
@variables
=
project
.
variables
.
order_key_asc
...
...
app/models/ci/build.rb
View file @
14fc739c
...
@@ -593,11 +593,11 @@ module Ci
...
@@ -593,11 +593,11 @@ module Ci
def
secret_group_variables
def
secret_group_variables
return
[]
unless
project
.
group
return
[]
unless
project
.
group
project
.
group
.
secret
_variables_for
(
ref
,
project
)
project
.
group
.
ci
_variables_for
(
ref
,
project
)
end
end
def
secret_project_variables
(
environment:
persisted_environment
)
def
secret_project_variables
(
environment:
persisted_environment
)
project
.
secret
_variables_for
(
ref:
ref
,
environment:
environment
)
project
.
ci
_variables_for
(
ref:
ref
,
environment:
environment
)
end
end
def
steps
def
steps
...
...
app/models/group.rb
View file @
14fc739c
...
@@ -369,7 +369,7 @@ class Group < Namespace
...
@@ -369,7 +369,7 @@ class Group < Namespace
}
}
end
end
def
secret
_variables_for
(
ref
,
project
)
def
ci
_variables_for
(
ref
,
project
)
list_of_ids
=
[
self
]
+
ancestors
list_of_ids
=
[
self
]
+
ancestors
variables
=
Ci
::
GroupVariable
.
where
(
group:
list_of_ids
)
variables
=
Ci
::
GroupVariable
.
where
(
group:
list_of_ids
)
variables
=
variables
.
unprotected
unless
project
.
protected_for?
(
ref
)
variables
=
variables
.
unprotected
unless
project
.
protected_for?
(
ref
)
...
...
app/models/project.rb
View file @
14fc739c
...
@@ -1811,7 +1811,7 @@ class Project < ActiveRecord::Base
...
@@ -1811,7 +1811,7 @@ class Project < ActiveRecord::Base
.
first
.
first
end
end
def
secret
_variables_for
(
ref
:,
environment:
nil
)
def
ci
_variables_for
(
ref
:,
environment:
nil
)
# EE would use the environment
# EE would use the environment
if
protected_for?
(
ref
)
if
protected_for?
(
ref
)
variables
variables
...
...
app/views/ci/variables/_index.html.haml
View file @
14fc739c
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
=
render
'ci/variables/variable_row'
,
form_field:
'variables'
,
variable:
variable
=
render
'ci/variables/variable_row'
,
form_field:
'variables'
,
variable:
variable
=
render
'ci/variables/variable_row'
,
form_field:
'variables'
=
render
'ci/variables/variable_row'
,
form_field:
'variables'
.prepend-top-20
.prepend-top-20
%button
.btn.btn-success.js-
secret
-variables-save-button
{
type:
'button'
}
%button
.btn.btn-success.js-
ci
-variables-save-button
{
type:
'button'
}
%span
.hide.js-
secret
-variables-save-loading-icon
%span
.hide.js-
ci
-variables-save-loading-icon
=
icon
(
'spinner spin'
)
=
icon
(
'spinner spin'
)
=
_
(
'Save variables'
)
=
_
(
'Save variables'
)
%button
.btn.btn-info.btn-inverted.prepend-left-10.js-secret-value-reveal-button
{
type:
'button'
,
data:
{
secret_reveal_status:
"#{@variables.size == 0}"
}
}
%button
.btn.btn-info.btn-inverted.prepend-left-10.js-secret-value-reveal-button
{
type:
'button'
,
data:
{
secret_reveal_status:
"#{@variables.size == 0}"
}
}
...
...
app/views/groups/settings/ci_cd/show.html.haml
View file @
14fc739c
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
-
expanded
=
Rails
.
env
.
test?
-
expanded
=
Rails
.
env
.
test?
%section
.settings
#
secret
-variables
.no-animate
{
class:
(
'expanded'
if
expanded
)
}
%section
.settings
#
ci
-variables
.no-animate
{
class:
(
'expanded'
if
expanded
)
}
.settings-header
.settings-header
%h4
%h4
=
_
(
'Variables'
)
=
_
(
'Variables'
)
...
...
changelogs/unreleased/ravlen-rename-secret-variables-in-codebase.yml
0 → 100644
View file @
14fc739c
---
title
:
"
Secret
Variables
renamed
to
CI
Variables
in
the
codebase,
to
match
UX"
merge_request
:
22414
author
:
Marcel Amirault @ravlen
type
:
changed
\ No newline at end of file
qa/qa.rb
View file @
14fc739c
...
@@ -53,7 +53,7 @@ module QA
...
@@ -53,7 +53,7 @@ module QA
autoload
:DeployKey
,
'qa/factory/resource/deploy_key'
autoload
:DeployKey
,
'qa/factory/resource/deploy_key'
autoload
:DeployToken
,
'qa/factory/resource/deploy_token'
autoload
:DeployToken
,
'qa/factory/resource/deploy_token'
autoload
:Branch
,
'qa/factory/resource/branch'
autoload
:Branch
,
'qa/factory/resource/branch'
autoload
:
SecretVariable
,
'qa/factory/resource/secret
_variable'
autoload
:
CiVariable
,
'qa/factory/resource/ci
_variable'
autoload
:Runner
,
'qa/factory/resource/runner'
autoload
:Runner
,
'qa/factory/resource/runner'
autoload
:PersonalAccessToken
,
'qa/factory/resource/personal_access_token'
autoload
:PersonalAccessToken
,
'qa/factory/resource/personal_access_token'
autoload
:KubernetesCluster
,
'qa/factory/resource/kubernetes_cluster'
autoload
:KubernetesCluster
,
'qa/factory/resource/kubernetes_cluster'
...
@@ -183,7 +183,7 @@ module QA
...
@@ -183,7 +183,7 @@ module QA
autoload
:DeployKeys
,
'qa/page/project/settings/deploy_keys'
autoload
:DeployKeys
,
'qa/page/project/settings/deploy_keys'
autoload
:DeployTokens
,
'qa/page/project/settings/deploy_tokens'
autoload
:DeployTokens
,
'qa/page/project/settings/deploy_tokens'
autoload
:ProtectedBranches
,
'qa/page/project/settings/protected_branches'
autoload
:ProtectedBranches
,
'qa/page/project/settings/protected_branches'
autoload
:
SecretVariables
,
'qa/page/project/settings/secret
_variables'
autoload
:
CiVariables
,
'qa/page/project/settings/ci
_variables'
autoload
:Runners
,
'qa/page/project/settings/runners'
autoload
:Runners
,
'qa/page/project/settings/runners'
autoload
:MergeRequest
,
'qa/page/project/settings/merge_request'
autoload
:MergeRequest
,
'qa/page/project/settings/merge_request'
autoload
:Members
,
'qa/page/project/settings/members'
autoload
:Members
,
'qa/page/project/settings/members'
...
...
qa/qa/factory/resource/
secret
_variable.rb
→
qa/qa/factory/resource/
ci
_variable.rb
View file @
14fc739c
module
QA
module
QA
module
Factory
module
Factory
module
Resource
module
Resource
class
Secret
Variable
<
Factory
::
Base
class
Ci
Variable
<
Factory
::
Base
attr_accessor
:key
,
:value
attr_accessor
:key
,
:value
attribute
:project
do
attribute
:project
do
Factory
::
Resource
::
Project
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
Project
.
fabricate!
do
|
resource
|
resource
.
name
=
'project-with-
secret
-variables'
resource
.
name
=
'project-with-
ci
-variables'
resource
.
description
=
'project for adding
secret
variable test'
resource
.
description
=
'project for adding
CI
variable test'
end
end
end
end
...
@@ -17,7 +17,7 @@ module QA
...
@@ -17,7 +17,7 @@ module QA
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_settings
)
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_settings
)
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
setting
|
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
setting
|
setting
.
expand_
secret
_variables
do
|
page
|
setting
.
expand_
ci
_variables
do
|
page
|
page
.
fill_variable
(
key
,
value
)
page
.
fill_variable
(
key
,
value
)
page
.
save_variables
page
.
save_variables
...
...
qa/qa/page/project/settings/ci_cd.rb
View file @
14fc739c
...
@@ -25,9 +25,9 @@ module QA # rubocop:disable Naming/FileName
...
@@ -25,9 +25,9 @@ module QA # rubocop:disable Naming/FileName
end
end
end
end
def
expand_
secret
_variables
(
&
block
)
def
expand_
ci
_variables
(
&
block
)
expand_section
(
:variables_settings
)
do
expand_section
(
:variables_settings
)
do
Settings
::
Secret
Variables
.
perform
(
&
block
)
Settings
::
Ci
Variables
.
perform
(
&
block
)
end
end
end
end
...
...
qa/qa/page/project/settings/
secret
_variables.rb
→
qa/qa/page/project/settings/
ci
_variables.rb
View file @
14fc739c
...
@@ -2,7 +2,7 @@ module QA
...
@@ -2,7 +2,7 @@ module QA
module
Page
module
Page
module
Project
module
Project
module
Settings
module
Settings
class
Secret
Variables
<
Page
::
Base
class
Ci
Variables
<
Page
::
Base
include
Common
include
Common
view
'app/views/ci/variables/_variable_row.html.haml'
do
view
'app/views/ci/variables/_variable_row.html.haml'
do
...
@@ -12,7 +12,7 @@ module QA
...
@@ -12,7 +12,7 @@ module QA
end
end
view
'app/views/ci/variables/_index.html.haml'
do
view
'app/views/ci/variables/_index.html.haml'
do
element
:save_variables
,
'.js-
secret
-variables-save-button'
# rubocop:disable QA/ElementWithPattern
element
:save_variables
,
'.js-
ci
-variables-save-button'
# rubocop:disable QA/ElementWithPattern
element
:reveal_values
,
'.js-secret-value-reveal-button'
# rubocop:disable QA/ElementWithPattern
element
:reveal_values
,
'.js-secret-value-reveal-button'
# rubocop:disable QA/ElementWithPattern
end
end
...
@@ -33,7 +33,7 @@ module QA
...
@@ -33,7 +33,7 @@ module QA
end
end
def
save_variables
def
save_variables
find
(
'.js-
secret
-variables-save-button'
).
click
find
(
'.js-
ci
-variables-save-button'
).
click
end
end
def
reveal_variables
def
reveal_variables
...
...
qa/qa/specs/features/browser_ui/4_verify/
secret_variable/add_secret
_variable_spec.rb
→
qa/qa/specs/features/browser_ui/4_verify/
ci_variable/add_ci
_variable_spec.rb
View file @
14fc739c
...
@@ -2,24 +2,24 @@
...
@@ -2,24 +2,24 @@
module
QA
module
QA
context
'Verify'
do
context
'Verify'
do
describe
'
Secret
variable support'
do
describe
'
CI
variable support'
do
it
'user adds a
secret
variable'
do
it
'user adds a
CI
variable'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Factory
::
Resource
::
Secret
Variable
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
Ci
Variable
.
fabricate!
do
|
resource
|
resource
.
key
=
'VARIABLE_KEY'
resource
.
key
=
'VARIABLE_KEY'
resource
.
value
=
'some
secret
variable'
resource
.
value
=
'some
CI
variable'
end
end
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
settings
|
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
settings
|
settings
.
expand_
secret
_variables
do
|
page
|
settings
.
expand_
ci
_variables
do
|
page
|
expect
(
page
).
to
have_field
(
with:
'VARIABLE_KEY'
)
expect
(
page
).
to
have_field
(
with:
'VARIABLE_KEY'
)
expect
(
page
).
not_to
have_field
(
with:
'some
secret
variable'
)
expect
(
page
).
not_to
have_field
(
with:
'some
CI
variable'
)
page
.
reveal_variables
page
.
reveal_variables
expect
(
page
).
to
have_field
(
with:
'some
secret
variable'
)
expect
(
page
).
to
have_field
(
with:
'some
CI
variable'
)
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
View file @
14fc739c
...
@@ -55,7 +55,7 @@ module QA
...
@@ -55,7 +55,7 @@ module QA
deploy_key_name
=
"DEPLOY_KEY_
#{
key
.
name
}
_
#{
key
.
bits
}
"
deploy_key_name
=
"DEPLOY_KEY_
#{
key
.
name
}
_
#{
key
.
bits
}
"
Factory
::
Resource
::
Secret
Variable
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
Ci
Variable
.
fabricate!
do
|
resource
|
resource
.
project
=
@project
resource
.
project
=
@project
resource
.
key
=
deploy_key_name
resource
.
key
=
deploy_key_name
resource
.
value
=
key
.
private_key
resource
.
value
=
key
.
private_key
...
...
qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb
View file @
14fc739c
...
@@ -22,7 +22,7 @@ module QA
...
@@ -22,7 +22,7 @@ module QA
# Disable code_quality check in Auto DevOps pipeline as it takes
# Disable code_quality check in Auto DevOps pipeline as it takes
# too long and times out the test
# too long and times out the test
Factory
::
Resource
::
Secret
Variable
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
Ci
Variable
.
fabricate!
do
|
resource
|
resource
.
project
=
project
resource
.
project
=
project
resource
.
key
=
'CODE_QUALITY_DISABLED'
resource
.
key
=
'CODE_QUALITY_DISABLED'
resource
.
value
=
'1'
resource
.
value
=
'1'
...
...
spec/javascripts/ci_variable_list/ajax_variable_list_spec.js
View file @
14fc739c
...
@@ -24,7 +24,7 @@ describe('AjaxFormVariableList', () => {
...
@@ -24,7 +24,7 @@ describe('AjaxFormVariableList', () => {
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
const
ajaxVariableListEl
=
document
.
querySelector
(
'
.js-ci-variable-list-section
'
);
const
ajaxVariableListEl
=
document
.
querySelector
(
'
.js-ci-variable-list-section
'
);
saveButton
=
ajaxVariableListEl
.
querySelector
(
'
.js-
secret
-variables-save-button
'
);
saveButton
=
ajaxVariableListEl
.
querySelector
(
'
.js-
ci
-variables-save-button
'
);
errorBox
=
container
.
querySelector
(
'
.js-ci-variable-error-box
'
);
errorBox
=
container
.
querySelector
(
'
.js-ci-variable-error-box
'
);
ajaxVariableList
=
new
AjaxFormVariableList
({
ajaxVariableList
=
new
AjaxFormVariableList
({
container
,
container
,
...
@@ -44,7 +44,7 @@ describe('AjaxFormVariableList', () => {
...
@@ -44,7 +44,7 @@ describe('AjaxFormVariableList', () => {
describe
(
'
onSaveClicked
'
,
()
=>
{
describe
(
'
onSaveClicked
'
,
()
=>
{
it
(
'
shows loading spinner while waiting for the request
'
,
done
=>
{
it
(
'
shows loading spinner while waiting for the request
'
,
done
=>
{
const
loadingIcon
=
saveButton
.
querySelector
(
'
.js-
secret
-variables-save-loading-icon
'
);
const
loadingIcon
=
saveButton
.
querySelector
(
'
.js-
ci
-variables-save-loading-icon
'
);
mock
.
onPatch
(
VARIABLE_PATCH_ENDPOINT
).
reply
(()
=>
{
mock
.
onPatch
(
VARIABLE_PATCH_ENDPOINT
).
reply
(()
=>
{
expect
(
loadingIcon
.
classList
.
contains
(
HIDE_CLASS
)).
toEqual
(
false
);
expect
(
loadingIcon
.
classList
.
contains
(
HIDE_CLASS
)).
toEqual
(
false
);
...
@@ -172,7 +172,7 @@ describe('AjaxFormVariableList', () => {
...
@@ -172,7 +172,7 @@ describe('AjaxFormVariableList', () => {
container
=
document
.
querySelector
(
'
.js-ci-variable-list-section
'
);
container
=
document
.
querySelector
(
'
.js-ci-variable-list-section
'
);
const
ajaxVariableListEl
=
document
.
querySelector
(
'
.js-ci-variable-list-section
'
);
const
ajaxVariableListEl
=
document
.
querySelector
(
'
.js-ci-variable-list-section
'
);
saveButton
=
ajaxVariableListEl
.
querySelector
(
'
.js-
secret
-variables-save-button
'
);
saveButton
=
ajaxVariableListEl
.
querySelector
(
'
.js-
ci
-variables-save-button
'
);
errorBox
=
container
.
querySelector
(
'
.js-ci-variable-error-box
'
);
errorBox
=
container
.
querySelector
(
'
.js-ci-variable-error-box
'
);
ajaxVariableList
=
new
AjaxFormVariableList
({
ajaxVariableList
=
new
AjaxFormVariableList
({
container
,
container
,
...
...
spec/lib/gitlab/ci/build/policy/variables_spec.rb
View file @
14fc739c
...
@@ -54,7 +54,7 @@ describe Gitlab::Ci::Build::Policy::Variables do
...
@@ -54,7 +54,7 @@ describe Gitlab::Ci::Build::Policy::Variables do
expect
(
policy
).
not_to
be_satisfied_by
(
pipeline
,
seed
)
expect
(
policy
).
not_to
be_satisfied_by
(
pipeline
,
seed
)
end
end
it
'allows to evaluate regular
secret
variables'
do
it
'allows to evaluate regular
CI
variables'
do
create
(
:ci_variable
,
project:
project
,
key:
'SECRET'
,
value:
'my secret'
)
create
(
:ci_variable
,
project:
project
,
key:
'SECRET'
,
value:
'my secret'
)
policy
=
described_class
.
new
([
"$SECRET == 'my secret'"
])
policy
=
described_class
.
new
([
"$SECRET == 'my secret'"
])
...
...
spec/models/ci/build_spec.rb
View file @
14fc739c
...
@@ -2027,17 +2027,17 @@ describe Ci::Build do
...
@@ -2027,17 +2027,17 @@ describe Ci::Build do
it
{
is_expected
.
to
include
(
tag_variable
)
}
it
{
is_expected
.
to
include
(
tag_variable
)
}
end
end
context
'when
secret
variable is defined'
do
context
'when
CI
variable is defined'
do
let
(
:
secret
_variable
)
do
let
(
:
ci
_variable
)
do
{
key:
'SECRET_KEY'
,
value:
'secret_value'
,
public:
false
}
{
key:
'SECRET_KEY'
,
value:
'secret_value'
,
public:
false
}
end
end
before
do
before
do
create
(
:ci_variable
,
create
(
:ci_variable
,
secret
_variable
.
slice
(
:key
,
:value
).
merge
(
project:
project
))
ci
_variable
.
slice
(
:key
,
:value
).
merge
(
project:
project
))
end
end
it
{
is_expected
.
to
include
(
secret
_variable
)
}
it
{
is_expected
.
to
include
(
ci
_variable
)
}
end
end
context
'when protected variable is defined'
do
context
'when protected variable is defined'
do
...
@@ -2072,17 +2072,17 @@ describe Ci::Build do
...
@@ -2072,17 +2072,17 @@ describe Ci::Build do
end
end
end
end
context
'when group
secret
variable is defined'
do
context
'when group
CI
variable is defined'
do
let
(
:
secret
_variable
)
do
let
(
:
ci
_variable
)
do
{
key:
'SECRET_KEY'
,
value:
'secret_value'
,
public:
false
}
{
key:
'SECRET_KEY'
,
value:
'secret_value'
,
public:
false
}
end
end
before
do
before
do
create
(
:ci_group_variable
,
create
(
:ci_group_variable
,
secret
_variable
.
slice
(
:key
,
:value
).
merge
(
group:
group
))
ci
_variable
.
slice
(
:key
,
:value
).
merge
(
group:
group
))
end
end
it
{
is_expected
.
to
include
(
secret
_variable
)
}
it
{
is_expected
.
to
include
(
ci
_variable
)
}
end
end
context
'when group protected variable is defined'
do
context
'when group protected variable is defined'
do
...
@@ -2357,7 +2357,7 @@ describe Ci::Build do
...
@@ -2357,7 +2357,7 @@ describe Ci::Build do
.
to
receive
(
:predefined_variables
)
{
[
project_pre_var
]
}
.
to
receive
(
:predefined_variables
)
{
[
project_pre_var
]
}
allow_any_instance_of
(
Project
)
allow_any_instance_of
(
Project
)
.
to
receive
(
:
secret
_variables_for
)
.
to
receive
(
:
ci
_variables_for
)
.
with
(
ref:
'master'
,
environment:
nil
)
do
.
with
(
ref:
'master'
,
environment:
nil
)
do
[
create
(
:ci_variable
,
key:
'secret'
,
value:
'value'
)]
[
create
(
:ci_variable
,
key:
'secret'
,
value:
'value'
)]
end
end
...
@@ -2508,7 +2508,7 @@ describe Ci::Build do
...
@@ -2508,7 +2508,7 @@ describe Ci::Build do
end
end
describe
'#scoped_variables_hash'
do
describe
'#scoped_variables_hash'
do
context
'when overriding
secret
variables'
do
context
'when overriding
CI
variables'
do
before
do
before
do
project
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 1'
)
project
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 1'
)
pipeline
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 2'
)
pipeline
.
variables
.
create!
(
key:
'MY_VAR'
,
value:
'my value 2'
)
...
...
spec/models/group_spec.rb
View file @
14fc739c
...
@@ -653,10 +653,10 @@ describe Group do
...
@@ -653,10 +653,10 @@ describe Group do
end
end
end
end
describe
'#
secret
_variables_for'
do
describe
'#
ci
_variables_for'
do
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let!
(
:
secret
_variable
)
do
let!
(
:
ci
_variable
)
do
create
(
:ci_group_variable
,
value:
'secret'
,
group:
group
)
create
(
:ci_group_variable
,
value:
'secret'
,
group:
group
)
end
end
...
@@ -664,11 +664,11 @@ describe Group do
...
@@ -664,11 +664,11 @@ describe Group do
create
(
:ci_group_variable
,
:protected
,
value:
'protected'
,
group:
group
)
create
(
:ci_group_variable
,
:protected
,
value:
'protected'
,
group:
group
)
end
end
subject
{
group
.
secret
_variables_for
(
'ref'
,
project
)
}
subject
{
group
.
ci
_variables_for
(
'ref'
,
project
)
}
shared_examples
'ref is protected'
do
shared_examples
'ref is protected'
do
it
'contains all the variables'
do
it
'contains all the variables'
do
is_expected
.
to
contain_exactly
(
secret
_variable
,
protected_variable
)
is_expected
.
to
contain_exactly
(
ci
_variable
,
protected_variable
)
end
end
end
end
...
@@ -678,8 +678,8 @@ describe Group do
...
@@ -678,8 +678,8 @@ describe Group do
default_branch_protection:
Gitlab
::
Access
::
PROTECTION_NONE
)
default_branch_protection:
Gitlab
::
Access
::
PROTECTION_NONE
)
end
end
it
'contains only the
secret
variables'
do
it
'contains only the
CI
variables'
do
is_expected
.
to
contain_exactly
(
secret
_variable
)
is_expected
.
to
contain_exactly
(
ci
_variable
)
end
end
end
end
...
@@ -712,9 +712,9 @@ describe Group do
...
@@ -712,9 +712,9 @@ describe Group do
end
end
it
'returns all variables belong to the group and parent groups'
do
it
'returns all variables belong to the group and parent groups'
do
expected_array1
=
[
protected_variable
,
secret
_variable
]
expected_array1
=
[
protected_variable
,
ci
_variable
]
expected_array2
=
[
variable_child
,
variable_child_2
,
variable_child_3
]
expected_array2
=
[
variable_child
,
variable_child_2
,
variable_child_3
]
got_array
=
group_child_3
.
secret
_variables_for
(
'ref'
,
project
).
to_a
got_array
=
group_child_3
.
ci
_variables_for
(
'ref'
,
project
).
to_a
expect
(
got_array
.
shift
(
2
)).
to
contain_exactly
(
*
expected_array1
)
expect
(
got_array
.
shift
(
2
)).
to
contain_exactly
(
*
expected_array1
)
expect
(
got_array
).
to
eq
(
expected_array2
)
expect
(
got_array
).
to
eq
(
expected_array2
)
...
...
spec/models/project_spec.rb
View file @
14fc739c
...
@@ -2432,10 +2432,10 @@ describe Project do
...
@@ -2432,10 +2432,10 @@ describe Project do
end
end
end
end
describe
'#
secret
_variables_for'
do
describe
'#
ci
_variables_for'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let!
(
:
secret
_variable
)
do
let!
(
:
ci
_variable
)
do
create
(
:ci_variable
,
value:
'secret'
,
project:
project
)
create
(
:ci_variable
,
value:
'secret'
,
project:
project
)
end
end
...
@@ -2443,7 +2443,7 @@ describe Project do
...
@@ -2443,7 +2443,7 @@ describe Project do
create
(
:ci_variable
,
:protected
,
value:
'protected'
,
project:
project
)
create
(
:ci_variable
,
:protected
,
value:
'protected'
,
project:
project
)
end
end
subject
{
project
.
reload
.
secret
_variables_for
(
ref:
'ref'
)
}
subject
{
project
.
reload
.
ci
_variables_for
(
ref:
'ref'
)
}
before
do
before
do
stub_application_setting
(
stub_application_setting
(
...
@@ -2452,13 +2452,13 @@ describe Project do
...
@@ -2452,13 +2452,13 @@ describe Project do
shared_examples
'ref is protected'
do
shared_examples
'ref is protected'
do
it
'contains all the variables'
do
it
'contains all the variables'
do
is_expected
.
to
contain_exactly
(
secret
_variable
,
protected_variable
)
is_expected
.
to
contain_exactly
(
ci
_variable
,
protected_variable
)
end
end
end
end
context
'when the ref is not protected'
do
context
'when the ref is not protected'
do
it
'contains only the
secret
variables'
do
it
'contains only the
CI
variables'
do
is_expected
.
to
contain_exactly
(
secret
_variable
)
is_expected
.
to
contain_exactly
(
ci
_variable
)
end
end
end
end
...
...
spec/support/features/variable_list_shared_examples.rb
View file @
14fc739c
...
@@ -5,7 +5,7 @@ shared_examples 'variable list' do
...
@@ -5,7 +5,7 @@ shared_examples 'variable list' do
end
end
end
end
it
'adds new
secret
variable'
do
it
'adds new
CI
variable'
do
page
.
within
(
'.js-ci-variable-list-section .js-row:last-child'
)
do
page
.
within
(
'.js-ci-variable-list-section .js-row:last-child'
)
do
find
(
'.js-ci-variable-input-key'
).
set
(
'key'
)
find
(
'.js-ci-variable-input-key'
).
set
(
'key'
)
find
(
'.js-ci-variable-input-value'
).
set
(
'key value'
)
find
(
'.js-ci-variable-input-value'
).
set
(
'key value'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment