-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-release.yml
141 lines (129 loc) · 5.39 KB
/
azure-pipelines-release.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
### Release Candidate Pipeline
### Project :: kmdp-trisotech-asset-repository-service
# Sets Virtual Machine to Run Pipeline on
pool:
vmImage: "ubuntu-latest"
# Gets Variables from Azure DevOps Library
variables:
- group: kmdp-platform-variables
- group: kmdp-platform-dev-variables
# ------------------ PIPELINE STEPS ------------------
steps:
# Outputs pipeline steps have started
- script: |
echo Starting Develop Branch Build Pipeline!
echo Project :: knew-job-runner
displayName: "Starting Pipeline Steps"
# Sets Git Credentials on the VM set from variable group
# $env:GIT_REDIRECT_STDERR = '2>&1' prevents unwanted errors
- task: PowerShell@2
displayName: "Git Config User"
inputs:
targetType: "inline"
script: |
$env:GIT_REDIRECT_STDERR = '2>&1'
git config --global user.email "$env:GIT_USER_EMAIL"
git config --global user.name "$env:GIT_USER_NAME"
Write-Host Email: "$env:GIT_USER_EMAIL"
Write-Host User Name: "$env:GIT_USER_NAME"
env:
GIT_USER_EMAIL: $(gitUserEmail)
GIT_USER_NAME: $(gitUserName)
# 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"
# Create Release Branch
- task: PowerShell@2
displayName: "Triso Checkout Release Candidate"
inputs:
targetType: "inline"
script: |
Write-Host ------ Starting Checkout ------
# Checkout develop branch to create release candidate from
git checkout --track origin/develop
# Create release version
git checkout -b "release-$env:TRISO_RELEASE_VERSION"
# mvn set version of release branch root pom and then clean install
mvn versions:set "-DnewVersion=$env:TRISO_RELEASE_VERSION" -DprocessAllModules -ntp
mvn versions:update-parent "-DparentVersion=$env:TIER1_RELEASE_VERSION" -ntp
type pom.xml
mvn clean install -Prelease "-Dedu.mayo.kmdp.trisotechwrapper.trisotechToken=$env:TRISO_DEV_TOKEN" "-DsplunkToken=$env:TRISO_SPLUNK_TOKEN" -ntp
Write-Host ------ Ending Checkout ------
env:
TRISO_RELEASE_VERSION: $(trisoReleaseVersion)
TRISO_DEV_TOKEN: $(trisoDevToken)
TIER1_RELEASE_VERSION: $(tier1ReleaseVersion)
## Check New Develop Version
- task: PowerShell@2
displayName: "Triso Check Develop"
inputs:
targetType: "inline"
script: |
Write-Host ------ Starting Checkout ------
# Checkout release branch to commit
git add .
git commit -a -m "candidate release $env:TRISO_RELEASE_VERSION"
# Check develop branch to rebase
git checkout develop
git rebase "release-$env:TRISO_RELEASE_VERSION"
mvn versions:set "-DnewVersion=$env:TRISO_DEVELOP_VERSION" -DprocessAllModules -DallowSnapshots=true -ntp
mvn versions:update-parent "-DparentVersion=$env:TIER1_DEVELOP_VERSION" -DallowSnapshots=true -ntp
type pom.xml
mvn clean install "-Dspring.profiles.active=dev" "-Dedu.mayo.kmdp.trisotechwrapper.trisotechToken=$env:TRISO_DEV_TOKEN" "-DsplunkToken=$env:TRISO_SPLUNK_TOKEN" -ntp
Write-Host ------ Ending Checkout ------
env:
TRISO_RELEASE_VERSION: $(trisoReleaseVersion)
TRISO_DEVELOP_VERSION: $(trisoNewDevelopVersion)
TRISO_SPLUNK_TOKEN: $(splunkToken)
TRISO_DEV_TOKEN: $(trisoDevToken)
TIER1_DEVELOP_VERSION: $(tier1NewDevelopVersion)
# Push to develop branches/release candidate branches
- task: PowerShell@2
displayName: "Push Develop Branch Release Candidates"
inputs:
targetType: "inline"
script: |
Write-Host ------ Starting Checkout ------
Write-Host ------ Pushing Develop Branch ------
git add .
git commit -a -m "[skip ci] update develop branch for new version: $env:TRISO_DEVELOP_VERSION"
git push "https://kmd:$env:SYSTEM_ACCESSTOKEN@dev.azure.com/mclm/KMD/_git/kmdp-trisotech-asset-repository-service"
Write-Host ------ Pushing Release Candidate Branch ------
git checkout "release-$env:TRISO_RELEASE_VERSION"
git push --set-upstream "https://kmd:$env:SYSTEM_ACCESSTOKEN@dev.azure.com/mclm/KMD/_git/kmdp-trisotech-asset-repository-service" "release-$env:TRISO_RELEASE_VERSION"
Write-Host ------ Ending Checkout ------
env:
TRISO_RELEASE_VERSION: $(trisoReleaseVersion)
TRISO_DEVELOP_VERSION: $(trisoNewDevelopVersion)
SYSTEM_ACCESSTOKEN: $(system.accesstoken)
# ------------------ END PIPELINE ------------------
- script: |
echo Ending Release Candidate Triso Pipeline!
displayName: "Pipeline Steps Ended"