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
55cec217
Commit
55cec217
authored
May 05, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine inheritance model of extended CI/CD statuses
parent
2cc8f43e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
18 additions
and
38 deletions
+18
-38
lib/gitlab/ci/status/build/action.rb
lib/gitlab/ci/status/build/action.rb
+3
-5
lib/gitlab/ci/status/build/cancelable.rb
lib/gitlab/ci/status/build/cancelable.rb
+1
-3
lib/gitlab/ci/status/build/failed_allowed.rb
lib/gitlab/ci/status/build/failed_allowed.rb
+1
-3
lib/gitlab/ci/status/build/play.rb
lib/gitlab/ci/status/build/play.rb
+1
-3
lib/gitlab/ci/status/build/retryable.rb
lib/gitlab/ci/status/build/retryable.rb
+1
-3
lib/gitlab/ci/status/build/stop.rb
lib/gitlab/ci/status/build/stop.rb
+1
-3
lib/gitlab/ci/status/extended.rb
lib/gitlab/ci/status/extended.rb
+6
-6
lib/gitlab/ci/status/pipeline/blocked.rb
lib/gitlab/ci/status/pipeline/blocked.rb
+1
-3
lib/gitlab/ci/status/success_warning.rb
lib/gitlab/ci/status/success_warning.rb
+1
-3
spec/lib/gitlab/ci/status/build/factory_spec.rb
spec/lib/gitlab/ci/status/build/factory_spec.rb
+1
-1
spec/lib/gitlab/ci/status/extended_spec.rb
spec/lib/gitlab/ci/status/extended_spec.rb
+1
-5
No files found.
lib/gitlab/ci/status/build/action.rb
View file @
55cec217
...
@@ -2,14 +2,12 @@ module Gitlab
...
@@ -2,14 +2,12 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Build
module
Build
class
Action
<
SimpleDelegator
class
Action
<
Status
::
Extended
include
Status
::
Extended
def
label
def
label
if
has_action?
if
has_action?
__getobj__
.
label
@status
.
label
else
else
"
#{
__getobj__
.
label
}
(not allowed)"
"
#{
@status
.
label
}
(not allowed)"
end
end
end
end
...
...
lib/gitlab/ci/status/build/cancelable.rb
View file @
55cec217
...
@@ -2,9 +2,7 @@ module Gitlab
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Build
module
Build
class
Cancelable
<
SimpleDelegator
class
Cancelable
<
Status
::
Extended
include
Status
::
Extended
def
has_action?
def
has_action?
can?
(
user
,
:update_build
,
subject
)
can?
(
user
,
:update_build
,
subject
)
end
end
...
...
lib/gitlab/ci/status/build/failed_allowed.rb
View file @
55cec217
...
@@ -2,9 +2,7 @@ module Gitlab
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Build
module
Build
class
FailedAllowed
<
SimpleDelegator
class
FailedAllowed
<
Status
::
Extended
include
Status
::
Extended
def
label
def
label
'failed (allowed to fail)'
'failed (allowed to fail)'
end
end
...
...
lib/gitlab/ci/status/build/play.rb
View file @
55cec217
...
@@ -2,9 +2,7 @@ module Gitlab
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Build
module
Build
class
Play
<
SimpleDelegator
class
Play
<
Status
::
Extended
include
Status
::
Extended
def
label
def
label
'manual play action'
'manual play action'
end
end
...
...
lib/gitlab/ci/status/build/retryable.rb
View file @
55cec217
...
@@ -2,9 +2,7 @@ module Gitlab
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Build
module
Build
class
Retryable
<
SimpleDelegator
class
Retryable
<
Status
::
Extended
include
Status
::
Extended
def
has_action?
def
has_action?
can?
(
user
,
:update_build
,
subject
)
can?
(
user
,
:update_build
,
subject
)
end
end
...
...
lib/gitlab/ci/status/build/stop.rb
View file @
55cec217
...
@@ -2,9 +2,7 @@ module Gitlab
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Build
module
Build
class
Stop
<
SimpleDelegator
class
Stop
<
Status
::
Extended
include
Status
::
Extended
def
label
def
label
'manual stop action'
'manual stop action'
end
end
...
...
lib/gitlab/ci/status/extended.rb
View file @
55cec217
module
Gitlab
module
Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Extended
class
Extended
<
SimpleDelegator
extend
ActiveSupport
::
Concern
def
initialize
(
status
)
super
(
@status
=
status
)
end
class_methods
do
def
self
.
matches?
(
_subject
,
_user
)
def
matches?
(
_subject
,
_user
)
raise
NotImplementedError
raise
NotImplementedError
end
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/pipeline/blocked.rb
View file @
55cec217
...
@@ -2,9 +2,7 @@ module Gitlab
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Ci
module
Status
module
Status
module
Pipeline
module
Pipeline
class
Blocked
<
SimpleDelegator
class
Blocked
<
Status
::
Extended
include
Status
::
Extended
def
text
def
text
'blocked'
'blocked'
end
end
...
...
lib/gitlab/ci/status/success_warning.rb
View file @
55cec217
...
@@ -5,9 +5,7 @@ module Gitlab
...
@@ -5,9 +5,7 @@ module Gitlab
# Extended status used when pipeline or stage passed conditionally.
# Extended status used when pipeline or stage passed conditionally.
# This means that failed jobs that are allowed to fail were present.
# This means that failed jobs that are allowed to fail were present.
#
#
class
SuccessWarning
<
SimpleDelegator
class
SuccessWarning
<
Status
::
Extended
include
Status
::
Extended
def
text
def
text
'passed'
'passed'
end
end
...
...
spec/lib/gitlab/ci/status/build/factory_spec.rb
View file @
55cec217
...
@@ -205,7 +205,7 @@ describe Gitlab::Ci::Status::Build::Factory do
...
@@ -205,7 +205,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it
'matches correct extended statuses'
do
it
'matches correct extended statuses'
do
expect
(
factory
.
extended_statuses
)
expect
(
factory
.
extended_statuses
)
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Play
,
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Play
,
Gitlab
::
Ci
::
Status
::
Build
::
Action
]
Gitlab
::
Ci
::
Status
::
Build
::
Action
]
end
end
it
'fabricates action detailed status'
do
it
'fabricates action detailed status'
do
...
...
spec/lib/gitlab/ci/status/extended_spec.rb
View file @
55cec217
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Extended
do
describe
Gitlab
::
Ci
::
Status
::
Extended
do
subject
do
Class
.
new
.
include
(
described_class
)
end
it
'requires subclass to implement matcher'
do
it
'requires subclass to implement matcher'
do
expect
{
subject
.
matches?
(
double
,
double
)
}
expect
{
described_class
.
matches?
(
double
,
double
)
}
.
to
raise_error
(
NotImplementedError
)
.
to
raise_error
(
NotImplementedError
)
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