Skip to content

Commit

Permalink
Exit immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
Rindrics committed Jun 15, 2024
1 parent e5a6120 commit 31dfb67
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/validate-param.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e # Exit immediately if a command exits with a non-zero status.

# Extract inputs
PARAMS=$PARAMS
WORKFLOW_FILE=$WORKFLOW_FILE
Expand Down Expand Up @@ -35,6 +37,11 @@ echo "${PARAMS}" | jq -c 'to_entries | .[]' | while read -r step; do

ACTUAL_VALUE=$(echo "${STEP_CONTENT}" | yq e ".${PARAM}" -)

if [ "${ACTUAL_VALUE}" == "null" ]; then
echo "The parameter ${PARAM} for step ${STEP_ID} is not set."
exit 1
fi

if [ "${ACTUAL_VALUE}" != "${EXPECTED_VALUE}" ]; then
echo "The parameter ${PARAM} for step ${STEP_ID} is not set to ${EXPECTED_VALUE}. Current value: ${ACTUAL_VALUE}"
exit 1
Expand Down

0 comments on commit 31dfb67

Please sign in to comment.