-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-features.yml
112 lines (99 loc) · 3.29 KB
/
azure-pipelines-features.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
### Feature Pipeline
### Feature Snapshot Branch X.X.X-SNAPSHOT
### No deployments to artifacts
### Project :: KMDP Openapi Spring Archetype
### JDK 11
# !! No Downstream Builds !!
trigger:
- feature*
pool:
vmImage: 'ubuntu-latest'
# ------------------ PIPELINE STEPS ------------------
steps:
- script: |
echo Starting KMDP Feature Branch Pipeline!
echo Project :: KMDP Openapi Spring Archetype
displayName: 'Pipeline Steps Started'
# Download Secure Settings m2 File
- task: DownloadSecureFile@1
displayName: 'Download Secure m2'
name: settingsxml
inputs:
secureFile: settings-dev.xml
# Write settings file to Build Server
- task: PowerShell@2
displayName: 'Update m2 Settings File'
inputs:
targetType: 'inline'
script: |
New-Item -Type Directory -Force "${HOME}/.m2"
Copy-Item -Force "$(settingsxml.secureFilePath)" "${HOME}/.m2/settings.xml"
# Authenticate to Maven Feed
- task: MavenAuthenticate@0
displayName: 'Maven Authenticate'
inputs:
artifactsFeeds: 'KMD'
# Set JDK 11 and MVN Validate Project
- task: Maven@3
displayName: 'Set Maven JDK 11'
inputs:
mavenPomFile: 'pom.xml'
goals: 'validate'
options: '-ntp'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
# Read Root POM File and Set GAV Variables
- task: PowerShell@2
displayName: 'Read POM/Set GAV Variables'
inputs:
targetType: 'inline'
script: |
[xml]$pomXml = Get-Content .\pom.xml
Write-Host ---- Group Id, Artifact Id, Version ----
Write-Host GroupId: $pomXml.project.groupId
Write-Host ArtifactId: $pomXml.project.artifactId
Write-Host Version: $pomXml.project.version
# Write GAV to local task variables
$groupId=$pomXml.project.groupId
$artifactId=$pomXml.project.artifactId
$version=$pomXml.project.version
# Set GAV to pipeline variables
Write-Host "##vso[task.setvariable variable=projectSnapShotVersion]$version"
Write-Host "##vso[task.setvariable variable=projectGroupId]$groupId"
Write-Host "##vso[task.setvariable variable=projectArtifactId]$artifactId"
# Write GAV variables for validation
- task: PowerShell@2
displayName: 'Validate Env Variables'
inputs:
targetType: 'inline'
script: |
Write-Host --------------------------------
Write-Host POM Variables:
Write-Host Project Group ID: $env:GROUP_ID
Write-Host Project Artifact ID: $env:ARTIFACT_ID
Write-Host Project Snapshot Version: $env:PROJECT_SNAPSHOT_VERSION
env:
ARTIFACT_ID: $(projectArtifactId)
PROJECT_SNAPSHOT_VERSION: $(projectSnapShotVersion)
GROUP_ID: $(projectGroupId)
# SLM Versioning Policy (No Version Change)
- task: AlmVersioning@4
displayName: 'SLM Update Version/Build #'
inputs:
projectType: java
versionFilePath: pom.xml
versionTransformation: none
# Maven Clean Test
- task: Maven@3
displayName: 'Maven Clean Test'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean package'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
options: '-ntp'
# ------------------ END PIPELINE ------------------
- script: |
echo Ending Feature Branch Pipeline!
displayName: 'Pipeline Steps Ended'