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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
bbf5bb70
Commit
bbf5bb70
authored
Feb 16, 2017
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubocop offenses
parent
3eafffce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
19 deletions
+16
-19
lib/api/helpers/runner.rb
lib/api/helpers/runner.rb
+1
-1
lib/gitlab/ci/build/response/image.rb
lib/gitlab/ci/build/response/image.rb
+1
-1
lib/gitlab/ci/build/response/step.rb
lib/gitlab/ci/build/response/step.rb
+1
-1
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+13
-16
No files found.
lib/api/helpers/runner.rb
View file @
bbf5bb70
...
@@ -36,7 +36,7 @@ module API
...
@@ -36,7 +36,7 @@ module API
contacted_at_max_age
=
UPDATE_RUNNER_EVERY
+
Random
.
rand
(
UPDATE_RUNNER_EVERY
)
contacted_at_max_age
=
UPDATE_RUNNER_EVERY
+
Random
.
rand
(
UPDATE_RUNNER_EVERY
)
current_runner
.
contacted_at
.
nil?
||
current_runner
.
contacted_at
.
nil?
||
(
Time
.
now
-
current_runner
.
contacted_at
)
>=
contacted_at_max_age
(
Time
.
now
-
current_runner
.
contacted_at
)
>=
contacted_at_max_age
end
end
def
build_not_found!
def
build_not_found!
...
...
lib/gitlab/ci/build/response/image.rb
View file @
bbf5bb70
...
@@ -17,4 +17,4 @@ module Gitlab
...
@@ -17,4 +17,4 @@ module Gitlab
end
end
end
end
end
end
end
end
\ No newline at end of file
lib/gitlab/ci/build/response/step.rb
View file @
bbf5bb70
...
@@ -43,4 +43,4 @@ module Gitlab
...
@@ -43,4 +43,4 @@ module Gitlab
end
end
end
end
end
end
end
end
\ No newline at end of file
spec/requests/api/runner_spec.rb
View file @
bbf5bb70
...
@@ -236,7 +236,6 @@ describe API::Runner do
...
@@ -236,7 +236,6 @@ describe API::Runner do
end
end
context
'when valid token is provided'
do
context
'when valid token is provided'
do
context
'when Runner is not active'
do
context
'when Runner is not active'
do
let
(
:runner
)
{
create
(
:ci_runner
,
:inactive
)
}
let
(
:runner
)
{
create
(
:ci_runner
,
:inactive
)
}
...
@@ -267,7 +266,7 @@ describe API::Runner do
...
@@ -267,7 +266,7 @@ describe API::Runner do
context
'when there is a pending job'
do
context
'when there is a pending job'
do
it
'starts a job'
do
it
'starts a job'
do
request_job
info:
{
platform: :darwin
}
request_job
info:
{
platform: :darwin
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
.
headers
).
not_to
have_key
(
'X-GitLab-Last-Update'
)
expect
(
response
.
headers
).
not_to
have_key
(
'X-GitLab-Last-Update'
)
...
@@ -320,7 +319,7 @@ describe API::Runner do
...
@@ -320,7 +319,7 @@ describe API::Runner do
let
(
:value
)
{
"
#{
param
}
_value"
}
let
(
:value
)
{
"
#{
param
}
_value"
}
it
%q(updates provided Runner's parameter)
do
it
%q(updates provided Runner's parameter)
do
request_job
info:
{
param
=>
value
}
request_job
info:
{
param
=>
value
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
runner
.
reload
runner
.
reload
...
@@ -386,24 +385,22 @@ describe API::Runner do
...
@@ -386,24 +385,22 @@ describe API::Runner do
request_job
request_job
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'variables'
]).
to
include
(
expect
(
json_response
[
'variables'
]).
to
include
({
'key'
=>
'CI_BUILD_NAME'
,
'value'
=>
'spinach'
,
'public'
=>
true
},
{
'key'
=>
'CI_BUILD_NAME'
,
'value'
=>
'spinach'
,
'public'
=>
true
},
{
'key'
=>
'CI_BUILD_STAGE'
,
'value'
=>
'test'
,
'public'
=>
true
},
{
'key'
=>
'CI_BUILD_STAGE'
,
'value'
=>
'test'
,
'public'
=>
true
},
{
'key'
=>
'CI_BUILD_TRIGGERED'
,
'value'
=>
'true'
,
'public'
=>
true
},
{
'key'
=>
'CI_BUILD_TRIGGERED'
,
'value'
=>
'true'
,
'public'
=>
true
},
{
'key'
=>
'DB_NAME'
,
'value'
=>
'postgres'
,
'public'
=>
true
},
{
'key'
=>
'DB_NAME'
,
'value'
=>
'postgres'
,
'public'
=>
true
},
{
'key'
=>
'SECRET_KEY'
,
'value'
=>
'secret_value'
,
'public'
=>
false
},
{
'key'
=>
'SECRET_KEY'
,
'value'
=>
'secret_value'
,
'public'
=>
false
},
{
'key'
=>
'TRIGGER_KEY_1'
,
'value'
=>
'TRIGGER_VALUE_1'
,
'public'
=>
false
})
{
'key'
=>
'TRIGGER_KEY_1'
,
'value'
=>
'TRIGGER_VALUE_1'
,
'public'
=>
false
},
)
end
end
end
end
describe
'registry credentials support'
do
describe
'registry credentials support'
do
let
(
:registry_url
)
{
'registry.example.com:5005'
}
let
(
:registry_url
)
{
'registry.example.com:5005'
}
let
(
:registry_credentials
)
do
let
(
:registry_credentials
)
do
{
'type'
=>
'registry'
,
{
'type'
=>
'registry'
,
'url'
=>
registry_url
,
'url'
=>
registry_url
,
'username'
=>
'gitlab-ci-token'
,
'username'
=>
'gitlab-ci-token'
,
'password'
=>
job
.
token
}
'password'
=>
job
.
token
}
end
end
context
'when registry is enabled'
do
context
'when registry is enabled'
do
...
@@ -431,7 +428,7 @@ describe API::Runner do
...
@@ -431,7 +428,7 @@ describe API::Runner do
def
request_job
(
token
=
runner
.
token
,
**
params
)
def
request_job
(
token
=
runner
.
token
,
**
params
)
new_params
=
params
.
merge
(
token:
token
,
last_update:
last_update
)
new_params
=
params
.
merge
(
token:
token
,
last_update:
last_update
)
post
api
(
'/jobs/request'
),
new_params
,
{
'User-Agent'
=>
user_agent
}
post
api
(
'/jobs/request'
),
new_params
,
{
'User-Agent'
=>
user_agent
}
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