-
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.
- Loading branch information
Showing
1 changed file
with
27 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,9 @@ permissions: | |
|
||
jobs: | ||
deploy-bicep: | ||
runs-on: ubuntu-latest | ||
name: Deploy Bicep | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
|
@@ -24,41 +25,32 @@ jobs: | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
enable-AzPSSession: true | ||
|
||
# Why on earth can't I just deploy the bicep file? | ||
- uses: azure/[email protected] | ||
name: Bicep Build | ||
with: | ||
bicepFilePath: infrastructure/Cluster.bicep | ||
outputFilePath: infrastructure/Cluster.json | ||
- name: Run Azure PowerShell script | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
$Results = New-AzResourceGroupDeployment -Name "aks-$(Get-Date -f yyyyMMddThhmmss)" -ResourceGroupName $Env:RESOURCEGROUP -TemplateFile infrastructure/Cluster.bicep -TemplateParameterObject @{ adminId = $Env:ADMINS } | ||
- id: name | ||
shell: pwsh | ||
run: '"name=aks-$(Get-Date -f yyyyMMddThhmmss)" >> $Env:GITHUB_OUTPUT' | ||
$Results | Out-Host | ||
- uses: azure/arm-deploy@v1 | ||
name: deploy | ||
timeout-minutes: 240 | ||
with: | ||
template: infrastructure/Cluster.json | ||
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} | ||
resourceGroupName: ${{ secrets.AZURE_RG }} | ||
parameters: adminId=${{ secrets.ADMIN_GROUP_ID }} | ||
deploymentName: ${{ steps.name.outputs.name }} | ||
#! Get the cluster credentials | ||
Get-AzAksCluster -ResourceGroupName $Env:RESOURCEGROUP | | ||
Import-AzAksCredential -Force | ||
#! Update the client ID from the deployment output | ||
$kustomize = Get-Content "clusters/poschode/flux/kustomization.ps1" | ||
$kustomize = $kustomize -replace "azure.workload.identity/client-id: .*$", "azure.workload.identity/client-id: $($Results.Outputs.fluxIdClientId)" | ||
# TODO: commit this file to the repo _before_ running flux | ||
$kustomize | Set-Content "clusters/poschode/flux/kustomization.ps1" | ||
#! Bootstrap Flux | ||
./infrastructure/Install-Flux.ps1 | ||
- id: deploy-flux | ||
shell: pwsh | ||
run: | | ||
#! Get the cluster credentials | ||
Get-AzAksCluster -ResourceGroupName $Env:RESOURCE_GROUP | | ||
Import-AzAksCredential -Force | ||
#! Update the client ID from the deployment output | ||
$kustomize = Get-Content "clusters/poschode/flux/kustomization.ps1" | ||
$kustomize = $kustomize -replace "azure.workload.identity/client-id: .*$", "azure.workload.identity/client-id: ${{ steps.deploy.outputs.fluxIdClientId }}" | ||
# TODO: commit this file to the repo _before_ running flux | ||
$kustomize | Set-Content "clusters/poschode/flux/kustomization.ps1" | ||
#! Bootstrap Flux | ||
./infrastructure/Install-Flux.ps1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RESOURCE_GROUP: ${{ secrets.AZURE_RG }} | ||
azPSVersion: "latest" | ||
env: | ||
SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION }} | ||
RESOURCEGROUP: ${{ secrets.AZURE_RG }} | ||
ADMINS: ${{ secrets.ADMIN_GROUP_ID }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|