From 87f33926e3a3bb02f1b46be9b83a5c45b4ebe2ca Mon Sep 17 00:00:00 2001 From: Kelvin Tay Date: Thu, 20 Jul 2023 11:18:26 +0900 Subject: [PATCH] fix: use load to slurp YAML file (#219) This change leverages the load function from yq. It allows us to load the full content from a YAML file. This way, we do not need to cat the YAML file content in a prior step. In addition, I believe this can avoid the 'Argument list too long' yq error. --- src/scripts/continue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scripts/continue.sh b/src/scripts/continue.sh index 9728bc6..aadaf17 100644 --- a/src/scripts/continue.sh +++ b/src/scripts/continue.sh @@ -46,9 +46,10 @@ checkRequirements() { # Inject orb source into the configuration injectOrb() { printf "Injecting orb source into configuration.\n" - ORB_SOURCE="$(cat "${ORB_DIR}/${ORB_FILE}")" + ORB_SOURCE="${ORB_DIR}/${ORB_FILE}" export ORB_SOURCE - MODIFIED_CONFIG="$(yq '.orbs.[env(ORB_VAL_ORB_NAME)] = env(ORB_SOURCE)' "${ORB_VAL_CONTINUE_CONFIG_PATH}")" + # NOTE: load function from yq is only available from v4.x + MODIFIED_CONFIG="$(yq '.orbs.[env(ORB_VAL_ORB_NAME)] = load(env(ORB_SOURCE))' "${ORB_VAL_CONTINUE_CONFIG_PATH}")" printf "Modified config:\n\n" printf "%s" "${MODIFIED_CONFIG}" printf "%s" "${MODIFIED_CONFIG}" >"/tmp/circleci/modified/${ORB_FILE}"