diff --git a/scripts/arty.sh b/scripts/arty.sh index 579e2342..9eb203c2 100755 --- a/scripts/arty.sh +++ b/scripts/arty.sh @@ -281,39 +281,20 @@ parse_reference() { local config_file="$1" local ref_index="$2" - # Check if reference is a string or object - local ref_type=$(yq eval ".references[$ref_index] | type" "$config_file" 2>/dev/null) - - if [[ "$ref_type" == "!!str" ]]; then - # Simple string format: just the URL - local url=$(yq eval ".references[$ref_index]" "$config_file" 2>/dev/null) - echo "$url||||" - else - # Object format with url, into, ref, env fields - local url=$(yq eval ".references[$ref_index].url" "$config_file" 2>/dev/null) - local into=$(yq eval ".references[$ref_index].into" "$config_file" 2>/dev/null) - local ref=$(yq eval ".references[$ref_index].ref" "$config_file" 2>/dev/null) - - # Check if env is an array or string - local env_type=$(yq eval ".references[$ref_index].env | type" "$config_file" 2>/dev/null) - local env="" - - if [[ "$env_type" == "!!seq" ]]; then - # Array format - convert to comma-separated string - env=$(yq eval ".references[$ref_index].env | join(\",\")" "$config_file" 2>/dev/null) + # Single yq call for all fields — multiple calls per reference were flooding + # the process table on hosts with low ulimit -u (e.g. IONOS shared hosting), + # causing intermittent empty 'into' values and wrong install locations. + yq eval " + .references[$ref_index] as \$r | + if (\$r | type) == \"!!str\" then + \$r + \"|||\" else - # Single value or null - env=$(yq eval ".references[$ref_index].env" "$config_file" 2>/dev/null) - fi - - # Replace "null" with empty string - [[ "$url" == "null" ]] && url="" - [[ "$into" == "null" ]] && into="" - [[ "$ref" == "null" ]] && ref="" - [[ "$env" == "null" ]] && env="" - - echo "$url|$into|$ref|$env" - fi + ((\$r.url // \"\") | if . == \"null\" then \"\" else . end) + \"|\" + + ((\$r.into // \"\") | if . == \"null\" then \"\" else . end) + \"|\" + + ((\$r.ref // \"\") | if . == \"null\" then \"\" else . end) + \"|\" + + (\$r.env | if . == null then \"\" elif type == \"!!seq\" then join(\",\") else (. | if . == \"null\" then \"\" else . end) end) + end + " "$config_file" 2>/dev/null } # Check if current environment matches the filter @@ -463,11 +444,11 @@ install_lib() { # Try to update if [[ -n "$git_ref" ]]; then - (cd "$lib_dir" && git fetch -q && git checkout -q "$git_ref" && git pull -q) || { + (cd "$lib_dir" && git fetch -q 2>/dev/null && git checkout -q "$git_ref" && git pull -q 2>/dev/null) || { log_warn "Failed to update library (continuing with existing version)" } else - (cd "$lib_dir" && git fetch -q && git pull -q) || { + (cd "$lib_dir" && git fetch -q 2>/dev/null && git pull -q 2>/dev/null) || { log_warn "Failed to update library (continuing with existing version)" } fi