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
ea44183c
Commit
ea44183c
authored
Apr 05, 2021
by
Subashis Chakraborty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '247490-vuln-blocked-pipeline-in-security-dashboard' into 'master'"
This reverts merge request !56779
parent
38f62c59
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
66 deletions
+36
-66
app/models/concerns/ci/has_status.rb
app/models/concerns/ci/has_status.rb
+0
-8
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+1
-1
ee/changelogs/unreleased/247490-vuln-blocked-pipeline-in-security-dashboard.yml
...ed/247490-vuln-blocked-pipeline-in-security-dashboard.yml
+0
-6
ee/spec/models/ci/pipeline_spec.rb
ee/spec/models/ci/pipeline_spec.rb
+35
-45
spec/models/concerns/ci/has_status_spec.rb
spec/models/concerns/ci/has_status_spec.rb
+0
-6
No files found.
app/models/concerns/ci/has_status.rb
View file @
ea44183c
...
@@ -43,14 +43,6 @@ module Ci
...
@@ -43,14 +43,6 @@ module Ci
def
completed_statuses
def
completed_statuses
COMPLETED_STATUSES
.
map
(
&
:to_sym
)
COMPLETED_STATUSES
.
map
(
&
:to_sym
)
end
end
def
blocked_statuses
BLOCKED_STATUS
.
map
(
&
:to_sym
)
end
def
completed_and_blocked_statuses
completed_statuses
+
blocked_statuses
end
end
end
included
do
included
do
...
...
ee/app/models/ee/ci/pipeline.rb
View file @
ea44183c
...
@@ -54,7 +54,7 @@ module EE
...
@@ -54,7 +54,7 @@ module EE
}.
freeze
}.
freeze
state_machine
:status
do
state_machine
:status
do
after_transition
any
=>
::
Ci
::
Pipeline
.
completed_
and_blocked_
statuses
do
|
pipeline
|
after_transition
any
=>
::
Ci
::
Pipeline
.
completed_statuses
do
|
pipeline
|
next
unless
pipeline
.
can_store_security_reports?
next
unless
pipeline
.
can_store_security_reports?
pipeline
.
run_after_commit
do
pipeline
.
run_after_commit
do
...
...
ee/changelogs/unreleased/247490-vuln-blocked-pipeline-in-security-dashboard.yml
deleted
100644 → 0
View file @
38f62c59
---
title
:
Extend state transition that initiate creation of vulnerabilities in database
to blocked pipeline state
merge_request
:
56779
author
:
type
:
added
ee/spec/models/ci/pipeline_spec.rb
View file @
ea44183c
...
@@ -168,69 +168,63 @@ RSpec.describe Ci::Pipeline do
...
@@ -168,69 +168,63 @@ RSpec.describe Ci::Pipeline do
end
end
end
end
shared_examples_for
'storing the security reports'
do
|
transition
|
describe
'Store security reports worker'
do
let
(
:default_branch
)
{
pipeline
.
ref
}
shared_examples_for
'storing the security reports'
do
|
transition
|
let
(
:default_branch
)
{
pipeline
.
ref
}
subject
(
:transition_pipeline
)
{
pipeline
.
update!
(
status_event:
transition
)
}
subject
(
:transition_pipeline
)
{
pipeline
.
update!
(
status_event:
transition
)
}
before
do
before
do
allow
(
StoreSecurityReportsWorker
).
to
receive
(
:perform_async
)
allow
(
StoreSecurityReportsWorker
).
to
receive
(
:perform_async
)
allow
(
::
Security
::
StoreScansWorker
).
to
receive
(
:perform_async
)
allow
(
project
).
to
receive
(
:default_branch
).
and_return
(
default_branch
)
allow
(
SyncSecurityReportsToReportApprovalRulesWorker
).
to
receive
(
:perform_async
)
allow
(
pipeline
).
to
receive
(
:can_store_security_reports?
).
and_return
(
can_store_security_reports
)
allow
(
project
).
to
receive
(
:default_branch
).
and_return
(
default_branch
)
end
allow
(
pipeline
).
to
receive
(
:can_store_security_reports?
).
and_return
(
can_store_security_reports
)
end
context
'when the security reports can be stored for the pipeline'
do
context
'when the security reports can be stored for the pipeline'
do
let
(
:can_store_security_reports
)
{
true
}
let
(
:can_store_security_reports
)
{
true
}
context
'when the ref is the default branch of project'
do
context
'when the ref is the default branch of project'
do
it
'schedules relevant workers'
,
:aggregate_failures
do
it
'schedules store security report worker'
do
transition_pipeline
transition_pipeline
expect
(
StoreSecurityReportsWorker
).
to
have_received
(
:perform_async
).
with
(
pipeline
.
id
)
expect
(
StoreSecurityReportsWorker
).
to
have_received
(
:perform_async
).
with
(
pipeline
.
id
)
expect
(
::
Security
::
StoreScansWorker
).
to
have_received
(
:perform_async
).
with
(
pipeline
.
id
)
end
expect
(
SyncSecurityReportsToReportApprovalRulesWorker
).
to
have_received
(
:perform_async
).
with
(
pipeline
.
id
)
end
end
end
context
'when the ref is not the default branch of project'
do
context
'when the ref is not the default branch of project'
do
let
(
:default_branch
)
{
'another_branch'
}
let
(
:default_branch
)
{
'another_branch'
}
it
'does not schedule store security report worker'
do
it
'does not schedule store security report worker'
do
transition_pipeline
transition_pipeline
expect
(
StoreSecurityReportsWorker
).
not_to
have_received
(
:perform_async
)
expect
(
StoreSecurityReportsWorker
).
not_to
have_received
(
:perform_async
)
end
end
end
end
end
end
context
'when the security reports can not be stored for the pipeline'
do
context
'when the security reports can not be stored for the pipeline'
do
let
(
:can_store_security_reports
)
{
false
}
let
(
:can_store_security_reports
)
{
false
}
context
'when the ref is the default branch of project'
,
:aggregate_failures
do
context
'when the ref is the default branch of project'
do
it
'does not relevant workers
'
do
it
'does not schedule store security report worker
'
do
transition_pipeline
transition_pipeline
expect
(
StoreSecurityReportsWorker
).
not_to
have_received
(
:perform_async
)
expect
(
StoreSecurityReportsWorker
).
not_to
have_received
(
:perform_async
)
expect
(
::
Security
::
StoreScansWorker
).
not_to
have_received
(
:perform_async
)
end
expect
(
SyncSecurityReportsToReportApprovalRulesWorker
).
not_to
have_received
(
:perform_async
)
end
end
end
context
'when the ref is not the default branch of project'
do
context
'when the ref is not the default branch of project'
do
let
(
:default_branch
)
{
'another_branch'
}
let
(
:default_branch
)
{
'another_branch'
}
it
'does not schedule store security report worker'
do
it
'does not schedule store security report worker'
do
transition_pipeline
transition_pipeline
expect
(
StoreSecurityReportsWorker
).
not_to
have_received
(
:perform_async
)
expect
(
StoreSecurityReportsWorker
).
not_to
have_received
(
:perform_async
)
end
end
end
end
end
end
end
end
describe
'schedules security report related workers'
do
context
'when pipeline is succeeded'
do
context
'when pipeline is succeeded'
do
it_behaves_like
'storing the security reports'
,
:succeed
it_behaves_like
'storing the security reports'
,
:succeed
end
end
...
@@ -246,10 +240,6 @@ RSpec.describe Ci::Pipeline do
...
@@ -246,10 +240,6 @@ RSpec.describe Ci::Pipeline do
context
'when pipeline is canceled'
do
context
'when pipeline is canceled'
do
it_behaves_like
'storing the security reports'
,
:cancel
it_behaves_like
'storing the security reports'
,
:cancel
end
end
context
'when pipeline is blocked'
do
it_behaves_like
'storing the security reports'
,
:block
end
end
end
describe
'#license_scanning_reports'
do
describe
'#license_scanning_reports'
do
...
...
spec/models/concerns/ci/has_status_spec.rb
View file @
ea44183c
...
@@ -197,12 +197,6 @@ RSpec.describe Ci::HasStatus do
...
@@ -197,12 +197,6 @@ RSpec.describe Ci::HasStatus do
end
end
end
end
describe
'.completed_and_blocked_statuses'
do
subject
{
Ci
::
Pipeline
.
completed_and_blocked_statuses
}
it
{
is_expected
.
to
eq
[
:success
,
:failed
,
:canceled
,
:skipped
,
:manual
,
:scheduled
]
}
end
context
'for scope with one status'
do
context
'for scope with one status'
do
shared_examples
'having a job'
do
|
status
|
shared_examples
'having a job'
do
|
status
|
%i[ci_build generic_commit_status]
.
each
do
|
type
|
%i[ci_build generic_commit_status]
.
each
do
|
type
|
...
...
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