Closed nford closed 2 years ago
I ran into this exact issue today. Are you already working on a PR? If not I'll submit something.
@jeffreymlewis,
I've been working on this all day to figure it out but it seems like doing a eval echo
on the overrides
parameter is causing more issues, even without expanding an environment variable within the json. Here's the error I am getting when trying to run do so:
Error parsing parameter '--overrides': Invalid JSON: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
JSON received: {containerOverrides:[{name: sleep, memory: 512}]}
I'll be checking in with my team to see if there's any workarounds but if you can think of one, feel free to let me know.
Best, Brian
Escaping the double-quotes would work, but it's ugly and makes this a breaking change. 🙁
Sorry I can't be more help. Unfortunately I couldn't use this orb in my current project (for other reasons) and never fully implemented this solution.
Here's how I was testing variable expansion.
#!/bin/bash
json='{\"containerOverrides\":[{\"name\": \"${CONTAINER_NAME}\", \"environment\": [{\"name\": \"RUN_DB_MIGRATIONS\",\"value\": \"true\"}]}]}'
json_eval=$(eval echo \"$json\")
echo $json_eval
Orb version:
2.2.1
What happened:
The same ENV VAR is used elsewhere without issue. If I replace ${CONTAINER_NAME} with the relevant string it works without issue. The Orb does not seem to interpolate the value within this JSON.
Expected behavior:
name value should be populated
Additional Information: