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
cd2d435d
Commit
cd2d435d
authored
Jun 19, 2017
by
Eric Eastwood
Committed by
Shinya Maeda
Jul 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Schedule pipelines with variables
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/32568
parent
5711562e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
2 deletions
+63
-2
app/views/projects/pipeline_schedules/_form.html.haml
app/views/projects/pipeline_schedules/_form.html.haml
+3
-2
spec/features/projects/pipeline_schedules_spec.rb
spec/features/projects/pipeline_schedules_spec.rb
+60
-0
No files found.
app/views/projects/pipeline_schedules/_form.html.haml
View file @
cd2d435d
...
...
@@ -27,8 +27,9 @@
%label
.label-light
#{
_
(
'Variables'
)
}
%ul
.js-pipeline-variable-list.pipeline-variable-list
-
@schedule
.
variables
.
each_with_index
do
|
variable
,
i
|
=
render
'variable_row'
,
id:
variable
.
id
,
key:
variable
.
key
,
value:
variable
.
value
-
if
@schedule
.
variables
.
present?
-
@schedule
.
variables
.
each_with_index
do
|
variable
,
i
|
=
render
'variable_row'
,
id:
variable
.
id
,
key:
variable
.
key
,
value:
variable
.
value
=
render
'variable_row'
.form-group
.col-md-9
...
...
spec/features/projects/pipeline_schedules_spec.rb
View file @
cd2d435d
...
...
@@ -93,6 +93,15 @@ feature 'Pipeline Schedules', :feature, js: true do
expect
(
page
).
to
have_content
(
'This field is required'
)
end
it
'sets a variable'
do
fill_in_schedule_form
fill_in_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([{
key:
'foo'
,
value:
'bar'
,
public:
false
}])
end
end
describe
'PATCH /projects/pipelines_schedules/:id/edit'
do
...
...
@@ -115,6 +124,14 @@ feature 'Pipeline Schedules', :feature, js: true do
expect
(
page
).
to
have_content
(
'my brand new description'
)
end
it
'adds a new variable'
do
fill_in_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([{
key:
'foo'
,
value:
'bar'
,
public:
false
}])
end
context
'when ref is nil'
do
before
do
pipeline_schedule
.
update_attribute
(
:ref
,
nil
)
...
...
@@ -127,6 +144,40 @@ feature 'Pipeline Schedules', :feature, js: true do
end
end
end
context
'when variables already exist'
do
before
do
create
(
:ci_pipeline_schedule_variable
,
key:
'some_key'
,
value:
'some_value'
,
pipeline_schedule:
pipeline_schedule
)
edit_pipeline_schedule
end
it
'edits existing variable'
do
expect
(
first
(
'[name="schedule[variables_attributes][][key]"]'
).
value
).
to
eq
(
'some_key'
)
expect
(
first
(
'[name="schedule[variables_attributes][][value]"]'
).
value
).
to
eq
(
'some_value'
)
fill_in_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([{
key:
'foo'
,
value:
'bar'
,
public:
false
}])
end
it
'removes an existing variable'
do
remove_variable
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([])
end
it
'adds another variable'
do
fill_in_variable
(
1
)
save_pipeline_schedule
expect
(
Ci
::
PipelineSchedule
.
last
.
job_variables
).
to
eq
([
{
key:
'some_key'
,
value:
'some_value'
,
public:
false
},
{
key:
'foo'
,
value:
'bar'
,
public:
false
}
])
end
end
end
context
'when user creates a new pipeline schedule with variables'
do
...
...
@@ -219,6 +270,15 @@ feature 'Pipeline Schedules', :feature, js: true do
click_button
'Save pipeline schedule'
end
def
fill_in_variable
(
index
=
0
)
all
(
'[name="schedule[variables_attributes][][key]"]'
)[
index
].
set
(
'foo'
)
all
(
'[name="schedule[variables_attributes][][value]"]'
)[
index
].
set
(
'bar'
)
end
def
remove_variable
first
(
'.js-pipeline-variable-list .js-row-remove-button'
).
click
end
def
fill_in_schedule_form
fill_in
'schedule_description'
,
with:
'my fancy description'
fill_in
'schedule_cron'
,
with:
'* 1 2 3 4'
...
...
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