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
Léo-Paul Géneau
gitlab-ce
Commits
26820d1f
Commit
26820d1f
authored
Jun 13, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not show manual actions that cannot be run
parent
652eb011
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
5 deletions
+25
-5
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
changelogs/unreleased/disable-blocked-manual-actions.yml
changelogs/unreleased/disable-blocked-manual-actions.yml
+4
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+16
-0
spec/models/deployment_spec.rb
spec/models/deployment_spec.rb
+2
-2
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+1
-1
No files found.
app/models/ci/build.rb
View file @
26820d1f
...
@@ -33,7 +33,7 @@ module Ci
...
@@ -33,7 +33,7 @@ module Ci
scope
:with_artifacts_not_expired
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at IS NULL OR artifacts_expire_at > ?'
,
Time
.
now
)
}
scope
:with_artifacts_not_expired
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at IS NULL OR artifacts_expire_at > ?'
,
Time
.
now
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:manual_actions
,
->
()
{
where
(
when: :manual
).
relevant
}
scope
:manual_actions
,
->
()
{
where
(
when: :manual
,
status:
COMPLETED_STATUSES
+
[
:manual
])
}
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
...
@@ -109,7 +109,7 @@ module Ci
...
@@ -109,7 +109,7 @@ module Ci
end
end
def
playable?
def
playable?
action?
&&
manual?
action?
&&
(
manual?
||
complete?
)
end
end
def
action?
def
action?
...
...
changelogs/unreleased/disable-blocked-manual-actions.yml
0 → 100644
View file @
26820d1f
---
title
:
disable blocked manual actions
merge_request
:
author
:
spec/models/ci/build_spec.rb
View file @
26820d1f
...
@@ -21,6 +21,18 @@ describe Ci::Build, :models do
...
@@ -21,6 +21,18 @@ describe Ci::Build, :models do
it
{
is_expected
.
to
respond_to
(
:has_trace?
)
}
it
{
is_expected
.
to
respond_to
(
:has_trace?
)
}
it
{
is_expected
.
to
respond_to
(
:trace
)
}
it
{
is_expected
.
to
respond_to
(
:trace
)
}
describe
'.manual_actions'
do
let!
(
:manual_but_created
)
{
create
(
:ci_build
,
:manual
,
status: :created
,
pipeline:
pipeline
)
}
let!
(
:manual_but_succeeded
)
{
create
(
:ci_build
,
:manual
,
status: :success
,
pipeline:
pipeline
)
}
let!
(
:manual_action
)
{
create
(
:ci_build
,
:manual
,
pipeline:
pipeline
)
}
subject
{
described_class
.
manual_actions
}
it
{
is_expected
.
to
include
(
manual_action
)
}
it
{
is_expected
.
to
include
(
manual_but_succeeded
)
}
it
{
is_expected
.
not_to
include
(
manual_but_created
)
}
end
describe
'#actionize'
do
describe
'#actionize'
do
context
'when build is a created'
do
context
'when build is a created'
do
before
do
before
do
...
@@ -926,6 +938,10 @@ describe Ci::Build, :models do
...
@@ -926,6 +938,10 @@ describe Ci::Build, :models do
context
'when other build is retried'
do
context
'when other build is retried'
do
let!
(
:retried_build
)
{
Ci
::
Build
.
retry
(
other_build
,
user
)
}
let!
(
:retried_build
)
{
Ci
::
Build
.
retry
(
other_build
,
user
)
}
before
do
retried_build
.
success
end
it
'returns a retried build'
do
it
'returns a retried build'
do
is_expected
.
to
contain_exactly
(
retried_build
)
is_expected
.
to
contain_exactly
(
retried_build
)
end
end
...
...
spec/models/deployment_spec.rb
View file @
26820d1f
...
@@ -102,7 +102,7 @@ describe Deployment, models: true do
...
@@ -102,7 +102,7 @@ describe Deployment, models: true do
end
end
context
'with other actions'
do
context
'with other actions'
do
let!
(
:close_action
)
{
create
(
:ci_build
,
pipeline:
build
.
pipeline
,
name:
'close_app'
,
when: :manual
)
}
let!
(
:close_action
)
{
create
(
:ci_build
,
:manual
,
pipeline:
build
.
pipeline
,
name:
'close_app'
)
}
context
'when matching action is defined'
do
context
'when matching action is defined'
do
let
(
:deployment
)
{
FactoryGirl
.
build
(
:deployment
,
deployable:
build
,
on_stop:
'close_other_app'
)
}
let
(
:deployment
)
{
FactoryGirl
.
build
(
:deployment
,
deployable:
build
,
on_stop:
'close_other_app'
)
}
...
@@ -130,7 +130,7 @@ describe Deployment, models: true do
...
@@ -130,7 +130,7 @@ describe Deployment, models: true do
context
'when matching action is defined'
do
context
'when matching action is defined'
do
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:deployment
)
{
FactoryGirl
.
build
(
:deployment
,
deployable:
build
,
on_stop:
'close_app'
)
}
let
(
:deployment
)
{
FactoryGirl
.
build
(
:deployment
,
deployable:
build
,
on_stop:
'close_app'
)
}
let!
(
:close_action
)
{
create
(
:ci_build
,
pipeline:
build
.
pipeline
,
name:
'close_app'
,
when: :manual
)
}
let!
(
:close_action
)
{
create
(
:ci_build
,
:manual
,
pipeline:
build
.
pipeline
,
name:
'close_app'
)
}
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
end
end
...
...
spec/models/environment_spec.rb
View file @
26820d1f
...
@@ -170,7 +170,7 @@ describe Environment, models: true do
...
@@ -170,7 +170,7 @@ describe Environment, models: true do
context
'when matching action is defined'
do
context
'when matching action is defined'
do
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
deployable:
build
,
on_stop:
'close_app'
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
deployable:
build
,
on_stop:
'close_app'
)
}
let!
(
:close_action
)
{
create
(
:ci_build
,
pipeline:
build
.
pipeline
,
name:
'close_app'
,
when: :manual
)
}
let!
(
:close_action
)
{
create
(
:ci_build
,
:manual
,
pipeline:
build
.
pipeline
,
name:
'close_app'
)
}
context
'when environment is available'
do
context
'when environment is available'
do
before
do
before
do
...
...
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