Skip to content

Commit

Permalink
Extract JSON from Bicep output by removing warnings from GitHub runne…
Browse files Browse the repository at this point in the history
…rs while using clean output to detect errors
  • Loading branch information
tjementum committed Jan 9, 2025
1 parent 69ca4e0 commit 6c6913a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cloud-infrastructure/cluster/deploy-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ then
RED='\033[0;31m'
RESET='\033[0m' # Reset formatting

cleaned_output=$(echo "$output" | sed '/^WARNING/d')
cleaned_output=$(echo "$output" | sed '/^WARNING/d' | sed '/^\/home\/runner\/work\//d')
# Check for the specific error message indicating that DNS Records are missing
if [[ $cleaned_output == *"InvalidCustomHostNameValidation"* ]] || [[ $cleaned_output == *"FailedCnameValidation"* ]] || [[ $cleaned_output == *"-certificate' under resource group '$RESOURCE_GROUP_NAME' was not found"* ]]; then
# Get details about the container apps environment. Although the creation of the container app fails, the verification ID on the container apps environment is consistent across all container apps.
Expand All @@ -78,7 +78,7 @@ then
echo -e "${RED}- A TXT record with the name 'asuid.$DOMAIN_NAME' and the value '$custom_domain_verification_id'.${RESET}"
echo -e "${RED}- A CNAME record with the Host name '$DOMAIN_NAME' that points to address 'app-gateway.$default_domain'.${RESET}"
exit 1
elif [[ $cleaned_output == *"ERROR:"* ]]; then
elif [[ $output == *"ERROR:"* ]]; then
echo -e "${RED}$output${RESET}"
exit 1
fi
Expand All @@ -90,7 +90,7 @@ then
DEPLOYMENT_PARAMETERS="-l $CLUSTER_LOCATION -n $CURRENT_DATE-$RESOURCE_GROUP_NAME --output json -f ./main-cluster.bicep -p resourceGroupName=$RESOURCE_GROUP_NAME environmentResourceGroupName=$ENVIRONMENT_RESOURCE_GROUP_NAME environment=$ENVIRONMENT containerRegistryName=$CONTAINER_REGISTRY_NAME domainName=$DOMAIN_NAME isDomainConfigured=$IS_DOMAIN_CONFIGURED sqlAdminObjectId=$SQL_ADMIN_OBJECT_ID appGatewayVersion=$APP_GATEWAY_VERSION accountManagementVersion=$ACTIVE_ACCOUNT_MANAGEMENT_VERSION backOfficeVersion=$ACTIVE_BACK_OFFICE_VERSION applicationInsightsConnectionString=$APPLICATIONINSIGHTS_CONNECTION_STRING"
. ../deploy.sh

cleaned_output=$(echo "$output" | sed '/^WARNING/d')
cleaned_output=$(echo "$output" | sed '/^WARNING/d' | sed '/^\/home\/runner\/work\//d')
if [[ $cleaned_output == "ERROR:"* ]]; then
echo -e "${RED}$output"
exit 1
Expand Down
3 changes: 1 addition & 2 deletions cloud-infrastructure/environment/deploy-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ DEPLOYMENT_PARAMETERS="-l $LOCATION_SHARED -n $CURRENT_DATE-$UNIQUE_PREFIX-$ENVI
cd "$(dirname "${BASH_SOURCE[0]}")"
. ../deploy.sh

cleaned_output=$(echo "$output" | sed '/^WARNING/d')
if [[ $cleaned_output == *"ERROR:"* ]]; then
if [[ $output == *"ERROR:"* ]]; then
echo -e "${RED}$output"
exit 1
fi

0 comments on commit 6c6913a

Please sign in to comment.