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
25278ccd
Commit
25278ccd
authored
Jun 15, 2020
by
Philip Cunningham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indicate pipeline was ondemand and rename build
parent
1d375778
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
24 deletions
+34
-24
app/models/ci/pipeline_enums.rb
app/models/ci/pipeline_enums.rb
+2
-1
ee/app/services/ci/run_dast_scan_service.rb
ee/app/services/ci/run_dast_scan_service.rb
+2
-2
ee/spec/services/ci/run_dast_scan_service_spec.rb
ee/spec/services/ci/run_dast_scan_service_spec.rb
+30
-21
No files found.
app/models/ci/pipeline_enums.rb
View file @
25278ccd
...
...
@@ -30,7 +30,8 @@ module Ci
webide:
9
,
merge_request_event:
10
,
external_pull_request_event:
11
,
parent_pipeline:
12
parent_pipeline:
12
,
ondemand_scan:
13
}
end
...
...
ee/app/services/ci/run_dast_scan_service.rb
View file @
25278ccd
...
...
@@ -43,7 +43,7 @@ module Ci
project:
project
,
ref:
branch
,
sha:
project
.
repository
.
commit
&
.
id
||
DEFAULT_SHA_FOR_PROJECTS_WITHOUT_COMMITS
,
source: :
web
,
source: :
ondemand_scan
,
user:
user
)
end
...
...
@@ -62,7 +62,7 @@ module Ci
def
create_build!
(
pipeline
,
stage
,
branch
,
target_url
)
reraise!
(
with:
CreateBuildError
.
new
(
'Could not create build'
))
do
Ci
::
Build
.
create!
(
name:
'
On demand DAST s
can'
,
name:
'
DAST S
can'
,
pipeline:
pipeline
,
project:
project
,
ref:
branch
,
...
...
ee/spec/services/ci/run_dast_scan_service_spec.rb
View file @
25278ccd
...
...
@@ -34,6 +34,10 @@ describe Ci::RunDastScanService do
expect
(
subject
.
ref
).
to
eq
(
branch
)
end
it
'sets the source to indicate an ondemand scan'
do
expect
(
subject
.
source
).
to
eq
(
'ondemand_scan'
)
end
it
'creates a stage'
do
expect
{
subject
}.
to
change
(
Ci
::
Stage
,
:count
).
by
(
1
)
end
...
...
@@ -42,19 +46,24 @@ describe Ci::RunDastScanService do
expect
{
subject
}.
to
change
(
Ci
::
Build
,
:count
).
by
(
1
)
end
it
'sets the build name to indicate a DAST scan'
do
build
=
subject
.
builds
.
first
expect
(
build
.
name
).
to
eq
(
'DAST Scan'
)
end
it
'creates a build with appropriate options'
do
build
=
subject
.
builds
.
first
expected_options
=
{
"image"
=>
{
"name"
=>
"$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION"
'image'
=>
{
'name'
=>
'$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION'
},
"script"
=>
[
"export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)}"
,
"/analyze"
'script'
=>
[
'export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)}'
,
'/analyze'
],
"artifacts"
=>
{
"reports"
=>
{
"dast"
=>
[
"gl-dast-report.json"
]
'artifacts'
=>
{
'reports'
=>
{
'dast'
=>
[
'gl-dast-report.json'
]
}
}
}
...
...
@@ -65,21 +74,21 @@ describe Ci::RunDastScanService do
build
=
subject
.
builds
.
first
expected_variables
=
[
{
"key"
=>
"DAST_VERSION"
,
"value"
=>
"1"
,
"public"
=>
true
'key'
=>
'DAST_VERSION'
,
'value'
=>
'1'
,
'public'
=>
true
},
{
"key"
=>
"SECURE_ANALYZERS_PREFIX"
,
"value"
=>
"registry.gitlab.com/gitlab-org/security-products/analyzers"
,
"public"
=>
true
'key'
=>
'SECURE_ANALYZERS_PREFIX'
,
'value'
=>
'registry.gitlab.com/gitlab-org/security-products/analyzers'
,
'public'
=>
true
},
{
"key"
=>
"DAST_WEBSITE"
,
"value"
=>
target_url
,
"public"
=>
true
'key'
=>
'DAST_WEBSITE'
,
'value'
=>
target_url
,
'public'
=>
true
},
{
"key"
=>
"GIT_STRATEGY"
,
"value"
=>
"none"
,
"public"
=>
true
'key'
=>
'GIT_STRATEGY'
,
'value'
=>
'none'
,
'public'
=>
true
}
]
expect
(
build
.
yaml_variables
).
to
eq
(
expected_variables
)
...
...
@@ -92,7 +101,7 @@ describe Ci::RunDastScanService do
context
'when the repository has no commits'
do
it
'uses a placeholder'
do
expect
(
subject
.
sha
).
to
eq
(
"placeholder"
)
expect
(
subject
.
sha
).
to
eq
(
'placeholder'
)
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