Add Lint ARM Templates step #30
Workflow file for this run
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
name: ARM Templates | |
on: | |
pull_request: | |
paths: | |
- "deploy/azure/*.json" | |
push: | |
branches: | |
- main | |
paths: | |
- "deploy/azure/*.json" | |
jobs: | |
lint-arm-ttk: | |
name: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
template: [ "ARM-for-organization-account.json", "ARM-for-single-account.json" ] | |
steps: | |
- uses: actions/checkout@v4 | |
# Based on https://github.com/microsoft/action-armttk/blob/main/action.yml#L56 | |
# | |
# Not used the official MS ARM TTK Action because we don't follow the standard file naming convertion | |
# The ARM TTK Action didn't give us such flexibility | |
- name: Run ARM-TTK ${{ matrix.template }} | |
working-directory: ./deploy/azure | |
shell: pwsh | |
run: | | |
# Install Dependencies | |
Install-Module -Name Pester -RequiredVersion 4.10.1 -Force | |
Import-Module -Name Pester -RequiredVersion 4.10.1 -Force | |
Invoke-WebRequest -Uri 'aka.ms/arm-ttk-latest' -OutFile arm-template-toolkit.zip | |
Expand-Archive -LiteralPath arm-template-toolkit.zip -DestinationPath arm-ttk | |
# Load and run test | |
Import-Module ./arm-ttk/arm-ttk/arm-ttk.psd1 | |
echo "Test-AzTemplate -TemplatePath ${{ matrix.template }} -Pester -Skip Secure-Params-In-Nested-Deployments" | Out-File -FilePath ./armttk.ps1 | |
Invoke-Pester -Script ./armttk.ps1 -EnableExit -OutputFormat NUnitXml -OutputFile ./armttk.xml |