-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre-commit to generate ARM template (#520)
* Add pre-commit to generate json * Updating readme per suggestion in #516 * Some extra lines * Test updating child template
- Loading branch information
1 parent
59f63dd
commit a85beac
Showing
5 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
az bicep version 2>/dev/null || az bicep install | ||
|
||
TEMPLATES=() | ||
FILES=() | ||
|
||
for ARG in $@; do | ||
# If the argument is supplied with "-f", then it is a template file that needs to be built | ||
if [[ $ARG == -f=* ]]; then | ||
TEMPLATES+=(${ARG#-f=}) | ||
else | ||
# Otherwise, it is a file that has been edited | ||
az bicep format --insert-final-newline -f $ARG & | ||
FILES+=($ARG) | ||
fi | ||
done | ||
|
||
wait | ||
|
||
git add ${FILES[@]} | ||
|
||
# Build the templates | ||
for TEMPLATE in ${TEMPLATES[@]}; do | ||
az bicep build -f $TEMPLATE | ||
git add "${TEMPLATE%.bicep}.json" # Change the extension from .bicep to .json | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters