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
1ccf720c
Commit
1ccf720c
authored
May 02, 2018
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Override #save_result to write to tracking database
parent
0b28c8cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
app/workers/repository_check/single_repository_worker.rb
app/workers/repository_check/single_repository_worker.rb
+2
-0
ee/app/workers/ee/repository_check/single_repository_worker.rb
...p/workers/ee/repository_check/single_repository_worker.rb
+24
-0
ee/spec/workers/ee/repository_check/single_repository_worker_spec.rb
...kers/ee/repository_check/single_repository_worker_spec.rb
+15
-0
No files found.
app/workers/repository_check/single_repository_worker.rb
View file @
1ccf720c
...
...
@@ -3,6 +3,8 @@ module RepositoryCheck
include
ApplicationWorker
include
RepositoryCheckQueue
prepend
::
EE
::
RepositoryCheck
::
SingleRepositoryWorker
def
perform
(
project_id
)
project
=
Project
.
find
(
project_id
)
result
=
check
(
project
)
...
...
ee/app/workers/ee/repository_check/single_repository_worker.rb
0 → 100644
View file @
1ccf720c
module
EE
module
RepositoryCheck
module
SingleRepositoryWorker
extend
ActiveSupport
::
Concern
extend
::
Gitlab
::
Utils
::
Override
private
override
:save_result
def
save_result
(
project
,
failure
)
# TODO: Check for Geo
# TODO: What if project registry does not exist
project_registry
=
Geo
::
ProjectRegistry
.
find_by
(
project_id:
project
.
id
)
project_registry
.
update_columns
(
last_repository_check_failed:
failure
,
last_repository_check_at:
Time
.
now
)
end
end
end
end
ee/spec/workers/ee/repository_check/single_repository_worker_spec.rb
0 → 100644
View file @
1ccf720c
require
'spec_helper'
describe
EE
::
RepositoryCheck
::
SingleRepositoryWorker
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:project_registry
)
{
create
(
:geo_project_registry
,
project:
project
)
}
set
(
:secondary
)
{
create
(
:geo_node
)
}
subject
(
:worker
)
{
RepositoryCheck
::
SingleRepositoryWorker
.
new
}
it
'saves results to Geo registry'
do
expect
do
worker
.
perform
(
project
.
id
)
end
.
to
change
{
project_registry
.
reload
.
last_repository_check_at
}
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