File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # The extracts all images from specific manifests sub-directories.
4
+ # Future release process enhancement may include an automatic image inventory scan.
5
+ # The reported image list can be used later for image vulnerability scanning and managing license risks management
6
+
7
+ # VERSION=1.7.0
8
+ output_file=" kf${VERSION} _images.txt"
9
+
10
+ rm -f .tmp
11
+ # Iterate over all files with names: 'kustomization.yaml', 'kustomization.yml', 'Kustomization' found recursively in the provided list of directories
12
+ for F in $( find ../apps ../common ../example ../contrib/metacontroller ../contrib/seldon \( -name kustomization.yaml -o -name kustomization.yml -o -name Kustomization \) ) ; do
13
+
14
+ dir=$( dirname -- " $F " )
15
+ # Generate k8s resources specified in 'dir' using the 'kustomize build' command.
16
+ # Log the 'dir' name where the 'kustomize build' command fails.
17
+ kbuild=$( kustomize build " $dir " )
18
+ return_code=$?
19
+ if [ $return_code -ne 0 ]; then
20
+ printf ' ERROR:\t Failed \"kustomize build\" command for directory: %s. See error above\n' " $dir "
21
+ continue
22
+ fi
23
+ # Grep the output of 'kustomize build' command for 'image:' and '- image' lines and return just the image itself
24
+ # Redirect the output to '.tmp' file
25
+ grep ' \-\?\s\image:' <<< " $kbuild" | sed -re ' s/\s-?\simage: *//;s/^[ \t]*//g' | sed ' /^$/d;/{/d' >> .tmp
26
+ done
27
+
28
+ sort .tmp | uniq > " $output_file "
29
+ rm -f .tmp
30
+
31
+ echo " File ${output_file} successfully created"
You can’t perform that action at this time.
0 commit comments