diff --git a/contrib/gitlab.tpl b/contrib/gitlab.tpl index 44638879bc11..7ff8abd8bfec 100644 --- a/contrib/gitlab.tpl +++ b/contrib/gitlab.tpl @@ -24,15 +24,18 @@ "status": "success", "type": "container_scanning" }, + {{- $image := "Unknown" -}} + {{- $os := "Unknown" -}} + {{- range . }} + {{- if eq .Class "os-pkgs" -}} + {{- $target := .Target }} + {{- $image = $target | regexFind "[^\\s]+" }} + {{- $os = $target | splitList "(" | last | trimSuffix ")" }} + {{- end }} + {{- end }} "vulnerabilities": [ {{- $t_first := true }} {{- range . }} - {{- $target := .Target }} - {{- $image := $target | regexFind "[^\\s]+" }} - {{- $os := $target | splitList "(" | last | trimSuffix ")" }} - {{- if eq $os $target -}} - {{- $os = "Unknown" -}} - {{- end }} {{- range .Vulnerabilities -}} {{- if $t_first -}} {{- $t_first = false -}}