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
d614c431
Commit
d614c431
authored
Sep 01, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix trigger_request.variables
parent
cff104ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
lib/api/v3/triggers.rb
lib/api/v3/triggers.rb
+2
-4
spec/models/ci/trigger_request_spec.rb
spec/models/ci/trigger_request_spec.rb
+2
-2
spec/requests/api/v3/triggers_spec.rb
spec/requests/api/v3/triggers_spec.rb
+2
-1
No files found.
lib/api/v3/triggers.rb
View file @
d614c431
...
@@ -32,15 +32,13 @@ module API
...
@@ -32,15 +32,13 @@ module API
render_api_error!
(
result
[
:message
],
result
[
:http_status
])
render_api_error!
(
result
[
:message
],
result
[
:http_status
])
else
else
pipeline
=
result
[
:pipeline
]
pipeline
=
result
[
:pipeline
]
trigger_request
=
pipeline
.
trigger_request
trigger_request
=
Ci
::
TriggerRequest
.
find_by
(
commit_id:
pipeline
.
id
)
# We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# Ci::TriggerRequest doesn't save variables anymore.
# Ci::TriggerRequest doesn't save variables anymore.
# Here is copying Ci::PipelineVariable to Ci::TriggerRequest.variables for presenting the variables.
# 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.
# The same endpoint in v4 API pressents Pipeline instead of TriggerRequest, so it doesn't need such a process.
pipeline
.
variables
.
each
do
|
variable
|
trigger_request
.
variables
=
params
[
:variables
]
trigger_request
.
variables
<<
{
key:
variable
.
key
,
value:
variable
.
value
}
end
present
trigger_request
,
with:
::
API
::
V3
::
Entities
::
TriggerRequest
present
trigger_request
,
with:
::
API
::
V3
::
Entities
::
TriggerRequest
end
end
...
...
spec/models/ci/trigger_request_spec.rb
View file @
d614c431
...
@@ -5,13 +5,13 @@ describe Ci::TriggerRequest do
...
@@ -5,13 +5,13 @@ describe Ci::TriggerRequest do
it
'be invalid if saving a variable'
do
it
'be invalid if saving a variable'
do
trigger
=
build
(
:ci_trigger_request
,
variables:
{
TRIGGER_KEY_1
:
'TRIGGER_VALUE_1'
}
)
trigger
=
build
(
:ci_trigger_request
,
variables:
{
TRIGGER_KEY_1
:
'TRIGGER_VALUE_1'
}
)
expect
(
trigger
.
valid?
).
to
be_falsey
expect
(
trigger
).
not_to
be_valid
end
end
it
'be valid if not saving a variable'
do
it
'be valid if not saving a variable'
do
trigger
=
build
(
:ci_trigger_request
)
trigger
=
build
(
:ci_trigger_request
)
expect
(
trigger
.
valid?
).
to
be_truthy
expect
(
trigger
).
to
be_valid
end
end
end
end
end
end
spec/requests/api/v3/triggers_spec.rb
View file @
d614c431
...
@@ -80,7 +80,8 @@ describe API::V3::Triggers do
...
@@ -80,7 +80,8 @@ describe API::V3::Triggers do
post
v3_api
(
"/projects/
#{
project
.
id
}
/trigger/builds"
),
options
.
merge
(
variables:
variables
,
ref:
'master'
)
post
v3_api
(
"/projects/
#{
project
.
id
}
/trigger/builds"
),
options
.
merge
(
variables:
variables
,
ref:
'master'
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
pipeline
.
builds
.
reload
pipeline
.
builds
.
reload
expect
(
pipeline
.
builds
.
first
.
trigger_request
.
variables
).
to
eq
(
variables
)
expect
(
pipeline
.
variables
.
map
{
|
v
|
{
v
.
key
=>
v
.
value
}
}.
first
).
to
eq
(
variables
)
expect
(
json_response
[
'variables'
]).
to
eq
(
variables
)
end
end
end
end
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