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
Tatuya Kamada
gitlab-ce
Commits
1bbf2c2c
Commit
1bbf2c2c
authored
Feb 28, 2017
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubocop offenses
parent
f7d35234
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
17 deletions
+17
-17
lib/api/helpers/runner.rb
lib/api/helpers/runner.rb
+2
-2
lib/api/runner.rb
lib/api/runner.rb
+7
-9
lib/gitlab/ci/build/response/step.rb
lib/gitlab/ci/build/response/step.rb
+3
-3
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+5
-3
No files found.
lib/api/helpers/runner.rb
View file @
1bbf2c2c
module
API
module
API
module
Helpers
module
Helpers
module
Runner
module
Runner
JOB_TOKEN_HEADER
=
'HTTP_JOB_TOKEN'
JOB_TOKEN_HEADER
=
'HTTP_JOB_TOKEN'
.
freeze
JOB_TOKEN_PARAM
=
:token
JOB_TOKEN_PARAM
=
:token
UPDATE_RUNNER_EVERY
=
10
*
60
UPDATE_RUNNER_EVERY
=
10
*
60
...
@@ -42,7 +42,7 @@ module API
...
@@ -42,7 +42,7 @@ module API
end
end
def
job_not_found!
def
job_not_found!
if
headers
[
'User-Agent'
].
to_s
.
match
(
/gitlab(-ci-multi)?-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /
)
if
headers
[
'User-Agent'
].
to_s
=~
/gitlab(-ci-multi)?-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /
no_content!
no_content!
else
else
not_found!
not_found!
...
...
lib/api/runner.rb
View file @
1bbf2c2c
...
@@ -94,7 +94,7 @@ module API
...
@@ -94,7 +94,7 @@ module API
end
end
params
do
params
do
requires
:token
,
type:
String
,
desc:
%q(Runners's authentication token)
requires
:token
,
type:
String
,
desc:
%q(Runners's authentication token)
requires
:id
,
type:
Fixnum
,
desc:
%q(Job's ID)
requires
:id
,
type:
Integer
,
desc:
%q(Job's ID)
optional
:trace
,
type:
String
,
desc:
%q(Job's full trace)
optional
:trace
,
type:
String
,
desc:
%q(Job's full trace)
optional
:state
,
type:
String
,
desc:
%q(Job's status: success, failed)
optional
:state
,
type:
String
,
desc:
%q(Job's status: success, failed)
end
end
...
@@ -122,7 +122,7 @@ module API
...
@@ -122,7 +122,7 @@ module API
[
416
,
'Range not satisfiable'
]]
[
416
,
'Range not satisfiable'
]]
end
end
params
do
params
do
requires
:id
,
type:
Fixnum
,
desc:
%q(Job's ID)
requires
:id
,
type:
Integer
,
desc:
%q(Job's ID)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
end
end
patch
'/:id/trace'
do
patch
'/:id/trace'
do
...
@@ -152,9 +152,9 @@ module API
...
@@ -152,9 +152,9 @@ module API
[
413
,
'File too large'
]]
[
413
,
'File too large'
]]
end
end
params
do
params
do
requires
:id
,
type:
Fixnum
,
desc:
%q(Job's ID)
requires
:id
,
type:
Integer
,
desc:
%q(Job's ID)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
optional
:filesize
,
type:
Fixnum
,
desc:
%q(AR
tifacts filesize)
optional
:filesize
,
type:
Integer
,
desc:
%q(Ar
tifacts filesize)
end
end
post
'/:id/artifacts/authorize'
do
post
'/:id/artifacts/authorize'
do
not_allowed!
unless
Gitlab
.
config
.
artifacts
.
enabled
not_allowed!
unless
Gitlab
.
config
.
artifacts
.
enabled
...
@@ -183,7 +183,7 @@ module API
...
@@ -183,7 +183,7 @@ module API
[
413
,
'File too large'
]]
[
413
,
'File too large'
]]
end
end
params
do
params
do
requires
:id
,
type:
Fixnum
,
desc:
%q(Job's ID)
requires
:id
,
type:
Integer
,
desc:
%q(Job's ID)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
optional
:expire_in
,
type:
String
,
desc:
%q(Specify when artifacts should expire)
optional
:expire_in
,
type:
String
,
desc:
%q(Specify when artifacts should expire)
optional
'file'
,
type:
File
,
desc:
%q(Artifact's file)
optional
'file'
,
type:
File
,
desc:
%q(Artifact's file)
...
@@ -211,9 +211,7 @@ module API
...
@@ -211,9 +211,7 @@ module API
job
.
artifacts_file
=
artifacts
job
.
artifacts_file
=
artifacts
job
.
artifacts_metadata
=
metadata
job
.
artifacts_metadata
=
metadata
job
.
artifacts_expire_in
=
params
[
'expire_in'
]
||
job
.
artifacts_expire_in
=
params
[
'expire_in'
]
||
Gitlab
::
CurrentSettings
Gitlab
::
CurrentSettings
.
current_application_settings
.
default_artifacts_expire_in
.
current_application_settings
.
default_artifacts_expire_in
if
job
.
save
if
job
.
save
present
job
,
with:
Entities
::
JobRequest
::
Response
present
job
,
with:
Entities
::
JobRequest
::
Response
...
@@ -228,7 +226,7 @@ module API
...
@@ -228,7 +226,7 @@ module API
[
404
,
'Artifact not found'
]]
[
404
,
'Artifact not found'
]]
end
end
params
do
params
do
requires
:id
,
type:
Fixnum
,
desc:
%q(Job's ID)
requires
:id
,
type:
Integer
,
desc:
%q(Job's ID)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
end
end
get
'/:id/artifacts'
do
get
'/:id/artifacts'
do
...
...
lib/gitlab/ci/build/response/step.rb
View file @
1bbf2c2c
...
@@ -3,9 +3,9 @@ module Gitlab
...
@@ -3,9 +3,9 @@ module Gitlab
module
Build
module
Build
module
Response
module
Response
class
Step
class
Step
CONDITION_ON_FAILURE
=
'on_failure'
CONDITION_ON_FAILURE
=
'on_failure'
.
freeze
CONDITION_ON_SUCCESS
=
'on_success'
CONDITION_ON_SUCCESS
=
'on_success'
.
freeze
CONDITION_ALWAYS
=
'always'
CONDITION_ALWAYS
=
'always'
.
freeze
attr_reader
:name
,
:script
,
:when
,
:allow_failure
,
:timeout
attr_reader
:name
,
:script
,
:when
,
:allow_failure
,
:timeout
...
...
spec/requests/api/runner_spec.rb
View file @
1bbf2c2c
...
@@ -281,7 +281,7 @@ describe API::Runner do
...
@@ -281,7 +281,7 @@ describe API::Runner do
expect
(
json_response
[
'image'
]).
to
include
({
'name'
=>
'ruby:2.1'
})
expect
(
json_response
[
'image'
]).
to
include
({
'name'
=>
'ruby:2.1'
})
expect
(
json_response
[
'services'
]).
to
include
({
'name'
=>
'postgres'
})
expect
(
json_response
[
'services'
]).
to
include
({
'name'
=>
'postgres'
})
expect
(
json_response
[
'steps'
]).
to
include
({
'name'
=>
'after_script'
,
expect
(
json_response
[
'steps'
]).
to
include
({
'name'
=>
'after_script'
,
'script'
=>
[
'ls'
,
'date'
]
,
'script'
=>
%w(ls date)
,
'timeout'
=>
job
.
timeout
,
'timeout'
=>
job
.
timeout
,
'when'
=>
'always'
,
'when'
=>
'always'
,
'allow_failure'
=>
true
})
'allow_failure'
=>
true
})
...
@@ -889,9 +889,11 @@ describe API::Runner do
...
@@ -889,9 +889,11 @@ describe API::Runner do
end
end
def
upload_artifacts
(
file
,
headers
=
{},
accelerated
=
true
)
def
upload_artifacts
(
file
,
headers
=
{},
accelerated
=
true
)
params
=
accelerated
?
params
=
if
accelerated
{
'file.path'
=>
file
.
path
,
'file.name'
=>
file
.
original_filename
}
:
{
'file.path'
=>
file
.
path
,
'file.name'
=>
file
.
original_filename
}
else
{
'file'
=>
file
}
{
'file'
=>
file
}
end
post
api
(
"/jobs/
#{
job
.
id
}
/artifacts"
),
params
,
headers
post
api
(
"/jobs/
#{
job
.
id
}
/artifacts"
),
params
,
headers
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