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
Léo-Paul Géneau
gitlab-ce
Commits
68c6e410
Commit
68c6e410
authored
Mar 17, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use secret_key and secret_value in Pipeline Schedule variables
parent
30d685b5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
13 deletions
+18
-13
app/controllers/projects/pipeline_schedules_controller.rb
app/controllers/projects/pipeline_schedules_controller.rb
+1
-1
app/models/ci/pipeline_schedule_variable.rb
app/models/ci/pipeline_schedule_variable.rb
+3
-0
spec/controllers/projects/pipeline_schedules_controller_spec.rb
...ontrollers/projects/pipeline_schedules_controller_spec.rb
+10
-8
spec/features/projects/pipeline_schedules_spec.rb
spec/features/projects/pipeline_schedules_spec.rb
+4
-4
No files found.
app/controllers/projects/pipeline_schedules_controller.rb
View file @
68c6e410
...
...
@@ -92,7 +92,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
def
schedule_params
params
.
require
(
:schedule
)
.
permit
(
:description
,
:cron
,
:cron_timezone
,
:ref
,
:active
,
variables_attributes:
[
:id
,
:
key
,
:
value
,
:_destroy
]
)
variables_attributes:
[
:id
,
:
secret_key
,
:secret_
value
,
:_destroy
]
)
end
def
authorize_play_pipeline_schedule!
...
...
app/models/ci/pipeline_schedule_variable.rb
View file @
68c6e410
...
...
@@ -5,6 +5,9 @@ module Ci
belongs_to
:pipeline_schedule
alias_attribute
:secret_key
,
:key
alias_attribute
:secret_value
,
:value
validates
:key
,
uniqueness:
{
scope: :pipeline_schedule_id
}
end
end
spec/controllers/projects/pipeline_schedules_controller_spec.rb
View file @
68c6e410
...
...
@@ -80,7 +80,7 @@ describe Projects::PipelineSchedulesController do
context
'when variables_attributes has one variable'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'AAA'
,
value:
'AAA123'
}]
variables_attributes:
[{
secret_key:
'AAA'
,
secret_
value:
'AAA123'
}]
})
end
...
...
@@ -101,7 +101,8 @@ describe Projects::PipelineSchedulesController do
context
'when variables_attributes has two variables and duplicated'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'AAA'
,
value:
'AAA123'
},
{
key:
'AAA'
,
value:
'BBB123'
}]
variables_attributes:
[{
secret_key:
'AAA'
,
secret_value:
'AAA123'
},
{
secret_key:
'AAA'
,
secret_value:
'BBB123'
}]
})
end
...
...
@@ -152,7 +153,7 @@ describe Projects::PipelineSchedulesController do
context
'when params include one variable'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'AAA'
,
value:
'AAA123'
}]
variables_attributes:
[{
secret_key:
'AAA'
,
secret_
value:
'AAA123'
}]
})
end
...
...
@@ -169,7 +170,8 @@ describe Projects::PipelineSchedulesController do
context
'when params include two duplicated variables'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'AAA'
,
value:
'AAA123'
},
{
key:
'AAA'
,
value:
'BBB123'
}]
variables_attributes:
[{
secret_key:
'AAA'
,
secret_value:
'AAA123'
},
{
secret_key:
'AAA'
,
secret_value:
'BBB123'
}]
})
end
...
...
@@ -194,7 +196,7 @@ describe Projects::PipelineSchedulesController do
context
'when adds a new variable'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'AAA'
,
value:
'AAA123'
}]
variables_attributes:
[{
secret_key:
'AAA'
,
secret_
value:
'AAA123'
}]
})
end
...
...
@@ -209,7 +211,7 @@ describe Projects::PipelineSchedulesController do
context
'when adds a new duplicated variable'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'CCC'
,
value:
'AAA123'
}]
variables_attributes:
[{
secret_key:
'CCC'
,
secret_
value:
'AAA123'
}]
})
end
...
...
@@ -224,7 +226,7 @@ describe Projects::PipelineSchedulesController do
context
'when updates a variable'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
id:
pipeline_schedule_variable
.
id
,
value:
'new_value'
}]
variables_attributes:
[{
id:
pipeline_schedule_variable
.
id
,
secret_
value:
'new_value'
}]
})
end
...
...
@@ -252,7 +254,7 @@ describe Projects::PipelineSchedulesController do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
id:
pipeline_schedule_variable
.
id
,
_destroy:
true
},
{
key:
'CCC'
,
value:
'CCC123'
}]
{
secret_key:
'CCC'
,
secret_
value:
'CCC123'
}]
})
end
...
...
spec/features/projects/pipeline_schedules_spec.rb
View file @
68c6e410
...
...
@@ -159,10 +159,10 @@ feature 'Pipeline Schedules', :js do
visit_pipelines_schedules
click_link
'New schedule'
fill_in_schedule_form
all
(
'[name="schedule[variables_attributes][][key]"]'
)[
0
].
set
(
'AAA'
)
all
(
'[name="schedule[variables_attributes][][value]"]'
)[
0
].
set
(
'AAA123'
)
all
(
'[name="schedule[variables_attributes][][key]"]'
)[
1
].
set
(
'BBB'
)
all
(
'[name="schedule[variables_attributes][][value]"]'
)[
1
].
set
(
'BBB123'
)
all
(
'[name="schedule[variables_attributes][][
secret_
key]"]'
)[
0
].
set
(
'AAA'
)
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][][
secret_
value]"]'
)[
1
].
set
(
'BBB123'
)
save_pipeline_schedule
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