-
Notifications
You must be signed in to change notification settings - Fork 60
/
build-azure.ps1
executable file
·61 lines (47 loc) · 1.57 KB
/
build-azure.ps1
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
#!/usr/local/bin/pwsh
param(
[switch]$offline,
[switch]$SkipPester,
[switch]$ServerOnly,
[switch]$TentacleOnly,
[string]$OctopusVersion,
[switch]$retainondestroy,
[switch]$debug
)
. Tests/powershell-helpers.ps1
Start-Transcript .\vagrant-azure.log
Test-EnvVar AZURE_VM_PASSWORD
Test-EnvVar AZURE_SUBSCRIPTION_ID
Test-EnvVar AZURE_TENANT_ID
Test-EnvVar AZURE_CLIENT_ID
Test-EnvVar AZURE_CLIENT_SECRET
Set-OctopusDscEnvVars @PSBoundParameters
if (-not (Test-AppExists "vagrant")) {
Write-Output "Please install vagrant from vagrantup.com."
exit 1
}
Write-Output "Vagrant installed - good."
if (-not (Test-AppExists "azure")) {
Write-Output "Azure CLI not found. Please install from https://docs.microsoft.com/en-us/azure/xplat-cli-install."
exit 1
}
Write-Output "Azure CLI installed - good."
Test-CustomVersionOfVagrantDscPluginIsInstalled
Test-PluginInstalled "vagrant-azure" "2.0.0.pre7"
Test-PluginInstalled "vagrant-winrm-syncedfolders"
Test-PluginInstalled "vagrant-winrm-file-download"
Remove-OldLogsBeforeNewRun
if(-not $SkipPester) {
Invoke-PesterTests
} else {
Write-Output "-SkipPester was specified, skipping pester tests"
}
Write-Output "Running 'vagrant up --provider azure'"
Invoke-VagrantWithRetries -provider azure
Write-Output "'vagrant up' exited with exit code $LASTEXITCODE"
if ($LASTEXITCODE -ne 0) {
Write-Output "Vagrant up failed with exit code $LASTEXITCODE"
Write-Output "##teamcity[buildStatus text='{build.status.text}. Vagrant failed.']"
exit $LASTEXITCODE
}
Write-Output "Don't forget to run 'cleanup-azure.ps1' when you have finished"