UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ironbank Tools
ironbank-plugins-pipeline
Commits
75191314
You need to sign in or sign up before continuing.
Commit
75191314
authored
Dec 03, 2020
by
David Freeman
Browse files
run linters
parent
e3d9fd1e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
40 additions
and
27 deletions
+40
-27
.editorconfig
.editorconfig
+4
-0
README.md
README.md
+0
-1
pylama.ini
pylama.ini
+6
-0
schema/plugins_manifest.schema.json
schema/plugins_manifest.schema.json
+8
-1
stages/build/plugin-build.sh
stages/build/plugin-build.sh
+1
-1
stages/publish/base.yaml
stages/publish/base.yaml
+1
-1
stages/report-generation/pipeline_csv_gen.py
stages/report-generation/pipeline_csv_gen.py
+13
-13
stages/scanning/anchore.py
stages/scanning/anchore.py
+4
-6
stages/scanning/anchore_scan.py
stages/scanning/anchore_scan.py
+2
-0
templates/globals.yaml
templates/globals.yaml
+1
-4
No files found.
.editorconfig
0 → 100644
View file @
75191314
[*.sh]
indent_style = space
indent_size = 2
switch_case_indent = true # like -ci
\ No newline at end of file
README.md
View file @
75191314
# ironbank-plugins-pipeline
pylama.ini
0 → 100644
View file @
75191314
[pylama:pycodestyle]
max_line_length
=
88
ignore
=
E203,E231,W503,E501
[pylama:pylint]
max_line_length
=
88
schema/plugins_manifest.schema.json
View file @
75191314
...
...
@@ -223,6 +223,13 @@
"uniqueItems"
:
true
}
},
"required"
:
[
"apiVersion"
,
"plugin-name"
,
"version"
,
"keywords"
,
"resources"
,
"maintainers"
],
"required"
:
[
"apiVersion"
,
"plugin-name"
,
"version"
,
"keywords"
,
"resources"
,
"maintainers"
],
"additionalProperties"
:
false
}
stages/build/plugin-build.sh
View file @
75191314
...
...
@@ -48,4 +48,4 @@ buildah push --storage-driver=vfs --authfile plugins_auth.json "${harbor_plugin_
echo
"IMAGE_ID=sha256:
$(
podman inspect
--storage-driver
=
vfs
"
${
harbor_plugin_path
}
"
--format
'{{.Id}}'
)
"
>>
"
${
ARTIFACT_DIR
}
/build.env"
echo
"IMAGE_FULLTAG=
${
harbor_plugin_path
}
"
>>
"
${
ARTIFACT_DIR
}
/build.env"
\ No newline at end of file
echo
"IMAGE_FULLTAG=
${
harbor_plugin_path
}
"
>>
"
${
ARTIFACT_DIR
}
/build.env"
stages/publish/base.yaml
View file @
75191314
...
...
@@ -3,4 +3,4 @@
tags
:
-
ironbank-plugins
include
:
-
local
:
/stages/publish/upload_to_s3.yaml
\ No newline at end of file
-
local
:
/stages/publish/upload_to_s3.yaml
stages/report-generation/pipeline_csv_gen.py
View file @
75191314
...
...
@@ -34,14 +34,14 @@ def main():
)
parser
.
add_argument
(
"--binary-content"
,
help
=
"binary.json file path"
)
parser
.
add_argument
(
"--files-content"
,
help
=
"files.json file path"
)
parser
.
add_argument
(
"--gem-content"
,
help
=
"gem.json file path"
"
)
parser.add_argument("
--
go
-
content
", help="
go
.
json
file
path
"
"
)
parser
.
add_argument
(
"--java-content"
,
help
=
"java.json file path"
"
)
parser.add_argument("
--
malware
-
content
", help="
malware
.
json
file
path
"
"
)
parser
.
add_argument
(
"--npm-content"
,
help
=
"npm.json file path"
"
)
parser.add_argument("
--
nuget
-
content
", help="
nuget
.
json
file
path
"
"
)
parser
.
add_argument
(
"--os-content"
,
help
=
"os.json file path"
"
)
parser.add_argument("
--
python
-
content
", help="
python
.
json
file
path
"
"
)
parser
.
add_argument
(
"--gem-content"
,
help
=
"gem.json file path"
)
parser
.
add_argument
(
"--go-content"
,
help
=
"go.json file path"
)
parser
.
add_argument
(
"--java-content"
,
help
=
"java.json file path"
)
parser
.
add_argument
(
"--malware-content"
,
help
=
"malware.json file path"
)
parser
.
add_argument
(
"--npm-content"
,
help
=
"npm.json file path"
)
parser
.
add_argument
(
"--nuget-content"
,
help
=
"nuget.json file path"
)
parser
.
add_argument
(
"--os-content"
,
help
=
"os.json file path"
)
parser
.
add_argument
(
"--python-content"
,
help
=
"python.json file path"
)
parser
.
add_argument
(
"-o"
,
"--output-dir"
,
...
...
@@ -170,12 +170,9 @@ def get_anchore_full(anchore_file):
cves
.
append
(
ret
)
return
cves
def
create_content_csvs
():
content_filenames
=
[
args
.
binary
,
args
.
files
,
args
.
gem
]
content_filenames
=
[
args
.
binary
,
args
.
files
,
args
.
gem
]
for
report
in
content_filenames
:
report_content
=
read_content_csv
(
report
)
...
...
@@ -183,12 +180,14 @@ def create_content_csvs():
return
def
read_content_csv
(
filepath
):
file
=
pathlib
.
Path
(
filepath
)
with
file
.
open
(
mode
=
"r"
)
as
f
:
data
=
json
.
load
(
f
)
return
data
def
write_content_csv
(
report_data
):
fields
=
list
(
report_data
[
"content"
][
0
].
keys
())
output_file_name
=
pathlib
.
Path
(
f
"
{
report_data
[
'content_type'
]
}
.csv"
)
...
...
@@ -197,6 +196,7 @@ def write_content_csv(report_data):
writer
.
writeheader
()
writer
.
writerows
(
report_data
[
"content"
])
class
AnchoreGate
:
image_id
=
""
repo_tag
=
""
...
...
stages/scanning/anchore.py
View file @
75191314
...
...
@@ -75,7 +75,6 @@ class Anchore:
return
None
def
get_version
(
self
,
artifacts_path
):
"""
Fetch the Anchore version and write it to an artifact.
...
...
@@ -130,7 +129,7 @@ class Anchore:
filename
=
pathlib
.
Path
(
artifacts_path
,
"anchore_security.json"
)
logging
.
debug
(
f
"Writing to
{
filename
}
"
)
with
filename
.
open
(
mode
=
"w"
)
as
f
:
json
.
dump
(
vuln_dict
,
f
)
json
.
dump
(
vuln_dict
,
f
)
def
image_contents
(
self
,
digest
,
artifacts_path
):
logging
.
info
(
f
"Retrieving image contents"
)
...
...
@@ -147,7 +146,7 @@ class Anchore:
"content"
,
digest
,
]
try
:
logging
.
debug
(
" "
.
join
(
contents_cmd
))
image_contents
=
subprocess
.
run
(
...
...
@@ -161,7 +160,7 @@ class Anchore:
sys
.
exit
(
1
)
logging
.
debug
(
image_contents
.
stdout
)
content_types
=
json
.
loads
(
image_contents
.
stdout
)
content_types
=
json
.
loads
(
image_contents
.
stdout
)
for
item
in
content_types
:
contents_cmd
=
[
"anchore-cli"
,
...
...
@@ -190,9 +189,8 @@ class Anchore:
logging
.
exception
(
"Could not retrieve contents"
)
sys
.
exit
(
1
)
returned_contents
=
json
.
loads
(
image_contents
.
stdout
)
filename
=
pathlib
.
Path
(
artifacts_path
,
f
"
{
item
}
.json"
)
with
filename
.
open
(
mode
=
"w"
)
as
f
:
json
.
dump
(
returned_contents
,
f
)
...
...
stages/scanning/anchore_scan.py
View file @
75191314
...
...
@@ -7,6 +7,7 @@ import pathlib
from
anchore
import
Anchore
def
main
():
# Get logging level, set manually when running pipeline
loglevel
=
os
.
environ
.
get
(
"LOGLEVEL"
,
"INFO"
).
upper
()
...
...
@@ -39,5 +40,6 @@ def main():
anchore_scan
.
image_contents
(
digest
=
digest
,
artifacts_path
=
artifacts_path
)
anchore_scan
.
get_version
(
artifacts_path
=
artifacts_path
)
if
__name__
==
"__main__"
:
sys
.
exit
(
main
())
templates/globals.yaml
View file @
75191314
...
...
@@ -7,7 +7,7 @@ stages:
-
preprocess
### preflight stage
# check for README and plugins_manifest.yaml
# check for README and plugins_manifest.yaml
# Requirements:
# - None
-
preflight
...
...
@@ -46,6 +46,3 @@ variables:
GIT_SSL_NO_VERIFY
:
"
1"
TARGET_BRANCH
:
master
BUILD_FROM_SOURCE
:
"
"
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