-
Notifications
You must be signed in to change notification settings - Fork 18
/
azure-pipelines.yml
83 lines (73 loc) · 2.49 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
trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- readme.md
- documentation/*
- media/*
pool:
vmImage: ubuntu-18.04
pr:
autoCancel: true
variables:
CONTAINER_REGISTRY_ADDRESS: $(ACR_NAME).azurecr.io
stages:
- stage: Build
jobs:
- job: Build
steps:
# Determine module verion
- task: UseGitVersion@5
inputs:
versionSpec: '5.x.x'
# Set container verion to be Semantic Version
- script: |
echo "##vso[task.setvariable variable=CONTAINER_VERSION_TAG]$(GitVersion.AssemblySemVer)"
displayName: Set container verion to be Semantic Version
# Build Modules
- task: AzureIoTEdge@2
inputs:
action: 'Build module images'
templateFilePath: 'deployment.template.json'
defaultPlatform: 'amd64'
displayName: Build Edge Modules
# Push Modules
- task: AzureIoTEdge@2
inputs:
action: 'Push module images'
containerregistrytype: 'Azure Container Registry'
azureSubscriptionEndpoint: $(AZURE_SERVICE_CONNECTION)
azureContainerRegistry: '{"loginServer":"$(CONTAINER_REGISTRY_ADDRESS)", "id" : "/subscriptions/$(AZURE_SUBSCRIPTION_ID)/resourceGroups/$(ACR_RESOURCE_GROUP)/providers/Microsoft.ContainerRegistry/registries/$(ACR_NAME)"}'
templateFilePath: 'deployment.template.json'
defaultPlatform: 'amd64'
fillRegistryCredential: 'true'
displayName: Push Edge Modules
# Copy the generated manifest to the artifact staging directory
- script: |
cp config/deployment.amd64.json $(Build.ArtifactStagingDirectory)
displayName: Copy manifest to artifact directory
# Publish the deployment manifest as a pipeline artifact
- publish: $(Build.ArtifactStagingDirectory)
artifact: config
- stage: Release
jobs:
- job: Release
steps:
# Download deployment manifest from build stage
- download: current
artifact: config
# Deploy to all edge devices
- task: AzureIoTEdge@2
displayName: Create Deployment
inputs:
action: Deploy to IoT Edge devices
deploymentFilePath: $(Pipeline.Workspace)/config/deployment.amd64.json
azureSubscription: $(AZURE_SERVICE_CONNECTION)
iothubname: $(IOT_HUB_NAME)
deploymentid: offline-dashboard
priority: '10'
deviceOption: Multiple Devices
targetcondition: $(DEPLOYMENT_TARGET_CONDITION)