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
e6d66c4d
Commit
e6d66c4d
authored
Jun 12, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't fail builds for projects that are deleted when they are stuck
parent
b4e84809
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
CHANGELOG
CHANGELOG
+1
-0
app/workers/stuck_ci_builds_worker.rb
app/workers/stuck_ci_builds_worker.rb
+1
-1
spec/workers/stuck_ci_builds_worker_spec.rb
spec/workers/stuck_ci_builds_worker_spec.rb
+16
-3
No files found.
CHANGELOG
View file @
e6d66c4d
...
...
@@ -21,6 +21,7 @@ v 8.9.0 (unreleased)
- Redesign navigation for project pages
- Fix groups API to list only user's accessible projects
- Redesign account and email confirmation emails
- Don't fail builds for projects that are deleted
- `git clone https://host/namespace/project` now works, in addition to using the `.git` suffix
- Bump nokogiri to 1.6.8
- Use gitlab-shell v3.0.0
...
...
app/workers/stuck_ci_builds_worker.rb
View file @
e6d66c4d
...
...
@@ -6,7 +6,7 @@ class StuckCiBuildsWorker
def
perform
Rails
.
logger
.
info
'Cleaning stuck builds'
builds
=
Ci
::
Build
.
running_or_pending
.
where
(
'
updated_at < ?'
,
BUILD_STUCK_TIMEOUT
.
ago
)
builds
=
Ci
::
Build
.
joins
(
:project
).
running_or_pending
.
where
(
'ci_builds.
updated_at < ?'
,
BUILD_STUCK_TIMEOUT
.
ago
)
builds
.
find_each
(
batch_size:
50
).
each
do
|
build
|
Rails
.
logger
.
debug
"Dropping stuck
#{
build
.
status
}
build
#{
build
.
id
}
for runner
#{
build
.
runner_id
}
"
build
.
drop
...
...
spec/workers/stuck_ci_builds_worker_spec.rb
View file @
e6d66c4d
...
...
@@ -2,6 +2,7 @@ require "spec_helper"
describe
StuckCiBuildsWorker
do
let!
(
:build
)
{
create
:ci_build
}
let
(
:worker
)
{
described_class
.
new
}
subject
do
build
.
reload
...
...
@@ -16,13 +17,13 @@ describe StuckCiBuildsWorker do
it
'gets dropped if it was updated over 2 days ago'
do
build
.
update!
(
updated_at:
2
.
days
.
ago
)
StuckCiBuildsWorker
.
new
.
perform
worker
.
perform
is_expected
.
to
eq
(
'failed'
)
end
it
"is still
#{
status
}
"
do
build
.
update!
(
updated_at:
1
.
minute
.
ago
)
StuckCiBuildsWorker
.
new
.
perform
worker
.
perform
is_expected
.
to
eq
(
status
)
end
end
...
...
@@ -36,9 +37,21 @@ describe StuckCiBuildsWorker do
it
"is still
#{
status
}
"
do
build
.
update!
(
updated_at:
2
.
days
.
ago
)
StuckCiBuildsWorker
.
new
.
perform
worker
.
perform
is_expected
.
to
eq
(
status
)
end
end
end
context
"for deleted project"
do
before
do
build
.
update!
(
status: :running
,
updated_at:
2
.
days
.
ago
)
build
.
project
.
update
(
pending_delete:
true
)
end
it
"does not drop build"
do
expect_any_instance_of
(
Ci
::
Build
).
not_to
receive
(
:drop
)
worker
.
perform
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