Skip to content

Commit

Permalink
Improve Error Handling in CI Scripts
Browse files Browse the repository at this point in the history
In case blazectl exits with an error, it will be printed now.
  • Loading branch information
alexanderkiel committed Jul 1, 2024
1 parent 050b5ff commit 17c3feb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .github/scripts/evaluate-measure-blazectl-stratifier.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/bin/bash -e
#!/bin/bash

BASE="http://localhost:8080/fhir"
NAME="$1"
EXPECTED_COUNT="$2"

REPORT=$(blazectl --server "$BASE" evaluate-measure ".github/scripts/cql/$NAME.yml" 2> /dev/null)
REPORT=$(blazectl --server "$BASE" evaluate-measure ".github/scripts/cql/$NAME.yml")

if [ $? -ne 0 ]; then
echo "Measure evaluation failed: $REPORT"
exit 1
fi

COUNT=$(echo "$REPORT" | jq '.group[0].population[0].count')

if [ "$COUNT" = "$EXPECTED_COUNT" ]; then
Expand Down
11 changes: 9 additions & 2 deletions .github/scripts/evaluate-measure-blazectl.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/bin/bash -e
#!/bin/bash

BASE="http://localhost:8080/fhir"
NAME="$1"
EXPECTED_COUNT="$2"

COUNT=$(blazectl --server "$BASE" evaluate-measure ".github/scripts/cql/$NAME.yml" 2> /dev/null | jq '.group[0].population[0].count')
REPORT=$(blazectl --server "$BASE" evaluate-measure ".github/scripts/cql/$NAME.yml")

if [ $? -ne 0 ]; then
echo "Measure evaluation failed: $REPORT"
exit 1
fi

COUNT=$(echo "$REPORT" | jq '.group[0].population[0].count')

if [ "$COUNT" = "$EXPECTED_COUNT" ]; then
echo "OK 👍: count ($COUNT) equals the expected count"
Expand Down

0 comments on commit 17c3feb

Please sign in to comment.