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
22e00b08
Commit
22e00b08
authored
Sep 18, 2018
by
Shinya Maeda
Committed by
Alessio Caiazza
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make schedule and unschedule consistent
parent
e265fc3e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
app/models/ci/build.rb
app/models/ci/build.rb
+5
-5
app/workers/ci/build_schedule_worker.rb
app/workers/ci/build_schedule_worker.rb
+3
-6
No files found.
app/models/ci/build.rb
View file @
22e00b08
...
@@ -187,7 +187,7 @@ module Ci
...
@@ -187,7 +187,7 @@ module Ci
after_transition
any
=>
[
:manual
]
do
|
build
|
after_transition
any
=>
[
:manual
]
do
|
build
|
build
.
run_after_commit
do
build
.
run_after_commit
do
build
.
schedule
build
.
schedule
!
end
end
end
end
...
@@ -241,17 +241,17 @@ module Ci
...
@@ -241,17 +241,17 @@ module Ci
end
end
def
scheduled?
def
scheduled?
build
.
build_schedule
.
exist?
build
_schedule
.
present?
end
end
def
schedule
def
schedule
!
return
unless
schedulable?
return
unless
schedulable?
create_build_schedule!
(
execute_at:
execute_at
)
create_build_schedule!
(
execute_at:
execute_at
)
end
end
def
unschedule
def
unschedule
!
build
&
.
build_schedule
&
.
delete
build
_schedule
.
delete!
end
end
def
execute_at
def
execute_at
...
...
app/workers/ci/build_schedule_worker.rb
View file @
22e00b08
...
@@ -7,13 +7,10 @@ module Ci
...
@@ -7,13 +7,10 @@ module Ci
def
perform
(
build_id
)
def
perform
(
build_id
)
::
Ci
::
Build
.
preload
(
:build_schedule
).
find_by
(
id:
build_id
).
try
do
|
build
|
::
Ci
::
Build
.
preload
(
:build_schedule
).
find_by
(
id:
build_id
).
try
do
|
build
|
break
unless
build
.
build_schedule
.
present
?
break
unless
build
.
scheduled
?
b
egin
b
uild
.
unschedule!
Ci
::
PlayBuildService
.
new
(
build
.
project
,
build
.
user
).
execute
(
build
)
Ci
::
PlayBuildService
.
new
(
build
.
project
,
build
.
user
).
execute
(
build
)
ensure
build
.
unschedule
end
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