docs(example-templates): add a simple JUnit XML template (#1422)

Signed-off-by: Yevhenii Pokhvalii <yevhenii_pokhvalii@epam.com>
This commit is contained in:
Yevhenii Pokhvalii 2023-08-08 19:12:56 +03:00 committed by GitHub
parent 60e7b2bcdc
commit fe7027f9e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

14
templates/junit.tmpl Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" ?>
<testsuites name="grype-junit">
{{- $failures := len $.Matches }}
<testsuite tests="{{ $failures }}" failures="{{ $failures }}" name="{{ $.Distro.Name }}:{{ $.Distro.Version }}" errors="0" skipped="0">
<properties>
<property name="type" value="{{ $.Distro.Name }}"></property>
</properties>
{{- range .Matches }}
<testcase classname="{{ .Artifact.Name }}-{{ .Artifact.Version }} ({{ .Artifact.Type }})" name="[{{ .Vulnerability.Severity }}] {{ .Vulnerability.ID }}">
<failure message="{{ .Artifact.Name }}: {{ .Vulnerability.ID }}" type="description">{{ .Vulnerability.Description }} {{ .Artifact.CPEs }} {{ .Vulnerability.DataSource }}</failure>
</testcase>
{{- end }}
</testsuite>
</testsuites>