File tree Expand file tree Collapse file tree 4 files changed +69
-0
lines changed
Expand file tree Collapse file tree 4 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM mcr.microsoft.com/powershell:latest
2+
3+ # Install Git
4+ RUN apt-get update && \
5+ apt-get install -y git
6+
7+ # Clone ARM-TTK Repo
8+ RUN git clone https://github.com/Azure/arm-ttk.git
9+
10+ # Copy the Entrypoint file from the current directory (the one the Dockerfile is located in)
11+ COPY entrypoint.ps1 /entrypoint.ps1
12+
13+ # Start using the Entrypoint file.
14+ ENTRYPOINT [ "pwsh" , "/entrypoint.ps1" ]
Original file line number Diff line number Diff line change 1+ # Azure Resource Manager Template Toolkit action
2+
3+ This action "[ use Azure Resource Manager Template Toolkit (arm-ttk)] ( https://github.com/Azure/arm-ttk ) " for analyzing and testing Azure Resource Manager Templates.
4+
5+ It's my first GitHub Action and it's based on https://github.com/whaakman/armttk-github-action-demo
6+
7+ ## Inputs
8+
9+ None
10+
11+ ## Outputs
12+
13+ ### ` TestFailures `
14+
15+ Test Failures
16+
17+ ## Example usage
18+
19+ ``` yaml
20+ uses : rfernandezdo/arm-ttk@master
21+ ` ` `
Original file line number Diff line number Diff line change 1+ # action.yml
2+ name : ' Run ARM TTK'
3+ description : ' Run ARM TTK in your project'
4+ outputs :
5+ TestFailures : # id of output
6+ description : ' Test Failures'
7+ runs :
8+ using : ' docker'
9+ image : ' Dockerfile'
Original file line number Diff line number Diff line change 1+ # Import the arm-ttk module we cloned in the dockerfile
2+ Import-Module ' /arm-ttk/arm-ttk/arm-ttk.psd1'
3+
4+ # Path we cloned the repository into
5+ $TemplatePath = ${env: GITHUB_WORKSPACE}
6+
7+ $TestResults = Test-AzTemplate - TemplatePath $TemplatePath
8+ # We only want to return failures
9+ $TestFailures = $TestResults | Where-Object { -not $_.Passed }
10+
11+ # If files are returning invalid configurations
12+ # Using exit code "1" to let Github actions node the test failed
13+ if ($TestFailures ) {
14+ Write-Host " One or more templates did not pass the selected tests:"
15+ $TestFailures.file.name | select-object - unique
16+ Write-Host " Results:"
17+ Write-Output $TestFailures
18+ exit 1
19+ }
20+
21+ # Else, all passes and exit using exit code 0 indicating a success
22+ else {
23+ Write-Host " All files passed!"
24+ exit 0
25+ }
You can’t perform that action at this time.
0 commit comments