-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v1 * azdeploy * action.yml * azlogin * azdeploy * another one * let's try this * let's see * tpyos * -ErrorAction SilentlyContinue * location * typo * resourceGroupLocation * gci * indent * params * recurse * Get-Location * az * other path * go * workspace * testing delete * and * error handling * remove * test no azlogin * go * typo * typo * v1 * go * go * deploymentname * delete * delete * go * output * create Co-authored-by: Sebastian Gräf <[email protected]>
- Loading branch information
Showing
8 changed files
with
90 additions
and
99 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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
FROM mcr.microsoft.com/azure-cli:latest | ||
FROM mcr.microsoft.com/powershell:latest | ||
|
||
COPY entry.sh / | ||
RUN pwsh -c "Install-Module Az -Scope AllUsers -Acceptlicense -Force" | ||
|
||
RUN chmod +x /entry.sh | ||
COPY entry.ps1 /entry.ps1 | ||
|
||
ENTRYPOINT ["/entry.sh"] | ||
ENTRYPOINT ["pwsh", "-File", "/entry.ps1"] |
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,59 @@ | ||
Param( | ||
[string]$resourceGroupName, | ||
[string]$resourceGroupLocation, | ||
[string]$resourceGroupCommand, | ||
[string]$templateFile, | ||
[string]$parametersFile | ||
) | ||
|
||
$resourceGroupName | ||
$resourceGroupLocation | ||
$resourceGroupCommand | ||
$templateFile | ||
$parametersFile | ||
|
||
$context = Get-AzContext | ||
if (!$context) { | ||
Write-Output "No Azure context found! Please make sure azlogin has run before." | ||
exit | ||
} | ||
|
||
if (-not $resourceGroupName) { | ||
Write-Output "resourceGroupName is not set." | ||
exit | ||
} | ||
|
||
if ($resourceGroupCommand -and ($resourceGroupCommand -like "create")) { | ||
Write-Output "Executing commands to Create/Update resource group." | ||
if (-not (Get-AzResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue)) { | ||
if ($resourceGroupLocation) { | ||
New-AzResourceGroup -Name $resourceGroupName -Location "$resourceGroupLocation" | ||
|
||
if ($templateFile -and $parametersFile) { | ||
$DeploymentInputs = @{ | ||
Name = "$($env:GITHUB_WORKFLOW)-$($env:GITHUB_ACTOR)-$(Get-Date -Format yyyyMMddHHMMss)" | ||
ResourceGroupName = "$resourceGroupName" | ||
TemplateFile = "$templateFile" | ||
TemplateParameterFile = "$parametersFile" | ||
Mode = "Incremental" | ||
Verbose = $true | ||
ErrorAction = "Stop" | ||
} | ||
|
||
New-AzResourceGroupDeployment @DeploymentInputs | ||
} | ||
else { | ||
Write-Output "Template or parameters file does not exist." | ||
} | ||
} | ||
else { | ||
Write-Output "resourceGroupLocation is not set." | ||
exit | ||
} | ||
} | ||
} elseif ($resourceGroupCommand -like "delete") { | ||
Write-Output "resourceGroupCommand is set to 'delete'. Removing $resourceGroupName now. " | ||
Remove-AzResourceGroup -Name $resourceGroupName -Force | ||
} else { | ||
Write-Output "Something went wrong." | ||
} |