/
Jenkinsfile.sonatype.deploy
126 lines (122 loc) · 3.83 KB
/
Jenkinsfile.sonatype.deploy
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
/*
* Copyright (c) 2011-present Sonatype, Inc. All rights reserved.
* Includes the third-party code listed at http://links.sonatype.com/products/clm/attributions.
* "Sonatype" is a trademark of Sonatype, Inc.
*/
@Library(['private-pipeline-library', 'jenkins-shared', 'int-jenkins-shared', 'bnr-pipeline-library']) _
def jira = [
versionPrefix: 'jenkins', project: 'INT', projectId: '10007',
credentialId : 'atlassian-jenkins', autoRelease: true, failOnError: true
]
// Get jenkins plugin version
def version = getVersionFromBuildName(env.releaseBuild_NAME)
def segments = parseVersionString(version)
def confluenceVersion = segments.join('.')
pipeline {
agent { label 'ubuntu-zion' }
tools {
jdk 'OpenJDK 11'
}
options {
buildDiscarder(
logRotator(numToKeepStr: '100', artifactNumToKeepStr: '20')
)
timestamps()
}
stages {
stage('Export Variables') {
steps {
exportBuildVariables(params.environment, env.releaseBuild_NAME)
}
}
stage('Checkout Publishing Scripts') {
steps {
checkoutPublishingScripts()
}
}
stage('Gather Build Artifacts') {
steps {
gatherBuildArtifacts('integrations/jenkins/release', env.releaseBuild_NUMBER)
}
}
stage('Publish') {
steps {
publishProduct('NXJenkinsPlugin')
}
}
stage('Update latest version table') {
steps {
updateLatestVersionTable(params.environment, 'INT_JENKINS', getVersionFromBuildName(env.releaseBuild_NAME))
}
}
stage('Update nginx configuration') {
steps {
updateNginxConfig(params.environment)
}
}
stage('Purge Fastly Download Cache') {
steps {
build job: 'ops/fastly-purge-downloads', propagate: true, wait: true
}
}
stage('Verify Staging Links') {
when {
expression { 'Staging' == params?.environment }
}
steps {
verifyDownloadLinks(
urlParts: ['https://download-staging.sonatype.com/integrations/jenkins/nexus-jenkins-plugin-', version],
urlSuffixes: ['.hpi']
)
}
}
stage('Verify Production Links') {
when {
expression { 'Production' == params?.environment }
}
steps {
verifyDownloadLinks(
urlParts: ['https://download.sonatype.com/integrations/jenkins/nexus-jenkins-plugin-', version],
urlSuffixes: ['.hpi']
)
}
}
stage('Update Download and Compatibility Page') {
when {
expression { 'Production' == params?.environment }
}
steps {
// paligo: update plugin's version in the download and compatibility page
// https://sonatype.atlassian.net/wiki/spaces/HELP/pages/270172330/Automation+with+Paligo#Jenkins-Plugin-Version
updatePaligoContent contentId: '170404', updates: [
[
pattern: /<para[^>]*>[^<]+<\/para>/,
replacement: /<para>${confluenceVersion}<\/para>/
]]
// paligo: update plugin's links in the download and compatibility page
// https://sonatype.atlassian.net/wiki/spaces/HELP/pages/270172330/Automation+with+Paligo#Jenkins-Plugin-Download
updatePaligoContent contentId: '170410', updates: [
[
pattern: /nexus-jenkins-plugin-[-\d\.]+\.hpi/,
replacement: /nexus-jenkins-plugin-${version}.hpi/
]]
}
}
stage('Release JIRA Version') {
when {
expression { 'Production' == params?.environment }
}
steps {
// Release the Jira fix version for Integrations
jiraSetFixVersion(jira, version)
}
}
}
post {
always {
notifyChat(currentBuild: currentBuild, env: env, room: 'ops-builds')
notifyChat(currentBuild: currentBuild, env: env, room: 'int-builds')
deleteDir()
}
}
}