Skip to content

Commit

Permalink
Use jq to check returned values of env vars
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Harding <kyle@balena.io>
  • Loading branch information
klutchell committed Feb 28, 2024
1 parent 0717d36 commit 1ad2dc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:/usr/local/bin:${PATH}"

RUN install_packages \
git \
jq \
libfdt1 \
libglib2.0-0 \
libjpeg62-turbo \
Expand Down
6 changes: 2 additions & 4 deletions resources/resincli.robot
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,9 @@ Check if "${option}" variable "${variable_name}" with value "${variable_value}"
[Documentation] Available values for argument ${option} are: ENV, CONFIG
@{list} = Create List ENV CONFIG
Should Contain ${list} ${option}
${result_env} = Run Keyword If '${option}' == 'ENV' Run Process balena envs --${type} ${id} | sed '/ID[[:space:]]*NAME[[:space:]]*VALUE/,$!d' shell=yes
${result} = Run Keyword If '${option}' == 'ENV' Run Process balena envs --${type} ${id} --json | jq 'any(.[]; .name \== "${variable_name}" and .value \== "${variable_value}")' | grep true shell=yes
... ELSE
... Run Process balena envs --config --${type} ${id} | sed '/ID[[:space:]]*NAME[[:space:]]*VALUE/,$!d' shell=yes
Process ${result_env}
${result} = Run Process echo "${result_env.stdout}" | grep ${variable_name} | grep " ${variable_value}" shell=yes
... Run Process balena envs --config --${type} ${id} --json | jq 'any(.[]; .name \== "${variable_name}" and .value \== "${variable_value}")' | grep true shell=yes
Process ${result}

Remove "${option}" variable "${variable_name}" from application "${application_name}"
Expand Down

0 comments on commit 1ad2dc7

Please sign in to comment.