-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
91 lines (87 loc) · 2.66 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
trigger:
- nothing
pr:
drafts: false
autoCancel: true
branches:
include:
- nothing
resources:
- repo: self
variables:
azureSubscription: 'Abonnement Azure 1(a95d975e-5977-4349-86f4-87b81555a0e0)'
dockerRegistryServiceConnection: 'efd620cb-8723-4b45-9528-0912f1444c83'
resourceGroupName: 'preflop-academy'
appName: 'preflop-academy'
imageRepository: 'preflopacademy'
containerRegistry: 'preflopacademy.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
tag: '$(Build.BuildId)'
vmImageName: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build and push stage
pool:
vmImage: $(vmImageName)
jobs:
- job: InstallAndTest
steps:
- task: NodeTool@0
displayName: 'npm install & build'
inputs:
versionSpec: '14.x'
- script: |
npm ci
npm run lint
npm run test:coverage
npm run build
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'test-report.xml'
failTaskOnFailedTests: true
testRunTitle: 'Publish test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: 'coverage/cobertura-coverage.xml'
pathToSources: 'src'
reportDirectory: 'coverage'
failIfCoverageEmpty: true
- job: Build
dependsOn: InstallAndTest
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
displayName: 'Build and Push Docker Image'
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
latest
- stage: Deploy
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
pool:
vmImage: $(vmImageName)
jobs:
- deployment: DeployAppService
displayName: Deploy App Service on Staging slot
environment: 'prod'
strategy:
runOnce:
deploy:
steps:
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Abonnement Azure 1(a95d975e-5977-4349-86f4-87b81555a0e0)'
appType: 'webAppContainer'
WebAppName: '$(appName)'
DockerNamespace: '$(containerRegistry)'
DockerRepository: '$(imageRepository)'
DockerImageTag: '$(tag)'