forked from Sitecore/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-images.yml
136 lines (131 loc) · 5.83 KB
/
build-images.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
trigger:
batch: true
branches:
include:
- master
- integration/*
schedules:
- cron: "0 12 * * 0"
displayName: Weekly Sunday build
branches:
include:
- master
always: true
pr:
autoCancel: true
branches:
include:
- master
stages:
- stage: Start_Windows_VM
dependsOn: []
jobs:
- job: Start_Windows_VM
pool:
name: DEVDEMO1US1
steps:
- task: vfabing.AzureVirtualMachineManagerTask.custom-build-release-task.AzureVirtualMachineManagerTask@1
displayName: "Start Docker Build VM"
inputs:
Action: "Start VM"
azureSubscription: "AzureSubscription"
ResourceGroupName: $(docker.build.vm.resourceGroupName)
VmName: $(docker.build.vm.name)
- stage: Start_Linux_VM
dependsOn: []
jobs:
- job: Start_Linux_VM
pool:
name: DEVDEMO1US1
steps:
- task: vfabing.AzureVirtualMachineManagerTask.custom-build-release-task.AzureVirtualMachineManagerTask@1
displayName: "Start Docker Build VM"
inputs:
Action: "Start VM"
azureSubscription: "AzureSubscription"
ResourceGroupName: $(docker.build.vm.resourceGroupName)
VmName: 'docker-ubuntu16'
- stage: Build_Windows_Images
dependsOn: Start_Windows_VM
jobs:
- job: Connect_Asset_Drive
displayName: "Connect to Azure File Connect to Azure File Share"
pool:
name: Docker
demands:
- Agent.OS -equals Windows_NT
steps:
- powershell: |
Test-NetConnection -ComputerName "$(shared.folder.server)" -Port 445
Invoke-Expression -Command "cmdkey /add:$(shared.folder.server) /user:Azure\dockerassets /pass:$(azure.fileshare.password)"
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\$(shared.folder.server)\docker-assets" -Persist -ErrorAction SilentlyContinue
- job: Build_Images
dependsOn: Connect_Asset_Drive
timeoutInMinutes: 720
displayName: "Build Images"
pool:
name: Docker
steps:
- task: Docker@2
displayName: login
inputs:
containerRegistry: "docker-registry"
command: login
- checkout: self
clean: all
- powershell: |
$(sitecore.democontainer.password) | docker login -u "$(container.registry.username)" --password-stdin $(container.registry.fullname)
# TEMPORARY
$Destination = (Join-Path "$(Build.SourcesDirectory)" "windows\9.2.0\sitecore-assets\patches\bin")
New-Item -ItemType Directory -Path $Destination -Force
Copy-Item -Path "z:\Sitecore.Kernel.dll" -Destination $Destination -Verbose
# END TEMPORARY
Import-Module (Join-Path "$(Build.SourcesDirectory)" "\modules\SitecoreImageBuilder") -Force
SitecoreImageBuilder\Invoke-PackageRestore -Path (Join-Path "$(Build.SourcesDirectory)" "windows") -Destination $(install.source.path) -SitecoreUsername $(sitecore.username) -SitecorePassword $(sitecore.password)
SitecoreImageBuilder\Invoke-Build -Path (Join-Path "$(Build.SourcesDirectory)" "windows") -InstallSourcePath $(install.source.path) -Registry $(container.registry.name) -PushMode $(PushMode)
errorActionPreference: silentlyContinue
continueOnError: "true"
- stage: Build_Linux_Images
dependsOn: Start_Linux_VM
jobs:
- job: Build_Linux_Images
timeoutInMinutes: 720
displayName: "Build Linux Images"
pool:
name: Docker
demands:
- Agent.OS -equals Linux
steps:
- task: Docker@2
enabled: true
displayName: login
inputs:
containerRegistry: "docker-registry"
command: login
- checkout: self
clean: all
- task: Bash@3
inputs:
targetType: inline
script: |
if [ -d "/mnt/dockerassets" ]; then
exit 0
fi
sudo mkdir /mnt/dockerassets
if [ ! -d "/etc/smbcredentials" ]; then
sudo mkdir /etc/smbcredentials
fi
if [ ! -f "/etc/smbcredentials/dockerassets.cred" ]; then
sudo bash -c 'echo "username=dockerassets" >> /etc/smbcredentials/dockerassets.cred'
sudo bash -c 'echo "password=$(azure.fileshare.password)" >> /etc/smbcredentials/dockerassets.cred'
fi
sudo chmod 600 /etc/smbcredentials/dockerassets.cred
sudo bash -c 'echo "//$(shared.folder.server)/docker-assets /mnt/dockerassets cifs nofail,vers=3.0,credentials=/etc/smbcredentials/dockerassets.cred,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab'
sudo mount -t cifs //$(shared.folder.server)/docker-assets /mnt/dockerassets -o vers=3.0,credentials=/etc/smbcredentials/dockerassets.cred,dir_mode=0777,file_mode=0777,serverino
- powershell: |
$(sitecore.democontainer.password) | docker login -u "$(container.registry.username)" --password-stdin $(container.registry.fullname)
Import-Module (Join-Path "$(Build.SourcesDirectory)" "\modules\SitecoreImageBuilder") -Force
SitecoreImageBuilder\Invoke-PackageRestore -Path (Join-Path "$(Build.SourcesDirectory)" "linux") -Destination "/mnt/dockerassets" -SitecoreUsername $(sitecore.username) -SitecorePassword $(sitecore.password)
SitecoreImageBuilder\Invoke-Build -Path (Join-Path "$(Build.SourcesDirectory)" "linux") -InstallSourcePath "/mnt/dockerassets" -Registry $(container.registry.name) -PushMode $(PushMode)
errorActionPreference: silentlyContinue
continueOnError: "true"