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
Jérome Perrin
gitlab-ce
Commits
ac5bd3b7
Commit
ac5bd3b7
authored
Mar 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reinstitute a core `manual` status for manual actions
parent
dd240911
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
35 additions
and
35 deletions
+35
-35
app/models/ci/build.rb
app/models/ci/build.rb
+7
-7
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+2
-2
app/models/commit_status.rb
app/models/commit_status.rb
+6
-6
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+9
-9
app/services/ci/process_pipeline_service.rb
app/services/ci/process_pipeline_service.rb
+2
-2
app/views/projects/ci/builds/_build.html.haml
app/views/projects/ci/builds/_build.html.haml
+1
-1
lib/gitlab/ci/status/manual.rb
lib/gitlab/ci/status/manual.rb
+3
-3
lib/gitlab/data_builder/pipeline.rb
lib/gitlab/data_builder/pipeline.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+2
-2
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+2
-2
No files found.
app/models/ci/build.rb
View file @
ac5bd3b7
...
@@ -63,8 +63,8 @@ module Ci
...
@@ -63,8 +63,8 @@ module Ci
end
end
state_machine
:status
do
state_machine
:status
do
event
:
block
do
event
:
actionize
do
transition
created: :
blocked
transition
created: :
manual
end
end
after_transition
any
=>
[
:pending
]
do
|
build
|
after_transition
any
=>
[
:pending
]
do
|
build
|
...
@@ -103,16 +103,16 @@ module Ci
...
@@ -103,16 +103,16 @@ module Ci
end
end
def
playable?
def
playable?
project
.
builds_enabled?
&&
has_commands?
&&
manual?
&&
project
.
builds_enabled?
&&
has_commands?
&&
(
skipped?
||
blocked?
)
action?
&&
manual?
end
end
def
manual
?
def
action
?
self
.
when
==
'manual'
self
.
when
==
'manual'
end
end
def
barrier?
def
barrier?
manual
?
&&
!
allow_failure?
action
?
&&
!
allow_failure?
end
end
def
has_commands?
def
has_commands?
...
@@ -565,7 +565,7 @@ module Ci
...
@@ -565,7 +565,7 @@ module Ci
]
]
variables
<<
{
key:
'CI_BUILD_TAG'
,
value:
ref
,
public:
true
}
if
tag?
variables
<<
{
key:
'CI_BUILD_TAG'
,
value:
ref
,
public:
true
}
if
tag?
variables
<<
{
key:
'CI_BUILD_TRIGGERED'
,
value:
'true'
,
public:
true
}
if
trigger_request
variables
<<
{
key:
'CI_BUILD_TRIGGERED'
,
value:
'true'
,
public:
true
}
if
trigger_request
variables
<<
{
key:
'CI_BUILD_MANUAL'
,
value:
'true'
,
public:
true
}
if
manual
?
variables
<<
{
key:
'CI_BUILD_MANUAL'
,
value:
'true'
,
public:
true
}
if
action
?
variables
variables
end
end
...
...
app/models/ci/pipeline.rb
View file @
ac5bd3b7
...
@@ -50,7 +50,7 @@ module Ci
...
@@ -50,7 +50,7 @@ module Ci
end
end
event
:block
do
event
:block
do
transition
any
-
[
:
blocked
]
=>
:blocked
transition
any
-
[
:
manual
]
=>
:manual
end
end
# IMPORTANT
# IMPORTANT
...
@@ -325,7 +325,7 @@ module Ci
...
@@ -325,7 +325,7 @@ module Ci
when
'failed'
then
drop
when
'failed'
then
drop
when
'canceled'
then
cancel
when
'canceled'
then
cancel
when
'skipped'
then
skip
when
'skipped'
then
skip
when
'
blocked
'
then
block
when
'
manual
'
then
block
end
end
end
end
end
end
...
...
app/models/commit_status.rb
View file @
ac5bd3b7
...
@@ -25,13 +25,13 @@ class CommitStatus < ActiveRecord::Base
...
@@ -25,13 +25,13 @@ class CommitStatus < ActiveRecord::Base
end
end
scope
:failed_but_allowed
,
->
do
scope
:failed_but_allowed
,
->
do
where
(
allow_failure:
true
,
status:
[
:failed
,
:canceled
,
:
blocked
])
where
(
allow_failure:
true
,
status:
[
:failed
,
:canceled
,
:
manual
])
end
end
scope
:exclude_ignored
,
->
do
scope
:exclude_ignored
,
->
do
# We want to ignore failed_but_allowed jobs
# We want to ignore failed_but_allowed jobs
where
(
"allow_failure = ? OR status IN (?)"
,
where
(
"allow_failure = ? OR status IN (?)"
,
false
,
all_state_names
-
[
:failed
,
:canceled
,
:
blocked
])
false
,
all_state_names
-
[
:failed
,
:canceled
,
:
manual
])
end
end
scope
:retried
,
->
{
where
.
not
(
id:
latest
)
}
scope
:retried
,
->
{
where
.
not
(
id:
latest
)
}
...
@@ -42,11 +42,11 @@ class CommitStatus < ActiveRecord::Base
...
@@ -42,11 +42,11 @@ class CommitStatus < ActiveRecord::Base
state_machine
:status
do
state_machine
:status
do
event
:enqueue
do
event
:enqueue
do
transition
[
:created
,
:skipped
,
:
blocked
]
=>
:pending
transition
[
:created
,
:skipped
,
:
manual
]
=>
:pending
end
end
event
:process
do
event
:process
do
transition
[
:skipped
,
:
blocked
]
=>
:created
transition
[
:skipped
,
:
manual
]
=>
:created
end
end
event
:run
do
event
:run
do
...
@@ -66,7 +66,7 @@ class CommitStatus < ActiveRecord::Base
...
@@ -66,7 +66,7 @@ class CommitStatus < ActiveRecord::Base
end
end
event
:cancel
do
event
:cancel
do
transition
[
:created
,
:pending
,
:running
,
:
blocked
]
=>
:canceled
transition
[
:created
,
:pending
,
:running
,
:
manual
]
=>
:canceled
end
end
before_transition
created:
[
:pending
,
:running
]
do
|
commit_status
|
before_transition
created:
[
:pending
,
:running
]
do
|
commit_status
|
...
@@ -86,7 +86,7 @@ class CommitStatus < ActiveRecord::Base
...
@@ -86,7 +86,7 @@ class CommitStatus < ActiveRecord::Base
commit_status
.
run_after_commit
do
commit_status
.
run_after_commit
do
pipeline
.
try
do
|
pipeline
|
pipeline
.
try
do
|
pipeline
|
if
complete?
||
blocked
?
if
complete?
||
manual
?
PipelineProcessWorker
.
perform_async
(
pipeline
.
id
)
PipelineProcessWorker
.
perform_async
(
pipeline
.
id
)
else
else
PipelineUpdateWorker
.
perform_async
(
pipeline
.
id
)
PipelineUpdateWorker
.
perform_async
(
pipeline
.
id
)
...
...
app/models/concerns/has_status.rb
View file @
ac5bd3b7
...
@@ -2,12 +2,12 @@ module HasStatus
...
@@ -2,12 +2,12 @@ module HasStatus
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
DEFAULT_STATUS
=
'created'
.
freeze
DEFAULT_STATUS
=
'created'
.
freeze
BLOCKED_STATUS
=
'
blocked
'
.
freeze
BLOCKED_STATUS
=
'
manual
'
.
freeze
AVAILABLE_STATUSES
=
%w[created pending running success failed canceled skipped
blocked
]
.
freeze
AVAILABLE_STATUSES
=
%w[created pending running success failed canceled skipped
manual
]
.
freeze
STARTED_STATUSES
=
%w[running success failed skipped]
.
freeze
STARTED_STATUSES
=
%w[running success failed skipped]
.
freeze
ACTIVE_STATUSES
=
%w[pending running
blocked
]
.
freeze
ACTIVE_STATUSES
=
%w[pending running
manual
]
.
freeze
COMPLETED_STATUSES
=
%w[success failed canceled skipped]
.
freeze
COMPLETED_STATUSES
=
%w[success failed canceled skipped]
.
freeze
ORDERED_STATUSES
=
%w[
blocked
failed pending running canceled success skipped]
.
freeze
ORDERED_STATUSES
=
%w[
manual
failed pending running canceled success skipped]
.
freeze
class_methods
do
class_methods
do
def
status_sql
def
status_sql
...
@@ -16,7 +16,7 @@ module HasStatus
...
@@ -16,7 +16,7 @@ module HasStatus
builds
=
scope
.
select
(
'count(*)'
).
to_sql
builds
=
scope
.
select
(
'count(*)'
).
to_sql
created
=
scope
.
created
.
select
(
'count(*)'
).
to_sql
created
=
scope
.
created
.
select
(
'count(*)'
).
to_sql
success
=
scope
.
success
.
select
(
'count(*)'
).
to_sql
success
=
scope
.
success
.
select
(
'count(*)'
).
to_sql
blocked
=
scope
.
blocked
.
select
(
'count(*)'
).
to_sql
manual
=
scope
.
manual
.
select
(
'count(*)'
).
to_sql
pending
=
scope
.
pending
.
select
(
'count(*)'
).
to_sql
pending
=
scope
.
pending
.
select
(
'count(*)'
).
to_sql
running
=
scope
.
running
.
select
(
'count(*)'
).
to_sql
running
=
scope
.
running
.
select
(
'count(*)'
).
to_sql
skipped
=
scope
.
skipped
.
select
(
'count(*)'
).
to_sql
skipped
=
scope
.
skipped
.
select
(
'count(*)'
).
to_sql
...
@@ -30,7 +30,7 @@ module HasStatus
...
@@ -30,7 +30,7 @@ module HasStatus
WHEN (
#{
builds
}
)=(
#{
success
}
)+(
#{
skipped
}
)+(
#{
canceled
}
) THEN 'canceled'
WHEN (
#{
builds
}
)=(
#{
success
}
)+(
#{
skipped
}
)+(
#{
canceled
}
) THEN 'canceled'
WHEN (
#{
builds
}
)=(
#{
created
}
)+(
#{
skipped
}
)+(
#{
pending
}
) THEN 'pending'
WHEN (
#{
builds
}
)=(
#{
created
}
)+(
#{
skipped
}
)+(
#{
pending
}
) THEN 'pending'
WHEN (
#{
running
}
)+(
#{
pending
}
)>0 THEN 'running'
WHEN (
#{
running
}
)+(
#{
pending
}
)>0 THEN 'running'
WHEN (
#{
blocked
}
)>0 THEN 'blocked
'
WHEN (
#{
manual
}
)>0 THEN 'manual
'
ELSE 'failed'
ELSE 'failed'
END)"
END)"
end
end
...
@@ -63,7 +63,7 @@ module HasStatus
...
@@ -63,7 +63,7 @@ module HasStatus
state
:success
,
value:
'success'
state
:success
,
value:
'success'
state
:canceled
,
value:
'canceled'
state
:canceled
,
value:
'canceled'
state
:skipped
,
value:
'skipped'
state
:skipped
,
value:
'skipped'
state
:
blocked
,
value:
'blocked
'
state
:
manual
,
value:
'manual
'
end
end
scope
:created
,
->
{
where
(
status:
'created'
)
}
scope
:created
,
->
{
where
(
status:
'created'
)
}
...
@@ -74,13 +74,13 @@ module HasStatus
...
@@ -74,13 +74,13 @@ module HasStatus
scope
:failed
,
->
{
where
(
status:
'failed'
)
}
scope
:failed
,
->
{
where
(
status:
'failed'
)
}
scope
:canceled
,
->
{
where
(
status:
'canceled'
)
}
scope
:canceled
,
->
{
where
(
status:
'canceled'
)
}
scope
:skipped
,
->
{
where
(
status:
'skipped'
)
}
scope
:skipped
,
->
{
where
(
status:
'skipped'
)
}
scope
:
blocked
,
->
{
where
(
status:
'blocked
'
)
}
scope
:
manual
,
->
{
where
(
status:
'manual
'
)
}
scope
:running_or_pending
,
->
{
where
(
status:
[
:running
,
:pending
])
}
scope
:running_or_pending
,
->
{
where
(
status:
[
:running
,
:pending
])
}
scope
:finished
,
->
{
where
(
status:
[
:success
,
:failed
,
:canceled
])
}
scope
:finished
,
->
{
where
(
status:
[
:success
,
:failed
,
:canceled
])
}
scope
:failed_or_canceled
,
->
{
where
(
status:
[
:failed
,
:canceled
])
}
scope
:failed_or_canceled
,
->
{
where
(
status:
[
:failed
,
:canceled
])
}
scope
:cancelable
,
->
do
scope
:cancelable
,
->
do
where
(
status:
[
:running
,
:pending
,
:created
,
:
blocked
])
where
(
status:
[
:running
,
:pending
,
:created
,
:
manual
])
end
end
end
end
...
...
app/services/ci/process_pipeline_service.rb
View file @
ac5bd3b7
...
@@ -37,8 +37,8 @@ module Ci
...
@@ -37,8 +37,8 @@ module Ci
if
valid_statuses_for_when
(
build
.
when
).
include?
(
current_status
)
if
valid_statuses_for_when
(
build
.
when
).
include?
(
current_status
)
build
.
enqueue
build
.
enqueue
true
true
elsif
build
.
barrier?
elsif
build
.
action?
&&
build
.
barrier?
build
.
block
build
.
actionize
false
false
else
else
build
.
skip
build
.
skip
...
...
app/views/projects/ci/builds/_build.html.haml
View file @
ac5bd3b7
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
%span
.label.label-info
triggered
%span
.label.label-info
triggered
-
if
build
.
try
(
:allow_failure
)
-
if
build
.
try
(
:allow_failure
)
%span
.label.label-danger
allowed to fail
%span
.label.label-danger
allowed to fail
-
if
build
.
manual
?
-
if
build
.
action
?
%span
.label.label-info
manual
%span
.label.label-info
manual
-
if
pipeline_link
-
if
pipeline_link
...
...
lib/gitlab/ci/status/
blocked
.rb
→
lib/gitlab/ci/status/
manual
.rb
View file @
ac5bd3b7
module
Gitlab
module
Gitlab
module
Ci
module
Ci
module
Status
module
Status
class
Blocked
<
Status
::
Core
class
Manual
<
Status
::
Core
def
text
def
text
'
blocked
'
'
manual
'
end
end
def
label
def
label
'
blocked
action'
'
manual
action'
end
end
def
icon
def
icon
...
...
lib/gitlab/data_builder/pipeline.rb
View file @
ac5bd3b7
...
@@ -39,7 +39,7 @@ module Gitlab
...
@@ -39,7 +39,7 @@ module Gitlab
started_at:
build
.
started_at
,
started_at:
build
.
started_at
,
finished_at:
build
.
finished_at
,
finished_at:
build
.
finished_at
,
when:
build
.
when
,
when:
build
.
when
,
manual:
build
.
manual
?
,
manual:
build
.
action
?
,
user:
build
.
user
.
try
(
:hook_attrs
),
user:
build
.
user
.
try
(
:hook_attrs
),
runner:
build
.
runner
&&
runner_hook_attrs
(
build
.
runner
),
runner:
build
.
runner
&&
runner_hook_attrs
(
build
.
runner
),
artifacts_file:
{
artifacts_file:
{
...
...
spec/models/ci/build_spec.rb
View file @
ac5bd3b7
...
@@ -682,12 +682,12 @@ describe Ci::Build, :models do
...
@@ -682,12 +682,12 @@ describe Ci::Build, :models do
end
end
end
end
describe
'#
manual
?'
do
describe
'#
action
?'
do
before
do
before
do
build
.
update
(
when:
value
)
build
.
update
(
when:
value
)
end
end
subject
{
build
.
manual
?
}
subject
{
build
.
action
?
}
context
'when is set to manual'
do
context
'when is set to manual'
do
let
(
:value
)
{
'manual'
}
let
(
:value
)
{
'manual'
}
...
...
spec/services/ci/process_pipeline_service_spec.rb
View file @
ac5bd3b7
...
@@ -285,8 +285,8 @@ describe Ci::ProcessPipelineService, '#execute', :services do
...
@@ -285,8 +285,8 @@ describe Ci::ProcessPipelineService, '#execute', :services do
succeed_running_or_pending
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w[code:test staging:deploy]
expect
(
builds_names
).
to
eq
%w[code:test staging:deploy]
expect
(
builds_statuses
).
to
eq
%w[success
blocked
]
expect
(
builds_statuses
).
to
eq
%w[success
manual
]
expect
(
pipeline
.
reload
.
status
).
to
eq
'blocked'
expect
(
pipeline
.
reload
).
to
be_manual
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