-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipline.yml
83 lines (76 loc) · 2.22 KB
/
azure-pipline.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
name: $(Build.BuildId)
trigger:
- "main"
- "master"
# pool:
# name: "Azure Pipelines"
# pool:
# name: "Om Namh Shivay"
pool:
vmImage: 'ubuntu-latest'
# vmImage: 'windows-latest'
variables:
Sonarcloud.ProjectKey: $(Build.Repository.Name)
tag: 'live' #'$(Build.BuildId)'
appName: 'keshavsingh4522/micr-aggregator-demo'
dockerfile: src/MICR.Aggregator.Demo.API/Dockerfile #'src/$(Build.Repository.Name).API/Dockerfile'
BuildConfiguration: 'Release'
stages:
- stage: Build_Test_Analyse
displayName: Build, Test and Analyse
jobs:
- job:
displayName: Build, Test and Analyse
steps:
- task: DotNetCoreCLI@2
displayName: "Restore Nuget Packages"
inputs:
command: "restore"
feedsToUse: "select"
vstsFeed: "MICR.Packages.V4"
- task: DotNetCoreCLI@2
displayName: "Build all projects in repo"
inputs:
command: "build"
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: "Execute Unit Test Projects"
inputs:
command: "test"
arguments: '--collect "Code Coverage"'
- stage: Build
displayName: Build Container Image And Push To Docker Hub
dependsOn: []
variables:
- group: 'MICR-Core-Envs'
- name: Environment
value: Development
# variables:
# - group: 'AWS Demo'
jobs:
- job: Build
displayName: Build
steps:
- task: CmdLine@2
inputs:
script: |
ls -la
tree
pwd
- task: Docker@2
displayName: 'Build Container Image > $(Environment)'
inputs:
command: 'build'
repository: $(appName)
Dockerfile: $(dockerfile)
buildContext: $(System.DefaultWorkingDirectory)
containerRegistry: $(DockerConnectionName)
arguments: --build-arg ENVD=$(Environment)
tags: $(tag)
- task: Docker@2
displayName: 'Push Container Image'
inputs:
containerRegistry: $(DockerConnectionName)
repository: $(appName)
command: 'push'
tags: $(tag)