tricks/scripts/generate-scan-report

27 lines
590 B
Text
Raw Permalink Normal View History

#!/usr/bin/env python
import sys
from args import argument_parse
from oras import Oras
from trivy import Trivy
def main():
args = argument_parse()
trivy = Trivy(args.image, args.tag)
scan = trivy.full_scan(image_src="remote")
if not scan:
sys.exit(1)
print("Full scan successful...")
print("Attaching CycloneDX report to container...")
oras = Oras(args.image, args.tag)
cdx = oras.post_attached_file(git_tag=args.git_tag)
oras.clean_downloaded_file()
if not cdx:
sys.exit(1)
sys.exit(0)
if __name__ == '__main__':
main()