-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds script that replaces digests in a kustomization.yaml file
- Loading branch information
Showing
1 changed file
with
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
[ -z "$DEBUG" ] || set -x | ||
set -eo pipefail | ||
|
||
[ -z "$BUMP_INCLUDE" ] && BUMP_INCLUDE='--include=*.yaml' | ||
|
||
[ "$1" = "help" ] && echo "adsf | ||
Adds digests to kustomize images. | ||
Usage: update newTag with the desired tags, then run the script. | ||
BUMP_INCLUDE='$BUMP_INCLUDE' | ||
" && exit 0 | ||
|
||
SRC=$1 | ||
[ -z "$SRC" ] && echo "First arg must be a path like . or ./my/kustomization.yaml" && exit 1 | ||
|
||
[ -f "$SRC" ] || (echo "non-file input $SRC is currently unsupported" && exit 1) | ||
FILE="$SRC" | ||
|
||
for img in $(yq e '.images.[] | .name + "=" + (.newName // .name) + ":" + .newTag' $FILE); do | ||
name=$(echo "$img" | cut -d= -f1) | ||
ref=$(echo "$img" | cut -d= -f2 | cut -d@ -f1) | ||
tag=$(echo "$ref" | cut -d: -f2) | ||
echo "# $name -> $tag ..." | ||
y-image-bump "$name" "$tag" "$FILE" | ||
done |