-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
94 lines (83 loc) · 2.47 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
84
85
86
87
88
89
90
91
92
93
94
trigger:
- main
pool:
vmImage: 'windows-latest'
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '31f2836a-84b3-4ad0-bf15-f4ea41754d06'
imageRepository: 'sportsdatavenue'
containerRegistry: 'sportdeetscr.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/src/SportsData.Venue/Dockerfile'
tag: '$(Build.BuildId)'
# Agent VM image name
vmImageName: 'ubuntu-latest'
# Build Solution Vars
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
Major: '1'
Minor: '0'
Patch: '1'
PackageVersion: '1.0.1'
# Deploy Vars
azureSubscription: 'dev-sports-data-connection'
appName: 'dev-sdvenue'
stages:
- stage: BuildAndTest
jobs:
- job: BuildAndTest
displayName: BuildAndTest
steps:
- task: UseDotNet@2
displayName: 'Use .NET 8 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
includePreviewVersions: true
- task: NuGetCommand@2
displayName: 'NuGet Restore'
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'select'
vstsFeed: '2bb0cd0d-fa6e-42f0-9b7e-9cc1ce065e55/de94ed5a-8390-4547-bdd9-f975a712aa70'
- task: VSBuild@1
displayName: 'Build sports-data-venue solution'
inputs:
solution: '**\*.sln'
restoreNugetPackages: true
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests'
inputs:
command: 'test'
projects: '**/*.csproj'
testRunTitle: 'sdVenue-tests-unit'
- stage: BuildImagePushACR
displayName: Build Image & Push to ACR
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- job: Deploy
steps:
- task: AzureWebAppContainer@1
displayName: 'Azure Web App on Container Deploy'
inputs:
azureSubscription: $(azureSubscription)
appName: $(appName)
containers: $(containerRegistry)/$(imageRepository):$(tag)