-
Notifications
You must be signed in to change notification settings - Fork 550
/
azure-pipelines.yml
147 lines (136 loc) · 5.68 KB
/
azure-pipelines.yml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
trigger:
branches:
include:
- arcbox_3.0
paths:
include:
- azure_jumpstart_arcbox/*
parameters:
- name: ResourceGroupName
displayName: 'Resource Group Name'
type: string
default: 'arcbox-itpro-integration-tests'
- name: AzureSubscription
displayName: 'Azure Subscription'
type: string
default: 'Azure Arc Jumpstart Develop(98a19988-5c3d-4824-a685-f5cf12ae5c19)'
- name: githubAccount
displayName: 'githubAccount'
type: string
default: 'microsoft'
- name: githubBranch
displayName: 'githubBranch'
type: string
default: 'arcbox_3.0'
- name: flavor
displayName: 'flavor'
type: string
default: 'ITPro'
variables:
- group: 'integration-tests'
- name: ResourceGroupName
value: ${{parameters.ResourceGroupName}}
- name: githubAccount
value: ${{parameters.githubAccount}}
- name: githubBranch
value: ${{parameters.githubBranch}}
- name: flavor
value: ${{parameters.flavor}}
stages:
- stage: 'ArcBox_deployment'
jobs:
- job: Deploy
timeoutInMinutes: 235 # 5 minutes before the ACA self-hosted runner in order for the runner to gracefully shutdown
pool:
name: arc-jumpstart-container-apps-pool
#vmImage: 'ubuntu-latest'
continueOnError: 'true'
steps:
- task: BicepInstall@0
displayName: 'Install Bicep'
inputs:
version: 0.24.24
- task: AzurePowerShell@5
displayName: 'Deploy resource group'
inputs:
azureSubscription: ${{parameters.AzureSubscription}}
ScriptType: 'InlineScript'
azurePowerShellVersion: 'LatestVersion'
Inline: |
Write-Host "Running deployment from machine $(hostname) and public IP $(irm ifconfig.me/ip)"
$RGname = "$(ResourceGroupName)"
New-AzResourceGroup -Name $RGname -Location "eastus"
- task: AzurePowerShell@5
displayName: 'Deploy Bicep template'
inputs:
azureSubscription: ${{parameters.AzureSubscription}}
ScriptType: 'InlineScript'
azurePowerShellVersion: 'LatestVersion'
Inline: |
Write-Host "Deploying to $(ResourceGroupName)"
$githubAccount = "$(githubAccount)"
$githubBranch = "$(githubBranch)"
$flavor = "$(flavor)"
if ($githubAccount -ne "microsoft") {
Write-Host "Checking out $githubAccount/$githubBranch"
git remote add upstream https://github.com/$($githubAccount)/azure_arc.git
git fetch upstream
git checkout -b $githubBranch upstream/$githubBranch
}
New-AzResourceGroupDeployment -Name ArcBox `
-ResourceGroupName $(ResourceGroupName) `
-TemplateFile azure_jumpstart_arcbox/bicep/main.bicep `
-TemplateParameterObject @{ `
spnClientId = "$(spnClientId)" ; `
spnClientSecret = "$(spnClientSecret)" ; `
spnTenantId = "$(spnTenantId)" ; `
windowsAdminUsername = "arcdemo" ; `
windowsAdminPassword = "$(windowsAdminPassword)" ; `
sshRSAPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCsdlSaF10Uw0fFysiIV0VYeJGE1CaV0ZjZcakcKgafiqZ04sAzf7KnoIjPVyx6LXoDTKGtv1e5eFjRZA7Z0Bu+a3JqY252/yr/B2R3Mu5qZHbKFncpVEXn7sUmYk4rDG5vToFxbhpKX5EGyvM1M0quoUv3Uv9reBsSDdjk7n7oA2Q+89rj4nfRuTEMQRwvNBaLeNRSlWuzPq4EkpwxSWRzIC2auC5K0rxGiTMPTXMOQ3l0DvzKRoEsygHA4c3uw0PTntSlgSSTgtGdQfuX63hAD4QPTVfeQdsW5+Nq3clr+6SHgeGdwHhKjUVTF+E2olfSYtuV4CqPW8dZdDBOZg7pXLMSVumZVKCZiUV6uBJkvLBRMzMiFsfXOVrgyThMqq+8y4tg/V3l/3S8z5Lngy4WoCAQMHQ1SloPmy9s4QnbjCFEQx/cIq9H+Uw6HAYhdQFh/w/tuIP+KIqOpMOrltZuaoqx3AOOL3BPXJMbv3opiZxCEZQFf68n+Zn6uRc9u1EENA9s1DrjG1j/CHWzbX/t63Ig/xQLgKLu9T+evua3dcWsYc3j1Gvk8R+ioXV7x0/fi6twrhSQxBIIL0D2Pxm8TBfJ3mVXk0kYGGq1mBsoxAzjoBhcbdwUMXHbAksj4/UuuAK5VfH278hlXo/BHSgDLZ98fdS63nq7rIr6qWmBrQ==" ; `
logAnalyticsWorkspaceName = "arcbox-la" ; `
flavor = $flavor ; `
deployBastion = $false ; `
githubAccount = $githubAccount ; `
githubBranch = $githubBranch ; `
vmAutologon = $true ; `
rdpPort = "3389" `
}
- task: AzurePowerShell@5
displayName: 'Upload Pester test-results from ArcBox VM'
inputs:
azureSubscription: ${{parameters.AzureSubscription}}
ScriptType: FilePath
azurePowerShellVersion: 'LatestVersion'
ScriptPath: 'azure_jumpstart_arcbox/artifacts/integration_tests/scripts/Wait-ArcBoxDeployment.ps1'
ScriptArguments: -ResourceGroupName $(ResourceGroupName) -githubAccount $(githubAccount) -githubBranch $(githubBranch)
- task: AzurePowerShell@5
displayName: 'Download Pester test-results from storage account to pipeline agent'
inputs:
azureSubscription: ${{parameters.AzureSubscription}}
ScriptType: FilePath
azurePowerShellVersion: 'LatestVersion'
ScriptPath: 'azure_jumpstart_arcbox/artifacts/integration_tests/scripts/Get-PesterResult.ps1'
ScriptArguments: -ResourceGroupName $(ResourceGroupName)
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: NUnit
testResultsFiles: '$(System.DefaultWorkingDirectory)/testresults/*.xml'
- stage: destroy
displayName: 'ArcBox_teardown'
#condition: succeeded('deploy')
jobs:
- deployment:
displayName: "Get approval"
environment: 'teardown_approval'
- job: Delete
steps:
- task: AzurePowerShell@5
displayName: 'Delete resource group'
inputs:
azureSubscription: ${{parameters.AzureSubscription}}
ScriptType: 'InlineScript'
azurePowerShellVersion: 'LatestVersion'
Inline: |
Write-Host "Deleting resource group $(ResourceGroupName)"
Remove-AzResourceGroup -Name $(ResourceGroupName) -Force -WhatIf