Skip to content

Commit 1e82e6d

Browse files
committed
add support for build lifecycle and rhel7
1 parent a767327 commit 1e82e6d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

policies/ubi-versions.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
{
44
"id": "53e1d1fb-bc1e-4ef3-98c3-8df0dd5679b8",
55
"name": "UBI version compliance",
6-
"description": "All images on the cluster using the Red Hat Universal Base Image (UBI) must use at least versions 8.5 or 9.3",
6+
"description": "All images on the cluster using the Red Hat Universal Base Image (UBI) must use at least versions 8.5 or 9.3",
77
"rationale": "Using an older UBI image potentially exposes the workload to additional vulnerabilities",
88
"remediation": "Update the base image to at least UBI 8.5 or 9.3",
99
"disabled": true,
1010
"categories": [
1111
"Package Management"
1212
],
1313
"lifecycleStages": [
14+
"BUILD",
1415
"DEPLOY"
1516
],
1617
"eventSource": "NOT_APPLICABLE",
@@ -66,7 +67,7 @@
6667
"value": "redhat-release=9\\.[0-2]-[0-9]+(?:\\.[0-9]+)?\\.el9"
6768
},
6869
{
69-
"value": "redhat-release=[6-7].*"
70+
"value": "redhat-release-server=7.*"
7071
}
7172
]
7273
}

util-scripts/ubi-versions/ubi-versions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ for deployment_id in $(echo "${res}" | jq -r .alerts[].deployment.id); do
6262
image_name="$(echo "${image_res}" | jq -rc '.name.fullName')"
6363
export image_name
6464

65-
# find the redhat-release version and format lines
66-
export ubi_version="$(echo "${image_res}" | jq '.scan.components[] | select(.name=="redhat-release") | .version'| grep -o '[0-9]\.[0-9]\+' | head -1 )"
65+
# find the redhat-release (UBI 8/9) or redhat-release-server (UBI 7) version and format lines
66+
export ubi_version="$(echo "${image_res}" | jq '.scan.components[] | select(.name=="redhat-release" or .name=="redhat-release-server") | .version'| grep -o '[0-9]\.[0-9]\+' | head -1 )"
6767
echo "${clusterName},${namespace},${deployment_name},${image_name},${ubi_version}" >> "${output_file}"
6868
fi
6969
done

0 commit comments

Comments
 (0)