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
51730b3a
Commit
51730b3a
authored
Jun 27, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zj nice catches
parent
a7c4673e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
10 deletions
+23
-10
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/models/ci/pipeline_schedule.rb
app/models/ci/pipeline_schedule.rb
+4
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+6
-8
spec/models/ci/pipeline_schedule_spec.rb
spec/models/ci/pipeline_schedule_spec.rb
+11
-0
spec/models/ci/pipeline_schedule_variable_spec.rb
spec/models/ci/pipeline_schedule_variable_spec.rb
+1
-1
No files found.
app/models/ci/build.rb
View file @
51730b3a
...
@@ -196,7 +196,7 @@ module Ci
...
@@ -196,7 +196,7 @@ module Ci
variables
+=
user_variables
variables
+=
user_variables
variables
+=
project
.
secret_variables_for
(
ref
).
map
(
&
:to_runner_variable
)
variables
+=
project
.
secret_variables_for
(
ref
).
map
(
&
:to_runner_variable
)
variables
+=
trigger_request
&
.
user_variables
||
[]
variables
+=
trigger_request
&
.
user_variables
||
[]
variables
+=
pipeline
.
pipeline_schedule
&
.
variables
&
.
map
(
&
:to_runner_variable
)
||
[]
variables
+=
pipeline
.
pipeline_schedule
&
.
job_variables
variables
variables
end
end
...
...
app/models/ci/pipeline_schedule.rb
View file @
51730b3a
...
@@ -59,5 +59,9 @@ module Ci
...
@@ -59,5 +59,9 @@ module Ci
Gitlab
::
Ci
::
CronParser
.
new
(
worker_cron
,
worker_time_zone
)
Gitlab
::
Ci
::
CronParser
.
new
(
worker_cron
,
worker_time_zone
)
.
next_time_from
(
next_run_at
)
.
next_time_from
(
next_run_at
)
end
end
def
job_variables
variables
&
.
map
(
&
:to_runner_variable
)
||
[]
end
end
end
end
end
spec/models/ci/build_spec.rb
View file @
51730b3a
...
@@ -1373,20 +1373,18 @@ describe Ci::Build, :models do
...
@@ -1373,20 +1373,18 @@ describe Ci::Build, :models do
it
{
is_expected
.
to
include
(
predefined_trigger_variable
)
}
it
{
is_expected
.
to
include
(
predefined_trigger_variable
)
}
end
end
context
'when build was triggered by scheduled pipeline'
do
context
'when a job was triggered by a pipeline schedule'
do
let
(
:secret_variable
)
do
{
key:
'SECRET_KEY'
,
value:
'secret_value'
,
public:
false
}
end
let
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
project:
project
)
}
let
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
project:
project
)
}
let!
(
:pipeline_schedule_variable
)
do
create
(
:ci_pipeline_schedule_variable
,
key:
'SCHEDULE_VARIABLE_KEY'
,
pipeline_schedule:
pipeline_schedule
)
end
before
do
before
do
pipeline_schedule
.
pipelines
<<
pipeline
pipeline_schedule
.
pipelines
<<
pipeline
create
(
:ci_pipeline_schedule_variable
,
secret_variable
.
slice
(
:key
,
:value
).
merge
(
pipeline_schedule:
pipeline_schedule
))
end
end
it
{
is_expected
.
to
include
(
secret
_variable
)
}
it
{
is_expected
.
to
include
(
pipeline_schedule_variable
.
to_runner
_variable
)
}
end
end
context
'when yaml_variables are undefined'
do
context
'when yaml_variables are undefined'
do
...
...
spec/models/ci/pipeline_schedule_spec.rb
View file @
51730b3a
...
@@ -118,4 +118,15 @@ describe Ci::PipelineSchedule, models: true do
...
@@ -118,4 +118,15 @@ describe Ci::PipelineSchedule, models: true do
end
end
end
end
end
end
describe
'#job_variables'
do
let!
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
:nightly
)
}
let!
(
:pipeline_schedule_variables
)
do
create_list
(
:ci_pipeline_schedule_variable
,
2
,
pipeline_schedule:
pipeline_schedule
)
end
subject
{
pipeline_schedule
.
job_variables
}
it
{
is_expected
.
to
eq
(
pipeline_schedule_variables
.
map
(
&
:to_runner_variable
))
}
end
end
end
spec/models/ci/pipeline_schedule_variable_spec.rb
View file @
51730b3a
...
@@ -3,6 +3,6 @@ require 'spec_helper'
...
@@ -3,6 +3,6 @@ require 'spec_helper'
describe
Ci
::
PipelineScheduleVariable
,
models:
true
do
describe
Ci
::
PipelineScheduleVariable
,
models:
true
do
subject
{
build
(
:ci_pipeline_schedule_variable
)
}
subject
{
build
(
:ci_pipeline_schedule_variable
)
}
it
{
is_expected
.
to
be_kind_of
(
HasVariable
)
}
it
{
is_expected
.
to
include_module
(
HasVariable
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:key
).
scoped_to
(
:pipeline_schedule_id
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:key
).
scoped_to
(
:pipeline_schedule_id
)
}
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