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
c03631a9
Commit
c03631a9
authored
Sep 17, 2018
by
Shinya Maeda
Committed by
Alessio Caiazza
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support new syntax
parent
3fc4c096
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
18 deletions
+19
-18
app/models/ci/build.rb
app/models/ci/build.rb
+8
-7
app/services/ci/process_pipeline_service.rb
app/services/ci/process_pipeline_service.rb
+1
-1
lib/gitlab/ci/config/entry/job.rb
lib/gitlab/ci/config/entry/job.rb
+6
-6
lib/gitlab/ci/status/build/delayed.rb
lib/gitlab/ci/status/build/delayed.rb
+2
-2
lib/gitlab/ci/status/build/factory.rb
lib/gitlab/ci/status/build/factory.rb
+1
-1
lib/gitlab/ci/yaml_processor.rb
lib/gitlab/ci/yaml_processor.rb
+1
-1
No files found.
app/models/ci/build.rb
View file @
c03631a9
...
@@ -186,6 +186,7 @@ module Ci
...
@@ -186,6 +186,7 @@ module Ci
end
end
after_transition
any
=>
[
:manual
]
do
|
build
|
after_transition
any
=>
[
:manual
]
do
|
build
|
puts
"
#{
self
.
class
.
name
}
-
#{
__callee__
}
: 1"
build
.
run_after_commit
do
build
.
run_after_commit
do
build
.
schedule_delayed_execution
build
.
schedule_delayed_execution
end
end
...
@@ -236,22 +237,22 @@ module Ci
...
@@ -236,22 +237,22 @@ module Ci
action?
&&
(
manual?
||
retryable?
)
action?
&&
(
manual?
||
retryable?
)
end
end
def
autoplay
?
def
delayed
?
manual?
&&
options
[
:
autoplay
_in
].
present?
manual?
&&
options
[
:
start
_in
].
present?
end
end
def
autoplay
_at
def
execute
_at
ChronicDuration
.
parse
(
options
[
:
autoplay
_in
])
&
.
seconds
&
.
from_now
ChronicDuration
.
parse
(
options
[
:
start
_in
])
&
.
seconds
&
.
from_now
end
end
def
schedule_delayed_execution
def
schedule_delayed_execution
return
unless
autoplay
?
return
unless
delayed
?
create_build_schedule!
(
execute_at:
autoplay
_at
)
create_build_schedule!
(
execute_at:
execute
_at
)
end
end
def
action?
def
action?
self
.
when
==
'manual'
self
.
when
==
'manual'
||
self
.
when
==
'delayed'
end
end
# rubocop: disable CodeReuse/ServiceClass
# rubocop: disable CodeReuse/ServiceClass
...
...
app/services/ci/process_pipeline_service.rb
View file @
c03631a9
...
@@ -53,7 +53,7 @@ module Ci
...
@@ -53,7 +53,7 @@ module Ci
%w[failed]
%w[failed]
when
'always'
when
'always'
%w[success failed skipped]
%w[success failed skipped]
when
'manual'
when
'manual'
,
'delayed'
%w[success skipped]
%w[success skipped]
else
else
[]
[]
...
...
lib/gitlab/ci/config/entry/job.rb
View file @
c03631a9
...
@@ -10,7 +10,7 @@ module Gitlab
...
@@ -10,7 +10,7 @@ module Gitlab
include
Attributable
include
Attributable
ALLOWED_KEYS
=
%i[tags script only except type image services
ALLOWED_KEYS
=
%i[tags script only except type image services
allow_failure type stage when
autoplay
_in artifacts cache
allow_failure type stage when
start
_in artifacts cache
dependencies before_script after_script variables
dependencies before_script after_script variables
environment coverage retry extends]
.
freeze
environment coverage retry extends]
.
freeze
...
@@ -28,7 +28,7 @@ module Gitlab
...
@@ -28,7 +28,7 @@ module Gitlab
greater_than_or_equal_to:
0
,
greater_than_or_equal_to:
0
,
less_than_or_equal_to:
2
}
less_than_or_equal_to:
2
}
validates
:when
,
validates
:when
,
inclusion:
{
in:
%w[on_success on_failure always manual]
,
inclusion:
{
in:
%w[on_success on_failure always manual
delayed
]
,
message:
'should be on_success, on_failure, '
\
message:
'should be on_success, on_failure, '
\
'always or manual'
}
'always or manual'
}
...
@@ -36,11 +36,11 @@ module Gitlab
...
@@ -36,11 +36,11 @@ module Gitlab
validates
:extends
,
type:
String
validates
:extends
,
type:
String
with_options
if: :manual_action?
do
with_options
if: :manual_action?
do
validates
:
autoplay
_in
,
duration:
true
,
allow_nil:
true
validates
:
start
_in
,
duration:
true
,
allow_nil:
true
end
end
with_options
unless: :manual_action?
do
with_options
unless: :manual_action?
do
validates
:
autoplay
_in
,
presence:
false
validates
:
start
_in
,
presence:
false
end
end
end
end
end
end
...
@@ -92,7 +92,7 @@ module Gitlab
...
@@ -92,7 +92,7 @@ module Gitlab
:artifacts
,
:commands
,
:environment
,
:coverage
,
:retry
:artifacts
,
:commands
,
:environment
,
:coverage
,
:retry
attributes
:script
,
:tags
,
:allow_failure
,
:when
,
:dependencies
,
attributes
:script
,
:tags
,
:allow_failure
,
:when
,
:dependencies
,
:retry
,
:extends
,
:
autoplay
_in
:retry
,
:extends
,
:
start
_in
def
compose!
(
deps
=
nil
)
def
compose!
(
deps
=
nil
)
super
do
super
do
...
@@ -119,7 +119,7 @@ module Gitlab
...
@@ -119,7 +119,7 @@ module Gitlab
end
end
def
manual_action?
def
manual_action?
self
.
when
==
'manual'
self
.
when
==
'manual'
||
self
.
when
==
'delayed'
end
end
def
ignored?
def
ignored?
...
...
lib/gitlab/ci/status/build/
manual_with_auto_play
.rb
→
lib/gitlab/ci/status/build/
delayed
.rb
View file @
c03631a9
...
@@ -2,7 +2,7 @@ module Gitlab
...
@@ -2,7 +2,7 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Build
module
Build
class
ManualWithAutoPlay
<
Status
::
Extended
class
Delayed
<
Status
::
Extended
###
###
# TODO: Those are random values. We have to fix accoding to the UX review
# TODO: Those are random values. We have to fix accoding to the UX review
###
###
...
@@ -43,7 +43,7 @@ module Gitlab
...
@@ -43,7 +43,7 @@ module Gitlab
end
end
def
self
.
matches?
(
build
,
user
)
def
self
.
matches?
(
build
,
user
)
build
.
autoplay
?
&&
!
build
.
canceled?
build
.
delayed
?
&&
!
build
.
canceled?
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/build/factory.rb
View file @
c03631a9
...
@@ -5,7 +5,7 @@ module Gitlab
...
@@ -5,7 +5,7 @@ module Gitlab
class
Factory
<
Status
::
Factory
class
Factory
<
Status
::
Factory
def
self
.
extended_statuses
def
self
.
extended_statuses
[[
Status
::
Build
::
Erased
,
[[
Status
::
Build
::
Erased
,
Status
::
Build
::
ManualWithAutoPlay
,
Status
::
Build
::
Delayed
,
Status
::
Build
::
Manual
,
Status
::
Build
::
Manual
,
Status
::
Build
::
Canceled
,
Status
::
Build
::
Canceled
,
Status
::
Build
::
Created
,
Status
::
Build
::
Created
,
...
...
lib/gitlab/ci/yaml_processor.rb
View file @
c03631a9
...
@@ -50,7 +50,7 @@ module Gitlab
...
@@ -50,7 +50,7 @@ module Gitlab
after_script:
job
[
:after_script
],
after_script:
job
[
:after_script
],
environment:
job
[
:environment
],
environment:
job
[
:environment
],
retry:
job
[
:retry
],
retry:
job
[
:retry
],
autoplay_in:
job
[
:autoplay
_in
],
start_in:
job
[
:start
_in
],
}.
compact
}
}.
compact
}
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