-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.ci.yml
105 lines (95 loc) · 3.64 KB
/
azure-pipelines.ci.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
trigger:
branches:
include:
- develop
- feature/*
paths:
exclude:
- README.md
- Resources/*
variables:
- group: Build
- name: deploymentFolderName
value: 'Deployment'
- name: resourceGroupName
value: '$(resourceNamePrefix)-$(resourceNameSuffix)'
- name: currentDate
value: '$[format(''{0:yyyy}-{0:MM}-{0:dd}'', pipeline.startTime)]'
stages:
- stage: services
displayName: 'Services'
dependsOn: []
jobs:
- job: build_test
displayName: "Build & Test"
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: |
**/*.csproj
**/*.deployproj
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: |
**/*.csproj
**/*.deployproj
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Execute Tests'
inputs:
command: test
projects: '**/*[Tt]ests/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: false
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
- task: AzureCLI@2
displayName: 'Create Resource Group'
inputs:
azureSubscription: '$(armServiceConnection)'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az group create --location $(resourceLocation) --name $(resourceGroupName) --tags 'DeployedAt=$(currentDate)' 'DeployedBy=$(Build.RequestedFor)' 'DeployedFrom=$(System.TeamProject)'
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Validate ARM Template Resources'
inputs:
azureResourceManagerConnection: '$(armServiceConnection)'
subscriptionId: '$(subscriptionId)'
resourceGroupName: '$(resourceGroupName)'
location: '$(resourceLocation)'
csmFile: '$(deploymentFolderName)/azuredeploy.resources.bicep'
overrideParameters: '-resourceNamePrefix "$(resourceNamePrefix)" -resourceNameSuffix "$(resourceNameSuffix)"'
deploymentMode: 'Validation'
continueOnError: true
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Validate ARM Template API Definitions'
inputs:
azureResourceManagerConnection: '$(armServiceConnection)'
subscriptionId: '$(subscriptionId)'
resourceGroupName: '$(resourceGroupName)'
location: '$(resourceLocation)'
csmFile: '$(deploymentFolderName)/azuredeploy.api-definitions.bicep'
overrideParameters: '-resourceNamePrefix "$(resourceNamePrefix)" -resourceNameSuffix "$(resourceNameSuffix)"'
deploymentMode: 'Validation'
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy Deployment Definitions (to be included in Artifact)'
inputs:
SourceFolder: '$(deploymentFolderName)'
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(deploymentFolderName)'
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '$(System.StageName)'