Skip to content

Commit 0748ac6

Browse files
committed
Fix helm chart field check to ensure tag or repository exists before updating
1 parent d66364c commit 0748ac6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/lib/gitops-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ update_file() {
4141
else
4242
local field_type
4343
field_type=$(yq "(.${field} | type)" "${file}" 2>/dev/null || echo "!!null")
44-
if [[ "${field_type}" == "!!map" ]]; then
44+
if [[ "${field_type}" == "!!map" ]] && yq -e ".${field} | (has(\"tag\") or has(\"repository\"))" "${file}" > /dev/null 2>&1; then
4545
yq -i ".${field}.tag=\"${INPUT_TAG}\"" "${file}"
4646
else
4747
yq -i ."${field}"=\""${image}"\" "${file}"

0 commit comments

Comments
 (0)