-
Notifications
You must be signed in to change notification settings - Fork 0
/
azurepipelines.yml
74 lines (65 loc) · 2.32 KB
/
azurepipelines.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
trigger:
- main
pool: aks-windows-pool
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
imageRepository: 'dev-aspnet4.8-repo'
containerRegistry: 'acrmediawestus3.azurecr.io'
dockerfilePath: '**/Dockerfile'
tag: '$(Build.BuildId)'
dockerRegistryServiceConnection: 'acrmedianonprod-connection'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool: aks-windows-pool
steps:
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: 'acrmedianonprod-connection'
tags: |
$(tag)
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy
pool: aks-windows-pool
environment: 'Private-Aks-dev'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
inputs:
action: 'deploy'
namespace: 'dev-aspnet-app'
kubernetesServiceConnection: 'aks-media-nonprod-conn'
manifests: |
**/deploy.yml
containers: |
$(containerRegistry)/$(imageRepository):$(tag)
- task: KubernetesManifest@0
displayName: patching env variables
inputs:
action: 'patch'
kind: 'deployment'
name: dev-aspnet-webapp
namespace: 'dev-aspnet-app'
kubernetesServiceConnection: 'aks-media-nonprod-conn'
patch: '{"spec":{"template":{"spec":{"containers":[{"name":"dev-apsnet-webapp","image":"acrmediawestus3.azurecr.io/dev-aspnet4.8-repo:$(Build.BuildId)","env":[{"name":"KeyVault_URI","value":"$(KeyVault_URI)"},{"name":"SecretName","value":"$(SecretName)"},{"name":"UserAssignedClientId","value":"$(UserAssignedClientId)"}]}]}}}}'