-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
64 lines (62 loc) · 2.89 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
parameters:
- name: azSubscription
displayName: Name of the Azure ARM service connection
default: Free Trial 1
- name: rgName
displayName: Azure Resource group name (also used as the VM name). Will be created if it doesn't exist.
type: string
- name: azlocation
displayName: Location of the resource group. Ignored if resource group already exists.
type: string
default: uksouth
- name: addressSpace
displayName: Address space (also used as subnet) of the TailScale VM vnet
type: string
default: 192.168.23.0/24
- name: adminKey
displayName: SSH Key for admin user
type: string
default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvd7m/4NgGLkAV6GUUTsl6Tfx0NwGDDWK4JM0eiXX5yOvJ63tVbyeMO6I7LZTjSVo2Ah9LpIOmixQSLbdOd6fIwj6s4tmHu9X9R3KvJ1JE4VApbFprOAaBFTo1lESoZ9ch3X2UaCYMl/sGO7ky22fusho7UUZn+cWlX34y+fhtggeJVrG8SzftyuqgRT27GTEE6oyYJZXsPTVah74yEPWHBMt4n5qcnTkfIkCSy3eqyYNypesRR4ArYv3lyiHAL9NGNDr1iXpl4/RiEy9vTQepXN0UUOmfIKo1nj5p4E2f+CHf2eYmMUqDB0xJInK0cTUml9m2X/VTq6aTnVF2VOXLGkluvLUqdLkcLHfYC+xHF47tKlvuWKiQwzvDViUoNlIW5ai8cIt7Pk9HUWHZ5+Xf+sk+VnZfELYnnAc2xMFJxFFqssVINW2tm0eQIeV9iWrymlHNWj0h23eb0oTM2uJ8s/+tg4MtQcAbOPePj2bfats8fa27TXdGup/zZXlJvac= rakhesh
- name: tailscaleKey
displayName: TailScale Pre-auth Key
type: string
- name: tailscaleRoutes
displayName: Subnets routed through this TailScale node
default: 192.168.23.0/24,10.23.0.0/16
- name: debug
displayName: Show contents of the files after updating?
default: false
# I'd like to run this manually
trigger: none
jobs:
- job: deploy
displayName: Deploy to Azure
pool:
vmImage: ubuntu-latest
steps:
- script: sed -i "s|__REPLACEKEY__|${{ parameters.tailscaleKey }}|g; s|__REPLACEROUTES__|${{ parameters.tailscaleRoutes }}|g" artifacts/cloud-init.txt
displayName: Update cloud-init.txt with the input paramters
- script: cat artifacts/cloud-init.txt
displayName: Show contents of the updated cloud-init.txt file
condition: eq('${{ parameters.debug }}', true)
- pwsh:
$file = Get-Content -Path ./artifacts/azuredeploy.parameters.json -Raw | ConvertFrom-Json ;
$file.parameters.adminKey.value = "${{ parameters.adminKey }}" ;
$file.parameters.addressSpace.value = "${{ parameters.addressSpace }}" ;
$file | ConvertTo-Json -Depth 15 | Set-Content ./artifacts/azuredeploy.parameters.json ;
displayName: Update azuredeploy.parameters.json with the input parameters
- pwsh:
Get-Content -Path ./artifacts/azuredeploy.parameters.json -Raw
displayName: Show contents of the updated azuredeploy.parameters.json
condition: eq('${{ parameters.debug }}', true)
- task: AzureCLI@2
displayName: Deploy to Azure
env:
TERM: xterm-256color
inputs:
azureSubscription: ${{ parameters.azSubscription }}
scriptType: bash
scriptLocation: scriptPath
scriptPath: ./deploy.sh
arguments:
-g ${{ parameters.rgName }} -d artifacts -l ${{ parameters.azlocation }}