Skip to content

Commit 84eac94

Browse files
committed
fix: this should work in pipeline
1 parent 0cd7278 commit 84eac94

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

generate-yaml-rp-env.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,7 @@ process_file() {
3232
env_value="${!var_name}"
3333

3434
if [[ -n "$env_value" ]]; then
35-
# Special handling for CIS_CREDENTIAL or similar JSON structures
36-
if [[ "$var_name" == "CIS_CREDENTIAL" ]] || [[ "$var_name" == "CIS_CENTRAL_BINDING" ]]; then
37-
# First escape any literal newlines and other control characters for proper JSON parsing
38-
escaped_json=$(printf '%s' "$env_value" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\r/\\r/g' | sed 's/\t/\\t/g')
39-
40-
# Validate the escaped JSON
41-
if ! echo "$escaped_json" | jq empty 2>/dev/null; then
42-
echo "Error: $var_name contains invalid JSON"
43-
exit 1
44-
fi
45-
46-
# Process with jq and then clean up the escaped newlines
47-
clean_value=$(echo "$escaped_json" | jq -c . | sed 's/\\n//g')
48-
line="${line//INJECT_ENV.${var_name}/${clean_value}}"
49-
else
50-
# For non-JSON variables, use direct substitution
5135
line="${line//INJECT_ENV.${var_name}/${env_value}}"
52-
fi
5336
else
5437
echo "Warning: Environment variable $var_name is not set or empty. Leaving placeholder unchanged."
5538
fi

0 commit comments

Comments
 (0)