-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-develop.yml
143 lines (127 loc) · 4.23 KB
/
azure-pipelines-develop.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
### Develop Pipeline
### Snapshot Branch Versioning Stategy: X.X.X-SNAPSHOT
### Project :: KMDP MVN Enforcer Rules
# !! Downstream Build: none; develop !! #
resources:
pipelines:
- pipeline: kmdpMvnEnforcerRulesDevelop
source: kmdpMvnEnforcerRulesMain
trigger:
branches:
- main
trigger:
branches:
include:
- develop
exclude:
- feature*
paths:
exclude:
- azure-pipelines-develop.yml
- azure-pipelines-features.yml
- release-notes.md
- README.md
# Sets Virtual Machine to Run Pipeline on
pool:
vmImage: 'ubuntu-latest'
# Gets Variables from Azure DevOps Library
variables:
- group: kmdp-platform-variables
# ------------------ PIPELINE STEPS ------------------
steps:
# Outputs pipeline steps have started
- script: |
echo Starting Develop Branch Build Pipeline!
echo Project :: KMDP MVN Enforcer Rules
displayName: 'Starting Pipeline Steps'
# Reads Root pom.xml File
# Gets/Sets GAV from POM to Pipeline Variables
- task: PowerShell@2
displayName: 'Get/Set POM Variables'
inputs:
targetType: 'inline'
script: |
[xml]$pomXml = Get-Content .\pom.xml
Write-Host --------------------------------
Write-Host POM Variables:
Write-Host GroupId: $pomXml.project.groupId
Write-Host ArtifactId: $pomXml.project.artifactId
Write-Host Version: $pomXml.project.version
Write-Host --------------------------------
Write-Host Setting GAV to local task variables
$groupId=$pomXml.project.groupId
$artifactId=$pomXml.project.artifactId
$version=$pomXml.project.version
Write-Host --------------------------------
Write-Host Setting 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"
# Gets .m2 Settings File from Azure DevOps Library
# Downloads File for use in Pipeline
- task: DownloadSecureFile@1
displayName: 'Downloads Secure .m2 Settings File'
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'
# Sets JDK 11 for Pipeline
# Runs Maven Goal: validate
- task: Maven@3
displayName: 'Sets Pipeline to JDK 11'
inputs:
mavenPomFile: 'pom.xml'
goals: 'validate'
options: '-ntp'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
# Sets ALM/SLM Versioning Policy
# Sets Version Tranformation: none
- task: AlmVersioning@4
displayName: 'SLM Update Version/Build #'
inputs:
projectType: java
versionFilePath: pom.xml
versionTransformation: none
# GitHub Super-Linter
- script: |
mkdir super-linter.report
docker pull github/super-linter:latest
docker run -e RUN_LOCAL=true -e DISABLE_ERRORS=true -e OUTPUT_DETAILS=detailed -e OUTPUT_FORMAT=tap -v $(System.DefaultWorkingDirectory):/tmp/lint/ --name my-vol github/super-linter
docker cp my-vol:/tmp/lint/super-linter.report $(build.artifactstagingdirectory)
displayName: 'Code Scan using GitHub Super-Linter'
# Publish GitHub Results to Azure Pipelines
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: deploy'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: deploy
condition: succeededOrFailed()
# Runs Maven Goal: deploy
# Deploys to Azure DevOps Artifacts
- task: PowerShell@2
displayName: 'Maven Deploy to Artifacts'
inputs:
targetType: 'inline'
script: |
mvn deploy "-DaltDeploymentRepository=$env:DEPLOY_REPO::default::$env:DEPLOY_REPO_PATH" -ntp
env:
DEPLOY_REPO: $(deploymentRepo)
DEPLOY_REPO_PATH: $(deploymentRepoPath)
# ------------------ END PIPELINE ------------------
# Outputs pipeline steps have ended
- script: |
echo Ending Develop Branch Pipeline!
displayName: 'Ending Pipeline Steps'