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
2f03c503
Commit
2f03c503
authored
Sep 25, 2018
by
Shinya Maeda
Committed by
Alessio Caiazza
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce ProceedBuildService
parent
422970c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
14 deletions
+19
-14
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/presenters/ci/build_presenter.rb
app/presenters/ci/build_presenter.rb
+1
-1
app/services/ci/proceed_build_service.rb
app/services/ci/proceed_build_service.rb
+15
-0
app/services/ci/process_pipeline_service.rb
app/services/ci/process_pipeline_service.rb
+1
-11
No files found.
app/models/ci/build.rb
View file @
2f03c503
...
@@ -180,7 +180,7 @@ module Ci
...
@@ -180,7 +180,7 @@ module Ci
end
end
before_transition
created: :scheduled
do
|
build
|
before_transition
created: :scheduled
do
|
build
|
build
.
scheduled_at
=
build
.
get
_scheduled_at
build
.
scheduled_at
=
build
.
options
_scheduled_at
end
end
after_transition
created: :scheduled
do
|
build
|
after_transition
created: :scheduled
do
|
build
|
...
@@ -263,7 +263,7 @@ module Ci
...
@@ -263,7 +263,7 @@ module Ci
self
.
when
==
'delayed'
&&
options
[
:start_in
].
present?
self
.
when
==
'delayed'
&&
options
[
:start_in
].
present?
end
end
def
get
_scheduled_at
def
options
_scheduled_at
ChronicDuration
.
parse
(
options
[
:start_in
])
&
.
seconds
&
.
from_now
ChronicDuration
.
parse
(
options
[
:start_in
])
&
.
seconds
&
.
from_now
end
end
...
...
app/presenters/ci/build_presenter.rb
View file @
2f03c503
...
@@ -36,7 +36,7 @@ module Ci
...
@@ -36,7 +36,7 @@ module Ci
end
end
def
execute_in
def
execute_in
[
0
,
scheduled_at
-
Time
.
now
].
max
scheduled?
&&
scheduled_at
&&
[
0
,
scheduled_at
-
Time
.
now
].
max
end
end
private
private
...
...
app/services/ci/
enqueue
_build_service.rb
→
app/services/ci/
proceed
_build_service.rb
View file @
2f03c503
# frozen_string_literal: true
# frozen_string_literal: true
module
Ci
module
Ci
class
Enqueue
BuildService
<
BaseService
class
Proceed
BuildService
<
BaseService
def
execute
(
build
)
def
execute
(
build
)
build
.
enqueue
if
build
.
schedulable?
build
.
schedule!
elsif
build
.
action?
build
.
actionize
else
build
.
enqueue
end
end
end
end
end
end
end
app/services/ci/process_pipeline_service.rb
View file @
2f03c503
...
@@ -37,7 +37,7 @@ module Ci
...
@@ -37,7 +37,7 @@ module Ci
def
process_build
(
build
,
current_status
)
def
process_build
(
build
,
current_status
)
if
valid_statuses_for_when
(
build
.
when
).
include?
(
current_status
)
if
valid_statuses_for_when
(
build
.
when
).
include?
(
current_status
)
proceed_build
(
build
)
Ci
::
ProceedBuildService
.
new
(
project
,
@user
).
execute
(
build
)
true
true
else
else
build
.
skip
build
.
skip
...
@@ -103,15 +103,5 @@ module Ci
...
@@ -103,15 +103,5 @@ module Ci
.
update_all
(
retried:
true
)
if
latest_statuses
.
any?
.
update_all
(
retried:
true
)
if
latest_statuses
.
any?
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
def
proceed_build
(
build
)
if
build
.
schedulable?
build
.
schedule!
elsif
build
.
action?
build
.
actionize
else
Ci
::
EnqueueBuildService
.
new
(
project
,
@user
).
execute
(
build
)
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