Skip to content

Commit dbd8897

Browse files
committed
PATCH: preparing to deploy
1 parent f1c090a commit dbd8897

2 files changed

Lines changed: 72 additions & 41 deletions

File tree

.gitlab-ci.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -83,48 +83,48 @@ SCA Test: # run SCA on any branch
8383
- dev
8484
- master
8585

86-
SAST Sandbox Test: # this only runs on the dev branch, so run a Sandbox scan
87-
stage: test
88-
89-
tags:
90-
- python
91-
92-
script:
93-
- zip project.zip
94-
setup.* LICENSE.txt -r $(echo ${CI_PROJECT_NAME} | cut -d'-' -f1)
95-
- pip3 install veracode-python
96-
97-
- veracode-cli scan
98-
--app="${CI_PROJECT_NAME}"
99-
--name="$(date) - ${CI_COMMIT_SHORT_SHA}"
100-
--sandbox='Development Build'
101-
--files='project.zip'
102-
--timeout=30
103-
104-
only:
105-
- dev
86+
# SAST Sandbox Test: # this only runs on the dev branch, so run a Sandbox scan
87+
# stage: test
88+
#
89+
# tags:
90+
# - python
91+
#
92+
# script:
93+
# - zip project.zip
94+
# setup.* LICENSE.txt -r $(echo ${CI_PROJECT_NAME} | cut -d'-' -f1)
95+
# - pip3 install veracode-python
96+
#
97+
# - veracode-cli scan
98+
# --app="${CI_PROJECT_NAME}"
99+
# --name="$(date) - ${CI_COMMIT_SHORT_SHA}"
100+
# --sandbox='Development Build'
101+
# --files='project.zip'
102+
# --timeout=30
103+
#
104+
# only:
105+
# - dev
106106

107107
############################## Master Only ####################################
108108

109-
SAST Policy Test: # this is on master so run a SAST policy scan
110-
stage: test
111-
112-
tags:
113-
- python
114-
115-
script:
116-
- zip project.zip
117-
setup.* LICENSE.txt -r $(echo ${CI_PROJECT_NAME} | cut -d'-' -f1)
118-
- pip3 install veracode-python
119-
120-
- veracode-cli scan
121-
--app="${CI_PROJECT_NAME}"
122-
--name="$(date) - ${CI_COMMIT_SHORT_SHA}"
123-
--files='project.zip'
124-
--timeout=30
125-
126-
only:
127-
- master
109+
# SAST Policy Test: # this is on master so run a SAST policy scan
110+
# stage: test
111+
#
112+
# tags:
113+
# - python
114+
#
115+
# script:
116+
# - zip project.zip
117+
# setup.* LICENSE.txt -r $(echo ${CI_PROJECT_NAME} | cut -d'-' -f1)
118+
# - pip3 install veracode-python
119+
#
120+
# - veracode-cli scan
121+
# --app="${CI_PROJECT_NAME}"
122+
# --name="$(date) - ${CI_COMMIT_SHORT_SHA}"
123+
# --files='project.zip'
124+
# --timeout=30
125+
#
126+
# only:
127+
# - master
128128

129129
Create Release: # increment version and create release tag
130130
stage: package

veracode/utils/app/commands.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import click
22
import sys
3+
import time
34
from veracode.application import Application
45
from veracode.sandbox import Sandbox
6+
from veracode.build import Build
57
from veracode.utils.report import display
68

79
@click.group()
@@ -70,6 +72,35 @@ def update(name, rename=None, criticality=None):
7072

7173

7274
@app.command()
73-
def scan():
74-
click.echo('scan')
75+
@click.option('--app', '-a', required=True,
76+
help='Name of the application.')
77+
@click.option('--files', '-f', required=True,
78+
help='Files to upload.')
79+
@click.option('--name', '-n',
80+
help='Name of the new scan.')
81+
@click.option('--sandbox', '-s',
82+
help='Name of the sandbox.')
83+
@click.option('--timeout', '-t', type=int,
84+
help='Timeout in minutes for scan results.')
85+
def scan(app, files, name=None, sandbox=None, timeout=None):
86+
app = Application(app)
87+
app.sandbox = sandbox
88+
build = Build()
89+
build.name = name
90+
app.build = build
91+
app.build.upload([files])
92+
app.build.scan()
93+
94+
if timeout:
95+
for w in range(timeout):
96+
time.sleep(60)
97+
if app.build.analysis.status == 'Results Ready':
98+
click.echo('Veracode Security Policy: {}'.format(
99+
app.build.report.policy_rules_status))
100+
return 'Pass' in app.build.report.policy_rules_status
101+
app = Application(app.name, sandbox=sandbox, build=name)
102+
click.echo('Scan status: {}'.format(app.build.analysis.status))
103+
click.echo('Scan timeout after {} minutes'.format(timeout))
104+
return False
105+
75106

0 commit comments

Comments
 (0)