#!/usr/bin/env bash set -uo pipefail cd "$(dirname "$0")" export PATH="$PWD/../bin:$PATH" rm -rf recorded; mkdir recorded bicep --version > recorded/00-version.txt bicep build ok/main.bicep --stdout > recorded/01-compiled.json 2> recorded/01-build-messages.txt; echo "exit code: $?" >> recorded/01-build-messages.txt jq -r '.resources[] | select(.name|test("logs")) | "condition: " + .condition' recorded/01-compiled.json > recorded/02-condition.txt grep -n -E '"(sku|minTls)":|"tags":|"value": "\[if' recorded/01-compiled.json | cut -c1-200 > recorded/03-expressions.txt mv broken/bicepconfig.json broken/bicepconfig.json.off bicep lint broken/main.bicep > recorded/04-lint-warnings.txt 2>&1; echo "exit code: $?" >> recorded/04-lint-warnings.txt sed -i "s#.*/broken/#broken/#" recorded/04-lint-warnings.txt mv broken/bicepconfig.json.off broken/bicepconfig.json bicep lint broken/main.bicep > recorded/05-lint-with-config.txt 2>&1; echo "exit code: $?" >> recorded/05-lint-with-config.txt sed -i "s#.*/broken/#broken/#" recorded/05-lint-with-config.txt