-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added warn-podman-images-bestpractices (#34)
- Loading branch information
1 parent
e06b1b9
commit 4210aa7
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"kind": "PodmanImages", | ||
"image": "quay.io/openshift/origin-jenkins-agent-base:4.4", | ||
"items": [ | ||
{ | ||
"id": "cd343f0d83042932fa992e095cd4a93a89a3520873f99b0e15fde69eb46e7e10", | ||
"names": [ | ||
"quay.io/openshift/origin-jenkins-agent-base:4.4" | ||
], | ||
"digest": "sha256:1d59d3b1902a3581b6a9b1955fbd1d44490d9f470abbd60591948942a4ef7437", | ||
"created": "2020-06-13T00:10:44.644429651Z", | ||
"size": 725714890 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package main | ||
|
||
warn[msg] { | ||
#NOTE: upperBound is an arbitrary number and it should be changed to what your company believes is the correct policy | ||
|
||
input.kind == "PodmanImages" | ||
|
||
kb := 1024 | ||
mb := kb * 1024 | ||
upperBound := 512 | ||
|
||
image := input.items[_] | ||
sizeInMb := image.size / mb | ||
sizeInMb > upperBound | ||
|
||
msg := sprintf("%s: has a size of '%fMi', which is greater than '%dMi' limit.", [input.image, sizeInMb, upperBound]) | ||
} |