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
afea2df1
Commit
afea2df1
authored
Dec 14, 2016
by
Kim "BKC" Carlbäcker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First attempt
parent
3a906126
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
lib/ci/api/builds.rb
lib/ci/api/builds.rb
+17
-0
lib/ci/api/helpers.rb
lib/ci/api/helpers.rb
+3
-0
No files found.
lib/ci/api/builds.rb
View file @
afea2df1
...
@@ -16,6 +16,15 @@ module Ci
...
@@ -16,6 +16,15 @@ module Ci
not_found!
unless
current_runner
.
active?
not_found!
unless
current_runner
.
active?
update_runner_info
update_runner_info
last_update
=
Gitlab
::
Redis
.
with
{
|
redis
|
redis
.
get
(
current_runner_redis_key
)}
if
params
[
:last_update
]
!=
""
if
:last_update
==
last_update
headers
'X-GitLab-Last-Update'
,
last_update
return
build_not_found!
end
end
build
=
Ci
::
RegisterBuildService
.
new
.
execute
(
current_runner
)
build
=
Ci
::
RegisterBuildService
.
new
.
execute
(
current_runner
)
if
build
if
build
...
@@ -26,6 +35,14 @@ module Ci
...
@@ -26,6 +35,14 @@ module Ci
else
else
Gitlab
::
Metrics
.
add_event
(
:build_not_found
)
Gitlab
::
Metrics
.
add_event
(
:build_not_found
)
if
last_update
==
""
Gitlab
::
Redis
.
with
do
|
redis
]
new_update
=
Time
.
new
.
inspect
redis
.
set
(
current_runner_redis_key
,
new_update
,
ex:
60
.
minutes
)
headers
'X-GitLab-Last-Update'
,
new_update
end
end
build_not_found!
build_not_found!
end
end
end
end
...
...
lib/ci/api/helpers.rb
View file @
afea2df1
...
@@ -60,6 +60,9 @@ module Ci
...
@@ -60,6 +60,9 @@ module Ci
@runner
||=
Runner
.
find_by_token
(
params
[
:token
].
to_s
)
@runner
||=
Runner
.
find_by_token
(
params
[
:token
].
to_s
)
end
end
def
current_runner_redis_key
@runner_redis_key
||=
"
#{
current_runner
.
token
}
_
#{
current_runner
.
tag_list
}
"
def
get_runner_version_from_params
def
get_runner_version_from_params
return
unless
params
[
"info"
].
present?
return
unless
params
[
"info"
].
present?
attributes_for_keys
([
"name"
,
"version"
,
"revision"
,
"platform"
,
"architecture"
],
params
[
"info"
])
attributes_for_keys
([
"name"
,
"version"
,
"revision"
,
"platform"
,
"architecture"
],
params
[
"info"
])
...
...
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