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
Boxiang Sun
gitlab-ce
Commits
07c7ba1b
Commit
07c7ba1b
authored
Nov 24, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to drop jobs for deleted projects
parent
d58bab4a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
10 deletions
+13
-10
app/models/ci/build.rb
app/models/ci/build.rb
+1
-0
app/models/commit_status.rb
app/models/commit_status.rb
+10
-6
app/workers/stuck_ci_jobs_worker.rb
app/workers/stuck_ci_jobs_worker.rb
+0
-2
spec/workers/stuck_ci_jobs_worker_spec.rb
spec/workers/stuck_ci_jobs_worker_spec.rb
+2
-2
No files found.
app/models/ci/build.rb
View file @
07c7ba1b
...
...
@@ -104,6 +104,7 @@ module Ci
end
before_transition
any
=>
[
:failed
]
do
|
build
|
next
unless
build
.
project
next
if
build
.
retries_max
.
zero?
if
build
.
retries_count
<
build
.
retries_max
...
...
app/models/commit_status.rb
View file @
07c7ba1b
...
...
@@ -17,6 +17,7 @@ class CommitStatus < ActiveRecord::Base
validates
:name
,
presence:
true
,
unless: :importing?
alias_attribute
:author
,
:user
alias_attribute
:pipeline_id
,
:commit_id
scope
:failed_but_allowed
,
->
do
where
(
allow_failure:
true
,
status:
[
:failed
,
:canceled
])
...
...
@@ -103,26 +104,29 @@ class CommitStatus < ActiveRecord::Base
end
after_transition
do
|
commit_status
,
transition
|
next
unless
commit_status
.
project
next
if
transition
.
loopback?
commit_status
.
run_after_commit
do
if
pipeline
if
pipeline
_id
if
complete?
||
manual?
PipelineProcessWorker
.
perform_async
(
pipeline
.
id
)
PipelineProcessWorker
.
perform_async
(
pipeline
_
id
)
else
PipelineUpdateWorker
.
perform_async
(
pipeline
.
id
)
PipelineUpdateWorker
.
perform_async
(
pipeline
_
id
)
end
end
StageUpdateWorker
.
perform_async
(
commit_status
.
stage_id
)
ExpireJobCacheWorker
.
perform_async
(
commit_status
.
id
)
StageUpdateWorker
.
perform_async
(
stage_id
)
ExpireJobCacheWorker
.
perform_async
(
id
)
end
end
after_transition
any
=>
:failed
do
|
commit_status
|
next
unless
commit_status
.
project
commit_status
.
run_after_commit
do
MergeRequests
::
AddTodoWhenBuildFailsService
.
new
(
p
ipeline
.
p
roject
,
nil
).
execute
(
self
)
.
new
(
project
,
nil
).
execute
(
self
)
end
end
end
...
...
app/workers/stuck_ci_jobs_worker.rb
View file @
07c7ba1b
...
...
@@ -48,7 +48,6 @@ class StuckCiJobsWorker
loop
do
jobs
=
Ci
::
Build
.
where
(
status:
status
)
.
where
(
'ci_builds.updated_at < ?'
,
timeout
.
ago
)
.
joins
(
:project
).
merge
(
Project
.
without_deleted
)
.
includes
(
:tags
,
:runner
,
project: :namespace
)
.
limit
(
100
)
.
to_a
...
...
@@ -67,4 +66,3 @@ class StuckCiJobsWorker
end
end
end
spec/workers/stuck_ci_jobs_worker_spec.rb
View file @
07c7ba1b
...
...
@@ -105,8 +105,8 @@ describe StuckCiJobsWorker do
job
.
project
.
update
(
pending_delete:
true
)
end
it
'does
not
drop job'
do
expect_any_instance_of
(
Ci
::
Build
).
not_
to
receive
(
:drop
)
it
'does drop job'
do
expect_any_instance_of
(
Ci
::
Build
).
to
receive
(
:drop
)
worker
.
perform
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