-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines-cartservice.yml
122 lines (117 loc) · 2.74 KB
/
azure-pipelines-cartservice.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
trigger:
branches:
include:
- '*'
paths:
include:
- 'src/cartservice/*'
pool:
name: devops
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
service: cartservice
stages:
- stage: CheckBranch
displayName: Check Triggered Branch
jobs:
- job: printBranch
displayName: Print Build.SourceBranch
steps:
- script: echo "Triggered branch $(Build.SourceBranch)"
# - stage: unittests
# displayName: unittests
# jobs:
# - job: Test
# displayName: C#
# steps:
# - task: DotNetCoreCLI@2
# displayName: 'dotnet test'
# inputs:
# command: test
# testRunTitle: 'C# Unit Tests'
# projects: 'src/cartservice'
# workingDirectory: src/cartservice
# timeoutInMinutes: 10
# - stage: Sonar
# displayName: Sonar
# jobs:
# - job: prep
# displayName: prep
# steps:
# - task: SonarQubePrepare@5
# inputs:
# SonarQube: 'sonar'
# scannerMode: 'CLI'
# configMode: 'manual'
# cliProjectKey: 'azure-devops-cicd10'
# cliProjectName: 'azure-devops-cicd10'
# cliSources: 'src/cartservice'
# extraProperties: |
# sonar.java.binaries=.
# sonar.branch.name=cartservice
# sonar.organization=azure-devops-cicd10
# - task: SonarQubeAnalyze@5
# inputs:
# jdkversion: 'JAVA_HOME'
- stage: Login
displayName: Login
jobs:
- job: Login
displayName: Login
steps:
- task: Docker@2
displayName: Login
inputs:
containerRegistry: 'docker'
command: 'login'
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: 'docker'
repository: 'elkakimmie/cartservice'
command: 'build'
Dockerfile: 'src/cartservice/src/Dockerfile'
tags: '$(tag)'
# - stage: Imagescan
# displayName: imagescan
# jobs:
# - job: scan
# continueOnError: true
# displayName: scan
# steps:
# - task: trivy@1
# inputs:
# version: 'latest'
# image: 'elkakimmie/cartservice'
- stage: Push
displayName: Push image
jobs:
- job: Push
displayName: Push
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: 'docker'
repository: 'elkakimmie/cartservice'
command: 'push'
Dockerfile: 'src/cartservice/src/Dockerfile'
tags: '$(tag)'
- stage: Updatek8s
displayName: updatek8s
jobs:
- job: Updatek8s
displayName: updatek8s
steps:
- task: ShellScript@2
inputs:
scriptPath: '$(Build.Repository.LocalPath)/scripts/updateK8s.sh'
args: '$(service) $(tag)'