-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines-paymentservice.yml
97 lines (92 loc) · 2.25 KB
/
azure-pipelines-paymentservice.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
# Docker
# Build a Docker image
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
paths:
include:
- 'src/paymentservice/*'
pool:
name: devops
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
service: paymentservice
stages:
- stage: CheckBranch
displayName: Check Triggered Branch
jobs:
- job: printBranch
displayName: Print Build.SourceBranch
steps:
- script: echo "Triggered branch $(Build.SourceBranch)"
# - 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/paymentservice'
# extraProperties: |
# sonar.java.binaries=.
# sonar.branch.name=paymentservice
# sonar.organization=azure-devops-cicd10
# - task: SonarQubeAnalyze@5
# inputs:
# jdkversion: 'JAVA_HOME'
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: 'docker'
repository: 'elkakimmie/paymentservice'
command: 'build'
Dockerfile: 'src/paymentservice/Dockerfile'
tags: '$(tag)'
# - stage: Imagescan
# displayName: imagescan
# jobs:
# - job: scan
# continueOnError: true
# displayName: scan
# steps:
# - task: trivy@1
# inputs:
# version: 'latest'
# image: 'elkakimmie/paymentservice'
- stage: Push
displayName: Push image
jobs:
- job: Push
displayName: Push
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: 'docker'
repository: 'elkakimmie/paymentservice'
command: 'push'
Dockerfile: 'src/paymentservice/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)'