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
cff104ec
Commit
cff104ec
authored
Aug 28, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec
parent
acc74978
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
13 deletions
+13
-13
app/models/ci/trigger_request.rb
app/models/ci/trigger_request.rb
+1
-1
lib/api/v3/triggers.rb
lib/api/v3/triggers.rb
+3
-2
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+1
-1
spec/factories/ci/trigger_requests.rb
spec/factories/ci/trigger_requests.rb
+4
-5
spec/features/projects/jobs_spec.rb
spec/features/projects/jobs_spec.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+1
-1
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+1
-1
spec/views/projects/jobs/show.html.haml_spec.rb
spec/views/projects/jobs/show.html.haml_spec.rb
+1
-1
No files found.
app/models/ci/trigger_request.rb
View file @
cff104ec
...
@@ -6,7 +6,7 @@ module Ci
...
@@ -6,7 +6,7 @@ module Ci
belongs_to
:pipeline
,
foreign_key: :commit_id
belongs_to
:pipeline
,
foreign_key: :commit_id
has_many
:builds
has_many
:builds
# W
s swti
ched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# W
e swit
ched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# Ci::TriggerRequest doesn't save variables anymore.
# Ci::TriggerRequest doesn't save variables anymore.
validates
:variables
,
absence:
true
validates
:variables
,
absence:
true
...
...
lib/api/v3/triggers.rb
View file @
cff104ec
...
@@ -34,9 +34,10 @@ module API
...
@@ -34,9 +34,10 @@ module API
pipeline
=
result
[
:pipeline
]
pipeline
=
result
[
:pipeline
]
trigger_request
=
pipeline
.
trigger_request
trigger_request
=
pipeline
.
trigger_request
# W
s swti
ched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# W
e swit
ched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# Ci::TriggerRequest doesn't save variables anymore.
# Ci::TriggerRequest doesn't save variables anymore.
# Although, to prevent braking compatibility, copying variables and present it as Ci::TriggerRequest.
# Here is copying Ci::PipelineVariable to Ci::TriggerRequest.variables for presenting the variables.
# The same endpoint in v4 API pressents Pipeline instead of TriggerRequest, so it doesn't need such a process.
pipeline
.
variables
.
each
do
|
variable
|
pipeline
.
variables
.
each
do
|
variable
|
trigger_request
.
variables
<<
{
key:
variable
.
key
,
value:
variable
.
value
}
trigger_request
.
variables
<<
{
key:
variable
.
key
,
value:
variable
.
value
}
end
end
...
...
spec/factories/ci/builds.rb
View file @
cff104ec
...
@@ -107,7 +107,7 @@ FactoryGirl.define do
...
@@ -107,7 +107,7 @@ FactoryGirl.define do
end
end
trait
:triggered
do
trait
:triggered
do
trigger_request
factory: :ci_trigger_request_with_variables
# TODO:
trigger_request
factory: :ci_trigger_request_with_variables
end
end
after
(
:build
)
do
|
build
,
evaluator
|
after
(
:build
)
do
|
build
,
evaluator
|
...
...
spec/factories/ci/trigger_requests.rb
View file @
cff104ec
...
@@ -2,12 +2,11 @@ FactoryGirl.define do
...
@@ -2,12 +2,11 @@ FactoryGirl.define do
factory
:ci_trigger_request
,
class:
Ci
::
TriggerRequest
do
factory
:ci_trigger_request
,
class:
Ci
::
TriggerRequest
do
trigger
factory: :ci_trigger
trigger
factory: :ci_trigger
# We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# Ci::TriggerRequest doesn't save variables anymore, whereas old trigger requests still persist variables.
factory
:ci_trigger_request_with_variables
do
factory
:ci_trigger_request_with_variables
do
variables
do
after
(
:create
)
do
|
trigger_request
,
evaluator
|
{
trigger_request
.
update_attribute
(
:variables
,
{
TRIGGER_KEY_1
:
'TRIGGER_VALUE_1'
,
TRIGGER_KEY_2
:
'TRIGGER_VALUE_2'
}
)
TRIGGER_KEY_1
:
'TRIGGER_VALUE_1'
,
TRIGGER_KEY_2
:
'TRIGGER_VALUE_2'
}
end
end
end
end
end
end
...
...
spec/features/projects/jobs_spec.rb
View file @
cff104ec
...
@@ -292,7 +292,7 @@ feature 'Jobs' do
...
@@ -292,7 +292,7 @@ feature 'Jobs' do
end
end
feature
'Variables'
do
feature
'Variables'
do
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
)
}
# TODO:
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
)
}
let
(
:job
)
do
let
(
:job
)
do
create
:ci_build
,
pipeline:
pipeline
,
trigger_request:
trigger_request
create
:ci_build
,
pipeline:
pipeline
,
trigger_request:
trigger_request
...
...
spec/models/ci/build_spec.rb
View file @
cff104ec
...
@@ -1492,7 +1492,7 @@ describe Ci::Build do
...
@@ -1492,7 +1492,7 @@ describe Ci::Build do
context
'when build is for triggers'
do
context
'when build is for triggers'
do
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
,
trigger:
trigger
)
}
# TODO:
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
,
trigger:
trigger
)
}
let
(
:user_trigger_variable
)
do
let
(
:user_trigger_variable
)
do
{
key: :TRIGGER_KEY_1
,
value:
'TRIGGER_VALUE_1'
,
public:
false
}
{
key: :TRIGGER_KEY_1
,
value:
'TRIGGER_VALUE_1'
,
public:
false
}
end
end
...
...
spec/requests/api/runner_spec.rb
View file @
cff104ec
...
@@ -559,7 +559,7 @@ describe API::Runner do
...
@@ -559,7 +559,7 @@ describe API::Runner do
before
do
before
do
trigger
=
create
(
:ci_trigger
,
project:
project
)
trigger
=
create
(
:ci_trigger
,
project:
project
)
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
,
builds:
[
job
],
trigger:
trigger
)
# TODO:
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
,
builds:
[
job
],
trigger:
trigger
)
project
.
variables
<<
Ci
::
Variable
.
new
(
key:
'SECRET_KEY'
,
value:
'secret_value'
)
project
.
variables
<<
Ci
::
Variable
.
new
(
key:
'SECRET_KEY'
,
value:
'secret_value'
)
end
end
...
...
spec/views/projects/jobs/show.html.haml_spec.rb
View file @
cff104ec
...
@@ -197,7 +197,7 @@ describe 'projects/jobs/show' do
...
@@ -197,7 +197,7 @@ describe 'projects/jobs/show' do
end
end
describe
'shows trigger variables in sidebar'
do
describe
'shows trigger variables in sidebar'
do
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
)
}
# TODO:
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
)
}
before
do
before
do
build
.
trigger_request
=
trigger_request
build
.
trigger_request
=
trigger_request
...
...
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