From: garciadeblas Date: Fri, 18 Jul 2025 16:12:40 +0000 (+0200) Subject: Fix render of patch section as multi-line yaml string in full_json_patch krm function X-Git-Tag: v18.0.0~35 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F15290%2F1;p=osm%2Fdevops.git Fix render of patch section as multi-line yaml string in full_json_patch krm function Change-Id: I9c2f9f9bb38b39201af6a8481bfda4ecddc30bf1 Signed-off-by: garciadeblas --- diff --git a/docker/osm-krm-functions/scripts/library/helper-functions.rc b/docker/osm-krm-functions/scripts/library/helper-functions.rc index d012b804..f5e4a551 100644 --- a/docker/osm-krm-functions/scripts/library/helper-functions.rc +++ b/docker/osm-krm-functions/scripts/library/helper-functions.rc @@ -423,11 +423,11 @@ function full_json_patch() { done # Wrap a full patch around, adding target specification - export PATCH_CONTENT local PATCH_FULL=$( yq --null-input ".target.kind = \"${TARGET_KIND}\", .target.name = \"${TARGET_NAME}\"" | \ - yq ".patch = env(PATCH_CONTENT)" | \ - yq "[ . ]" + yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' - \ + <(printf "patch: |-\n%s\n" "$(echo "${PATCH_CONTENT}" | sed 's/^/ /')" ) | \ + yq "[.]" ) echo "${PATCH_FULL}"