Skip to content

Commit 01a7681

Browse files
committed
Adds script that replaces digests in a kustomization.yaml file
1 parent 77cfad8 commit 01a7681

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

bin/y-images-digest

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
[ -z "$DEBUG" ] || set -x
3+
set -eo pipefail
4+
5+
[ -z "$BUMP_INCLUDE" ] && BUMP_INCLUDE='--include=*.yaml'
6+
7+
[ "$1" = "help" ] && echo "adsf
8+
Adds digests to kustomize images.
9+
Usage: update newTag with the desired tags, then run the script.
10+
BUMP_INCLUDE='$BUMP_INCLUDE'
11+
" && exit 0
12+
13+
SRC=$1
14+
[ -z "$SRC" ] && echo "First arg must be a path like . or ./my/kustomization.yaml" && exit 1
15+
16+
[ -f "$SRC" ] || (echo "non-file input $SRC is currently unsupported" && exit 1)
17+
FILE="$SRC"
18+
19+
for img in $(yq e '.images.[] | .name + "=" + (.newName // .name) + ":" + .newTag' $FILE); do
20+
name=$(echo "$img" | cut -d= -f1)
21+
ref=$(echo "$img" | cut -d= -f2 | cut -d@ -f1)
22+
tag=$(echo "$ref" | cut -d: -f2)
23+
echo "# $name -> $tag ..."
24+
y-image-bump "$name" "$tag" "$FILE"
25+
done

0 commit comments

Comments
 (0)