Skip to content

Commit

Permalink
Patch helm chart versions with image tags
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson committed Jul 12, 2024
1 parent 3ab620e commit 1e0d3e7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion scripts/patch-image-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@ patch_values() {
diff <(echo "$orig") <(echo "$changed") | patch $1
}

patch_chart() {
orig=$(yq eval --exit-status '.' $1)
changed=$(yq eval --exit-status ".version = \"$TAG\"" $1)

diff_changed=$()

diff <(echo "$orig") <(echo "$changed") | patch $1
}

export -f patch_values
export -f patch_chart

find deploy/kubernetes/charts/ -name "values.yaml" -not -path "*/opentelemetry/*" -exec bash -c 'patch_values ${0}' '{}' \;
find deploy/kubernetes/charts/ -name "Chart.yaml" -not -path "*/opentelemetry/*" -exec bash -c 'patch_chart ${0}' '{}' \;
# Clean up dirty patch files
find deploy/kubernetes/charts '(' -name \*-baseline -o -name \*-merge -o -name \*-original -o -name \*.orig -o -name \*.rej ')' -delete -type f

Expand All @@ -32,4 +43,5 @@ yq -i ".services.orders.image = \"public.ecr.aws/aws-containers/retail-store-sam
yq -i ".services.assets.image = \"public.ecr.aws/aws-containers/retail-store-sample-assets:$TAG\"" dist/docker-compose/docker-compose.yml

# Template Terraform image default
cat deploy/terraform/lib/images/generated.tf.json | jq -Mr ". | .locals.published_tag = \"$TAG\"" | tee deploy/terraform/lib/images/generated.tf.json
cat deploy/terraform/lib/images/generated.tf.json | jq -Mr ". | .locals.published_tag = \"$TAG\"" | tee deploy/terraform/lib/images/generated.tf.json

0 comments on commit 1e0d3e7

Please sign in to comment.