-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
83 lines (75 loc) · 2.7 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
# Docker
# Build a Docker image
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
batch: true
branches:
include:
- main
pr:
branches:
include:
- main
resources:
- repo: self
variables:
- name: containerRegistry
value: crsycdivaasandbox
- name: tags
value: $(Build.BuildNumber)
- name: isMain
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
stages:
- stage: Build_and_push_cmpld_images
displayName: Build and push compiled images
jobs:
- template: docker-build-deploy-template.yml
parameters:
profile: x86_64_platform
containerRegistry: $(containerRegistry)
tags: $(tags)
- template: docker-build-deploy-template.yml
parameters:
profile: arm64_platform_x86_machine
containerRegistry: $(containerRegistry)
tags: $(tags)
- template: docker-build-deploy-template.yml
parameters:
profile: arm64_platform_arm_machine
containerRegistry: $(containerRegistry)
tags: $(tags)
targetArchitecture: arm64
- stage: deploy_image_to_iot_edge_devices
displayName: Deploy image to IoT edge devices if changes are applied to main branch
condition: and(succeeded(), eq(variables.isMain, 'true')) #stage only runs if run on main branche
jobs:
- job: deploy_image_to_iot_edge_devices
displayName: Deploying images to IoT Edge devices
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
submodules: recursive
- script: mkdir $(System.DefaultWorkingDirectory)/config
- script: cp '$(Build.SourcesDirectory)/deployment.template.json' $(System.DefaultWorkingDirectory)/config/deployment.json
- script: sed -i 's/{tag}/$(Build.BuildNumber)/g' $(System.DefaultWorkingDirectory)/config/deployment.json
# - task: AzureIoTEdge@2
# displayName: AzureIoTEdge - Generate deployment manifest
# inputs:
# action: Generate deployment manifest
# templateFilePath: '$(Build.SourcesDirectory)/deployment.template.json'
# defaultPlatform: amd64
# deploymentManifestOutputPath: $(System.DefaultWorkingDirectory)/config/deployment.json
# validateGeneratedDeploymentManifest: true
- script: cat $(System.DefaultWorkingDirectory)/config/deployment.json
- task: AzureIoTEdge@2
displayName: AzureIoTEdge - Deploying manifest to device
inputs:
action: Deploy to IoT Edge devices
deploymentFilePath: $(System.DefaultWorkingDirectory)/config/deployment.json
azureSubscription: sandboxSubscription
iothubname: iothubsycdivasandbox
deploymentid: $(System.TeamProject)-devops-deployment
priority: '0'
deviceOption: 'Single Device'
deviceId: Leeloo_edge_runtime