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
1
Merge Requests
1
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
nexedi
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
module
Ci
module
Status
module
Build
class
Action
<
SimpleDelegator
include
Status
::
Extended
class
Action
<
Status
::
Extended
def
label
if
has_action?
__getobj__
.
label
@status
.
label
else
"
#{
__getobj__
.
label
}
(not allowed)"
"
#{
@status
.
label
}
(not allowed)"
end
end
...
...
lib/gitlab/ci/status/build/cancelable.rb
View file @
55cec217
...
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Status
module
Build
class
Cancelable
<
SimpleDelegator
include
Status
::
Extended
class
Cancelable
<
Status
::
Extended
def
has_action?
can?
(
user
,
:update_build
,
subject
)
end
...
...
lib/gitlab/ci/status/build/failed_allowed.rb
View file @
55cec217
...
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Status
module
Build
class
FailedAllowed
<
SimpleDelegator
include
Status
::
Extended
class
FailedAllowed
<
Status
::
Extended
def
label
'failed (allowed to fail)'
end
...
...
lib/gitlab/ci/status/build/play.rb
View file @
55cec217
...
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Status
module
Build
class
Play
<
SimpleDelegator
include
Status
::
Extended
class
Play
<
Status
::
Extended
def
label
'manual play action'
end
...
...
lib/gitlab/ci/status/build/retryable.rb
View file @
55cec217
...
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Status
module
Build
class
Retryable
<
SimpleDelegator
include
Status
::
Extended
class
Retryable
<
Status
::
Extended
def
has_action?
can?
(
user
,
:update_build
,
subject
)
end
...
...
lib/gitlab/ci/status/build/stop.rb
View file @
55cec217
...
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Status
module
Build
class
Stop
<
SimpleDelegator
include
Status
::
Extended
class
Stop
<
Status
::
Extended
def
label
'manual stop action'
end
...
...
lib/gitlab/ci/status/extended.rb
View file @
55cec217
module
Gitlab
module
Ci
module
Status
module
Extended
extend
ActiveSupport
::
Concern
class
Extended
<
SimpleDelegator
def
initialize
(
status
)
super
(
@status
=
status
)
end
class_methods
do
def
matches?
(
_subject
,
_user
)
raise
NotImplementedError
end
def
self
.
matches?
(
_subject
,
_user
)
raise
NotImplementedError
end
end
end
...
...
lib/gitlab/ci/status/pipeline/blocked.rb
View file @
55cec217
...
...
@@ -2,9 +2,7 @@ module Gitlab
module
Ci
module
Status
module
Pipeline
class
Blocked
<
SimpleDelegator
include
Status
::
Extended
class
Blocked
<
Status
::
Extended
def
text
'blocked'
end
...
...
lib/gitlab/ci/status/success_warning.rb
View file @
55cec217
...
...
@@ -5,9 +5,7 @@ module Gitlab
# Extended status used when pipeline or stage passed conditionally.
# This means that failed jobs that are allowed to fail were present.
#
class
SuccessWarning
<
SimpleDelegator
include
Status
::
Extended
class
SuccessWarning
<
Status
::
Extended
def
text
'passed'
end
...
...
spec/lib/gitlab/ci/status/build/factory_spec.rb
View file @
55cec217
...
...
@@ -205,7 +205,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it
'matches correct extended statuses'
do
expect
(
factory
.
extended_statuses
)
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Play
,
Gitlab
::
Ci
::
Status
::
Build
::
Action
]
Gitlab
::
Ci
::
Status
::
Build
::
Action
]
end
it
'fabricates action detailed status'
do
...
...
spec/lib/gitlab/ci/status/extended_spec.rb
View file @
55cec217
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Extended
do
subject
do
Class
.
new
.
include
(
described_class
)
end
it
'requires subclass to implement matcher'
do
expect
{
subject
.
matches?
(
double
,
double
)
}
expect
{
described_class
.
matches?
(
double
,
double
)
}
.
to
raise_error
(
NotImplementedError
)
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