-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
129 lines (119 loc) · 5.55 KB
/
action.yml
File metadata and controls
129 lines (119 loc) · 5.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: 'AzModules - Deploy resources to Azure'
description: 'Manage IaC Modules Life-cycle using Idempotent modules.'
branding:
icon: 'cloud-lightning'
color: 'blue'
inputs:
Action:
description: 'The action to perform. Whatif, Validate, Deploy, Remove. Default: Deploy'
required: false
default: Deploy
ResourceGroupName:
description: 'Target Resource Group to deploy resources to. Default: env.ResourceGroupName'
required: false
Subscription:
description: 'Subscription ID or name to deploy resources to. Default: env.Subscription'
required: false
ManagementGroupID:
description: 'Target Management Group to deploy resources to. Default: env.ManagementGroupID'
required: false
Location:
description: 'Azure location for where to deploy resources. Default: env.Location'
required: false
ModulesPath:
description: 'Path to a custom module library, structured as /$ModuleName/$ModuleVersion/deploy.*. Default: env.ModulesPath'
required: false
ModuleName:
description: 'Name and version of module. ResourceGroup. Default: env.ModuleName'
required: false
ModuleVersion:
description: 'Name and version of module. 1.0. Default: env.ModuleVersion'
required: false
ParameterFilePath:
description: 'Path to Parameter file. Will deploy based on single parameter file. Need to use either this or ParametersFolderPath. Default: env.ParameterFilePath'
required: false
ParameterFolderPath:
description: 'Path to Parameter folder. Will deploy based on multiple parameter files. Need to use either this or ParameterFilePath. Default: env.ParameterFolderPath'
required: false
ParameterOverrides:
description: 'Parameter overrides. Provided as expected by AzCLI. Default: env.ParameterOverrides'
required: false
Retries:
description: 'Number of retries in case of failed attempts. Default: env.Retries'
required: false
default: 5
RetryInterval:
description: 'Number of seconds between retries. Default: env.RetryInterval'
required: false
default: 10
outputs:
Output:
description: 'Output from the action, as a compressed json data structure.'
value: ${{ steps.AzModules.outputs.Output }}
runs:
using: 'composite'
steps:
- name: Download AzUtilities
shell: pwsh
run: |
Write-Output '::group::Download AzUtilities'
$env:PSModulePath -split $([System.IO.Path]::PathSeparator)
$InstallPath = $env:PSModulePath -split $([System.IO.Path]::PathSeparator) | Select-Object -First 1
if (! (Test-Path -Path $InstallPath)){
try {
Write-Output "$InstallPath not found, creating"
New-Item -Path $InstallPath -ItemType "directory" -Force | Out-Null
} catch {
throw "$InstallPath creating failed"
}
}
Write-Output "InstallPath: $InstallPath"
New-Item -Path "$InstallPath\Utils" -ItemType "directory" -Force | Out-Null
Invoke-WebRequest -OutFile "$InstallPath\Utils\Utils.psm1" -Uri "https://raw.githubusercontent.com/AzActions/AzUtilities/main/Modules/Utils/Utils.psm1"
Invoke-WebRequest -OutFile "$InstallPath\Utils\Utils.psd1" -Uri "https://raw.githubusercontent.com/AzActions/AzUtilities/main/Modules/Utils/Utils.psd1"
- id: AzModules
shell: pwsh
run: |
New-GitHubLogGroup -Title "AzModules-Initializing"
Write-Output '-------------------------------------------'
Write-Output 'Environment variables:'
$env = @{
Action = $env:Action
ResourceGroupName = $env:ResourceGroupName
Subscription = $env:Subscription
ManagementGroupID = $env:ManagementGroupID
Location = $env:Location
ModulesPath = $env:ModulesPath
ModuleName = $env:ModuleName
ModuleVersion = $env:ModuleVersion
ParameterFilePath = $env:ParameterFilePath
ParameterFolderPath = $env:ParameterFolderPath
Retries = $env:Retries
RetryInterval = $env:RetryInterval
ParameterOverrides = $env:ParameterOverrides
}
$env.GetEnumerator() | Sort-Object -Property Name
Write-Output '-------------------------------------------'
Write-Output 'Action inputs:'
$inputs = @{
Action = '${{ inputs.Action }}'
ResourceGroupName = '${{ inputs.ResourceGroupName }}'
Subscription = '${{ inputs.Subscription }}'
ManagementGroupID = '${{ inputs.ManagementGroupID }}'
Location = '${{ inputs.Location }}'
ModulesPath = '${{ inputs.ModulesPath }}'
ModuleName = '${{ inputs.ModuleName }}'
ModuleVersion = '${{ inputs.ModuleVersion }}'
ParameterFilePath = '${{ inputs.ParameterFilePath }}'
ParameterFolderPath = '${{ inputs.ParameterFolderPath }}'
Retries = '${{ inputs.Retries }}'
RetryInterval = '${{ inputs.RetryInterval }}'
ParameterOverrides = '${{ inputs.ParameterOverrides }}'
}
$inputs.GetEnumerator() | Sort-Object -Property Name
Write-Output '-------------------------------------------'
Write-Output 'Executing with:'
$Params = Merge-Hashtables -Main $env -Overrides $inputs
$Params.GetEnumerator() | Sort-Object -Property Name
. "$env:GITHUB_ACTION_PATH\Scripts\main.ps1" @Params
Write-Output '::endgroup::'