-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathazure-pipelines.yml
94 lines (90 loc) · 3.3 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
# Don't forget to set the following variables for your (release) pipeline: docker.credentials.user, docker.credentials.password
trigger:
- main
- develop
- feature/*
variables:
- name: isRelease
value: $[eq(variables['Build.SourceBranchName'], 'main')]
- name: isDevelop
value: $[eq(variables['Build.SourceBranchName'], 'develop')]
- name: docker.image.prefix
value: ghcr.io/bechtleav360
- name: docker.image.name
value: maverick-entity-graph
- name: docker.image.version
${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
value: "latest"
${{ elseif eq(variables['Build.SourceBranchName'], 'develop') }}:
value: "develop"
${{ else }}:
value: variables['Build.SourceBranchName']
- name: docker.url
value: https://ghcr.io
- name: docker.publish
${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
value: true
${{ if eq(variables['Build.SourceBranchName'], 'develop') }}:
value: true
${{ else }}:
value: false
stages:
- stage: Building
jobs:
- job: Testing
# pool:
# vmImage: ubuntu-latest
steps:
- task: Maven@3
displayName: Run unit tests
inputs:
mavenPomFile: 'pom.xml'
goals: 'test'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: 1.17
jdkArchitectureOption: x64
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
options: '-DskipTests=false'
- stage: Publishing
dependsOn: Building
jobs:
- job: Pushing
# pool:
# vmImage: ubuntu-latest
steps:
- script: echo "Publishing image with build number $(Build.BuildNumber) and name $(docker.image.prefix)/$(docker.image.name) with user $(docker.credentials.user)"
- task: Maven@3
displayName: Install
inputs:
mavenPomFile: 'pom.xml'
goals: 'install'
javaHomeOption: 'JDKVersion'
jdkVersionOption: 1.17
jdkArchitectureOption: x64
mavenVersionOption: 'Default'
effectivePomSkip: false
options: '-DskipTests=true'
- task: Maven@3
displayName: Publish Docker Image to Container Registry
# env:
# IMAGE_PREFIX: $(docker.image.prefix)
# IMAGE_NAME: $(docker.image.name)
# IMAGE_VERSION: $(Build.SourceBranchName)
# DOCKER_USER: $(docker.credentials.user)
# DOCKER_PASSWORD: $(docker.credentials.password)
# DOCKER_URL: $(docker.url)
inputs:
mavenPomFile: 'maverick.graph.main/pom.xml'
goals: 'spring-boot:build-image'
jdkVersionOption: 1.17
options: >
-DskipTests=true
-Ddocker.publish=$(docker.publish)
-Ddocker.credentials.user=$(docker.credentials.user)
-Ddocker.credentials.password=$(docker.credentials.password)
-Ddocker.registry.host=$(docker.url)