Skip to content

Commit

Permalink
fix: use load to slurp YAML file (#219)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kelvintaywl authored Jul 20, 2023
1 parent 7b7c291 commit 87f3392
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/scripts/continue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 87f3392

Please sign in to comment.