Skip to content

Commit

Permalink
Adds script that replaces digests in a kustomization.yaml file
Browse files Browse the repository at this point in the history
  • Loading branch information
solsson committed Mar 23, 2024
1 parent 77cfad8 commit 01a7681
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bin/y-images-digest
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

0 comments on commit 01a7681

Please sign in to comment.