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
05103f08
Commit
05103f08
authored
Mar 22, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Variable key not secret
parent
ca3b2991
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
21 additions
and
24 deletions
+21
-24
app/assets/javascripts/ci_variable_list/ci_variable_list.js
app/assets/javascripts/ci_variable_list/ci_variable_list.js
+2
-2
app/controllers/groups/variables_controller.rb
app/controllers/groups/variables_controller.rb
+1
-1
app/controllers/projects/pipeline_schedules_controller.rb
app/controllers/projects/pipeline_schedules_controller.rb
+1
-1
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+1
-1
app/models/ci/group_variable.rb
app/models/ci/group_variable.rb
+0
-1
app/models/ci/pipeline_schedule_variable.rb
app/models/ci/pipeline_schedule_variable.rb
+0
-1
app/models/ci/variable.rb
app/models/ci/variable.rb
+0
-1
app/views/ci/variables/_variable_row.html.haml
app/views/ci/variables/_variable_row.html.haml
+1
-1
spec/controllers/projects/pipeline_schedules_controller_spec.rb
...ontrollers/projects/pipeline_schedules_controller_spec.rb
+9
-9
spec/features/projects/pipeline_schedules_spec.rb
spec/features/projects/pipeline_schedules_spec.rb
+2
-2
spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
...cripts/ci_variable_list/native_form_variable_list_spec.js
+1
-1
spec/support/shared_examples/controllers/variables_shared_examples.rb
.../shared_examples/controllers/variables_shared_examples.rb
+3
-3
No files found.
app/assets/javascripts/ci_variable_list/ci_variable_list.js
View file @
05103f08
...
@@ -29,7 +29,7 @@ export default class VariableList {
...
@@ -29,7 +29,7 @@ export default class VariableList {
selector
:
'
.js-ci-variable-input-id
'
,
selector
:
'
.js-ci-variable-input-id
'
,
default
:
''
,
default
:
''
,
},
},
secret_
key
:
{
key
:
{
selector
:
'
.js-ci-variable-input-key
'
,
selector
:
'
.js-ci-variable-input-key
'
,
default
:
''
,
default
:
''
,
},
},
...
@@ -174,7 +174,7 @@ export default class VariableList {
...
@@ -174,7 +174,7 @@ export default class VariableList {
}
}
toggleEnableRow
(
isEnabled
=
true
)
{
toggleEnableRow
(
isEnabled
=
true
)
{
this
.
$container
.
find
(
this
.
inputMap
.
secret_
key
.
selector
).
attr
(
'
disabled
'
,
!
isEnabled
);
this
.
$container
.
find
(
this
.
inputMap
.
key
.
selector
).
attr
(
'
disabled
'
,
!
isEnabled
);
this
.
$container
.
find
(
'
.js-row-remove-button
'
).
attr
(
'
disabled
'
,
!
isEnabled
);
this
.
$container
.
find
(
'
.js-row-remove-button
'
).
attr
(
'
disabled
'
,
!
isEnabled
);
}
}
...
...
app/controllers/groups/variables_controller.rb
View file @
05103f08
...
@@ -39,7 +39,7 @@ module Groups
...
@@ -39,7 +39,7 @@ module Groups
end
end
def
variable_params_attributes
def
variable_params_attributes
%i[id
secret_
key secret_value protected _destroy]
%i[id key secret_value protected _destroy]
end
end
def
authorize_admin_build!
def
authorize_admin_build!
...
...
app/controllers/projects/pipeline_schedules_controller.rb
View file @
05103f08
...
@@ -92,7 +92,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
...
@@ -92,7 +92,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
def
schedule_params
def
schedule_params
params
.
require
(
:schedule
)
params
.
require
(
:schedule
)
.
permit
(
:description
,
:cron
,
:cron_timezone
,
:ref
,
:active
,
.
permit
(
:description
,
:cron
,
:cron_timezone
,
:ref
,
:active
,
variables_attributes:
[
:id
,
:
secret_
key
,
:secret_value
,
:_destroy
]
)
variables_attributes:
[
:id
,
:key
,
:secret_value
,
:_destroy
]
)
end
end
def
authorize_play_pipeline_schedule!
def
authorize_play_pipeline_schedule!
...
...
app/controllers/projects/variables_controller.rb
View file @
05103f08
...
@@ -36,6 +36,6 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -36,6 +36,6 @@ class Projects::VariablesController < Projects::ApplicationController
end
end
def
variable_params_attributes
def
variable_params_attributes
%i[id
secret_
key secret_value protected _destroy]
%i[id key secret_value protected _destroy]
end
end
end
end
app/models/ci/group_variable.rb
View file @
05103f08
...
@@ -6,7 +6,6 @@ module Ci
...
@@ -6,7 +6,6 @@ module Ci
belongs_to
:group
belongs_to
:group
alias_attribute
:secret_key
,
:key
alias_attribute
:secret_value
,
:value
alias_attribute
:secret_value
,
:value
validates
:key
,
uniqueness:
{
validates
:key
,
uniqueness:
{
...
...
app/models/ci/pipeline_schedule_variable.rb
View file @
05103f08
...
@@ -5,7 +5,6 @@ module Ci
...
@@ -5,7 +5,6 @@ module Ci
belongs_to
:pipeline_schedule
belongs_to
:pipeline_schedule
alias_attribute
:secret_key
,
:key
alias_attribute
:secret_value
,
:value
alias_attribute
:secret_value
,
:value
validates
:key
,
uniqueness:
{
scope: :pipeline_schedule_id
}
validates
:key
,
uniqueness:
{
scope: :pipeline_schedule_id
}
...
...
app/models/ci/variable.rb
View file @
05103f08
...
@@ -6,7 +6,6 @@ module Ci
...
@@ -6,7 +6,6 @@ module Ci
belongs_to
:project
belongs_to
:project
alias_attribute
:secret_key
,
:key
alias_attribute
:secret_value
,
:value
alias_attribute
:secret_value
,
:value
validates
:key
,
uniqueness:
{
validates
:key
,
uniqueness:
{
...
...
app/views/ci/variables/_variable_row.html.haml
View file @
05103f08
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
-
id_input_name
=
"
#{
form_field
}
[variables_attributes][][id]"
-
id_input_name
=
"
#{
form_field
}
[variables_attributes][][id]"
-
destroy_input_name
=
"
#{
form_field
}
[variables_attributes][][_destroy]"
-
destroy_input_name
=
"
#{
form_field
}
[variables_attributes][][_destroy]"
-
key_input_name
=
"
#{
form_field
}
[variables_attributes][][
secret_
key]"
-
key_input_name
=
"
#{
form_field
}
[variables_attributes][][key]"
-
value_input_name
=
"
#{
form_field
}
[variables_attributes][][secret_value]"
-
value_input_name
=
"
#{
form_field
}
[variables_attributes][][secret_value]"
-
protected_input_name
=
"
#{
form_field
}
[variables_attributes][][protected]"
-
protected_input_name
=
"
#{
form_field
}
[variables_attributes][][protected]"
...
...
spec/controllers/projects/pipeline_schedules_controller_spec.rb
View file @
05103f08
...
@@ -80,7 +80,7 @@ describe Projects::PipelineSchedulesController do
...
@@ -80,7 +80,7 @@ describe Projects::PipelineSchedulesController do
context
'when variables_attributes has one variable'
do
context
'when variables_attributes has one variable'
do
let
(
:schedule
)
do
let
(
:schedule
)
do
basic_param
.
merge
({
basic_param
.
merge
({
variables_attributes:
[{
secret_
key:
'AAA'
,
secret_value:
'AAA123'
}]
variables_attributes:
[{
key:
'AAA'
,
secret_value:
'AAA123'
}]
})
})
end
end
...
@@ -101,8 +101,8 @@ describe Projects::PipelineSchedulesController do
...
@@ -101,8 +101,8 @@ describe Projects::PipelineSchedulesController do
context
'when variables_attributes has two variables and duplicated'
do
context
'when variables_attributes has two variables and duplicated'
do
let
(
:schedule
)
do
let
(
:schedule
)
do
basic_param
.
merge
({
basic_param
.
merge
({
variables_attributes:
[{
secret_
key:
'AAA'
,
secret_value:
'AAA123'
},
variables_attributes:
[{
key:
'AAA'
,
secret_value:
'AAA123'
},
{
secret_
key:
'AAA'
,
secret_value:
'BBB123'
}]
{
key:
'AAA'
,
secret_value:
'BBB123'
}]
})
})
end
end
...
@@ -153,7 +153,7 @@ describe Projects::PipelineSchedulesController do
...
@@ -153,7 +153,7 @@ describe Projects::PipelineSchedulesController do
context
'when params include one variable'
do
context
'when params include one variable'
do
let
(
:schedule
)
do
let
(
:schedule
)
do
basic_param
.
merge
({
basic_param
.
merge
({
variables_attributes:
[{
secret_
key:
'AAA'
,
secret_value:
'AAA123'
}]
variables_attributes:
[{
key:
'AAA'
,
secret_value:
'AAA123'
}]
})
})
end
end
...
@@ -170,8 +170,8 @@ describe Projects::PipelineSchedulesController do
...
@@ -170,8 +170,8 @@ describe Projects::PipelineSchedulesController do
context
'when params include two duplicated variables'
do
context
'when params include two duplicated variables'
do
let
(
:schedule
)
do
let
(
:schedule
)
do
basic_param
.
merge
({
basic_param
.
merge
({
variables_attributes:
[{
secret_
key:
'AAA'
,
secret_value:
'AAA123'
},
variables_attributes:
[{
key:
'AAA'
,
secret_value:
'AAA123'
},
{
secret_
key:
'AAA'
,
secret_value:
'BBB123'
}]
{
key:
'AAA'
,
secret_value:
'BBB123'
}]
})
})
end
end
...
@@ -196,7 +196,7 @@ describe Projects::PipelineSchedulesController do
...
@@ -196,7 +196,7 @@ describe Projects::PipelineSchedulesController do
context
'when adds a new variable'
do
context
'when adds a new variable'
do
let
(
:schedule
)
do
let
(
:schedule
)
do
basic_param
.
merge
({
basic_param
.
merge
({
variables_attributes:
[{
secret_
key:
'AAA'
,
secret_value:
'AAA123'
}]
variables_attributes:
[{
key:
'AAA'
,
secret_value:
'AAA123'
}]
})
})
end
end
...
@@ -211,7 +211,7 @@ describe Projects::PipelineSchedulesController do
...
@@ -211,7 +211,7 @@ describe Projects::PipelineSchedulesController do
context
'when adds a new duplicated variable'
do
context
'when adds a new duplicated variable'
do
let
(
:schedule
)
do
let
(
:schedule
)
do
basic_param
.
merge
({
basic_param
.
merge
({
variables_attributes:
[{
secret_
key:
'CCC'
,
secret_value:
'AAA123'
}]
variables_attributes:
[{
key:
'CCC'
,
secret_value:
'AAA123'
}]
})
})
end
end
...
@@ -254,7 +254,7 @@ describe Projects::PipelineSchedulesController do
...
@@ -254,7 +254,7 @@ describe Projects::PipelineSchedulesController do
let
(
:schedule
)
do
let
(
:schedule
)
do
basic_param
.
merge
({
basic_param
.
merge
({
variables_attributes:
[{
id:
pipeline_schedule_variable
.
id
,
_destroy:
true
},
variables_attributes:
[{
id:
pipeline_schedule_variable
.
id
,
_destroy:
true
},
{
secret_
key:
'CCC'
,
secret_value:
'CCC123'
}]
{
key:
'CCC'
,
secret_value:
'CCC123'
}]
})
})
end
end
...
...
spec/features/projects/pipeline_schedules_spec.rb
View file @
05103f08
...
@@ -159,9 +159,9 @@ feature 'Pipeline Schedules', :js do
...
@@ -159,9 +159,9 @@ feature 'Pipeline Schedules', :js do
visit_pipelines_schedules
visit_pipelines_schedules
click_link
'New schedule'
click_link
'New schedule'
fill_in_schedule_form
fill_in_schedule_form
all
(
'[name="schedule[variables_attributes][][
secret_
key]"]'
)[
0
].
set
(
'AAA'
)
all
(
'[name="schedule[variables_attributes][][key]"]'
)[
0
].
set
(
'AAA'
)
all
(
'[name="schedule[variables_attributes][][secret_value]"]'
)[
0
].
set
(
'AAA123'
)
all
(
'[name="schedule[variables_attributes][][secret_value]"]'
)[
0
].
set
(
'AAA123'
)
all
(
'[name="schedule[variables_attributes][][
secret_
key]"]'
)[
1
].
set
(
'BBB'
)
all
(
'[name="schedule[variables_attributes][][key]"]'
)[
1
].
set
(
'BBB'
)
all
(
'[name="schedule[variables_attributes][][secret_value]"]'
)[
1
].
set
(
'BBB123'
)
all
(
'[name="schedule[variables_attributes][][secret_value]"]'
)[
1
].
set
(
'BBB123'
)
save_pipeline_schedule
save_pipeline_schedule
end
end
...
...
spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
View file @
05103f08
...
@@ -19,7 +19,7 @@ describe('NativeFormVariableList', () => {
...
@@ -19,7 +19,7 @@ describe('NativeFormVariableList', () => {
describe
(
'
onFormSubmit
'
,
()
=>
{
describe
(
'
onFormSubmit
'
,
()
=>
{
it
(
'
should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)
'
,
()
=>
{
it
(
'
should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)
'
,
()
=>
{
const
$row
=
$wrapper
.
find
(
'
.js-row
'
);
const
$row
=
$wrapper
.
find
(
'
.js-row
'
);
expect
(
$row
.
find
(
'
.js-ci-variable-input-key
'
).
attr
(
'
name
'
)).
toBe
(
'
schedule[variables_attributes][][
secret_
key]
'
);
expect
(
$row
.
find
(
'
.js-ci-variable-input-key
'
).
attr
(
'
name
'
)).
toBe
(
'
schedule[variables_attributes][][key]
'
);
expect
(
$row
.
find
(
'
.js-ci-variable-input-value
'
).
attr
(
'
name
'
)).
toBe
(
'
schedule[variables_attributes][][secret_value]
'
);
expect
(
$row
.
find
(
'
.js-ci-variable-input-value
'
).
attr
(
'
name
'
)).
toBe
(
'
schedule[variables_attributes][][secret_value]
'
);
$wrapper
.
closest
(
'
form
'
).
trigger
(
'
trigger-submit
'
);
$wrapper
.
closest
(
'
form
'
).
trigger
(
'
trigger-submit
'
);
...
...
spec/support/shared_examples/controllers/variables_shared_examples.rb
View file @
05103f08
...
@@ -15,12 +15,12 @@ end
...
@@ -15,12 +15,12 @@ end
shared_examples
'PATCH #update updates variables'
do
shared_examples
'PATCH #update updates variables'
do
let
(
:variable_attributes
)
do
let
(
:variable_attributes
)
do
{
id:
variable
.
id
,
{
id:
variable
.
id
,
secret_
key:
variable
.
key
,
key:
variable
.
key
,
secret_value:
variable
.
value
,
secret_value:
variable
.
value
,
protected:
variable
.
protected?
.
to_s
}
protected:
variable
.
protected?
.
to_s
}
end
end
let
(
:new_variable_attributes
)
do
let
(
:new_variable_attributes
)
do
{
secret_
key:
'new_key'
,
{
key:
'new_key'
,
secret_value:
'dummy_value'
,
secret_value:
'dummy_value'
,
protected:
'false'
}
protected:
'false'
}
end
end
...
@@ -29,7 +29,7 @@ shared_examples 'PATCH #update updates variables' do
...
@@ -29,7 +29,7 @@ shared_examples 'PATCH #update updates variables' do
let
(
:variables_attributes
)
do
let
(
:variables_attributes
)
do
[
[
variable_attributes
.
merge
(
secret_value:
'other_value'
),
variable_attributes
.
merge
(
secret_value:
'other_value'
),
new_variable_attributes
.
merge
(
secret_
key:
'...?'
)
new_variable_attributes
.
merge
(
key:
'...?'
)
]
]
end
end
...
...
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