forked from zextras/carbonio-preview-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
executable file
·219 lines (212 loc) · 9.3 KB
/
Copy pathJenkinsfile
File metadata and controls
executable file
·219 lines (212 loc) · 9.3 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com
//
// SPDX-License-Identifier: AGPL-3.0-only
pipeline {
agent {
node {
label 'openjdk11-agent-v1'
}
}
environment {
LC_ALL = 'C.UTF-8'
jenkins_build = 'true'
}
parameters {
booleanParam defaultValue: false, description: 'Whether to upload the packages in playground repositories', name: 'PLAYGROUND'
}
options {
buildDiscarder(logRotator(numToKeepStr: '25'))
timeout(time: 2, unit: 'HOURS')
skipDefaultCheckout() // Do the checkout only manually because it is a heavy operation and it can lead to permission problems, conflicts etc
}
stages {
stage('Checkout') {
steps {
checkout scm
sh 'mkdir staging'
sh 'cp -r app package requirements.txt README.md setup.py staging'
stash includes: 'staging/**', name: 'staging'
}
}
stage('Build deb/rpm') {
stages {
stage('pacur') {
parallel {
stage('Ubuntu 20.04') {
agent {
node {
label 'pacur-agent-ubuntu-20.04-v1'
}
}
steps {
unstash 'staging'
sh 'cp -r staging /tmp'
sh 'sudo pacur build ubuntu /tmp/staging/package'
stash includes: 'artifacts/', name: 'artifacts-deb'
}
post {
always {
archiveArtifacts artifacts: 'artifacts/*.deb', fingerprint: true
}
}
}
stage('Rocky 8') {
agent {
node {
label 'pacur-agent-rocky-8-v1'
}
}
steps {
unstash 'staging'
sh 'cp -r staging /tmp'
sh 'sudo pacur build rocky /tmp/staging/package'
dir('artifacts/') {
sh 'echo carbonio-preview-ce* | sed -E "s#(carbonio-preview-ce-[0-9.]*).*#\\0 \\1.x86_64.rpm#" | xargs sudo mv'
}
stash includes: 'artifacts/', name: 'artifacts-rpm'
}
post {
always {
archiveArtifacts artifacts: 'artifacts/*.rpm', fingerprint: true
}
}
}
}
}
}
}
stage('Upload To Develop') {
when {
branch 'develop'
}
steps {
unstash 'artifacts-deb'
unstash 'artifacts-rpm'
script {
def server = Artifactory.server 'zextras-artifactory'
def buildInfo
def uploadSpec
buildInfo = Artifactory.newBuildInfo()
uploadSpec = '''{
"files": [
{
"pattern": "artifacts/*.deb",
"target": "ubuntu-devel/pool/",
"props": "deb.distribution=focal;deb.component=main;deb.architecture=amd64"
},
{
"pattern": "artifacts/(carbonio-preview-ce)-(*).rpm",
"target": "centos8-devel/zextras/{1}/{1}-{2}.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras"
}
]
}'''
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
}
}
}
stage('Upload To Playground') {
when {
anyOf {
branch 'playground/*'
expression { params.PLAYGROUND == true }
}
}
steps {
unstash 'artifacts-deb'
unstash 'artifacts-rpm'
script {
def server = Artifactory.server 'zextras-artifactory'
def buildInfo
def uploadSpec
buildInfo = Artifactory.newBuildInfo()
uploadSpec = '''{
"files": [
{
"pattern": "artifacts/carbonio-preview-ce*.deb",
"target": "ubuntu-playground/pool/",
"props": "deb.distribution=bionic;deb.distribution=focal;deb.component=main;deb.architecture=amd64"
},
{
"pattern": "artifacts/(carbonio-preview-ce)-(*).rpm",
"target": "centos8-playground/zextras/{1}/{1}-{2}.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras"
}
]
}'''
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
}
}
}
stage('Upload & Promotion Config') {
when {
anyOf {
branch 'release/*'
buildingTag()
}
}
steps {
unstash 'artifacts-deb'
unstash 'artifacts-rpm'
script {
def server = Artifactory.server 'zextras-artifactory'
def buildInfo
def uploadSpec
def config
//ubuntu
buildInfo = Artifactory.newBuildInfo()
buildInfo.name += '-ubuntu'
uploadSpec= '''{
"files": [
{
"pattern": "artifacts/carbonio-preview-ce*.deb",
"target": "ubuntu-rc/pool/",
"props": "deb.distribution=bionic;deb.distribution=focal;deb.component=main;deb.architecture=amd64"
}
]
}'''
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
config = [
'buildName' : buildInfo.name,
'buildNumber' : buildInfo.number,
'sourceRepo' : 'ubuntu-rc',
'targetRepo' : 'ubuntu-release',
'comment' : 'Do not change anything! Just press the button',
'status' : 'Released',
'includeDependencies': false,
'copy' : true,
'failFast' : true
]
Artifactory.addInteractivePromotion server: server, promotionConfig: config, displayName: 'Ubuntu Promotion to Release'
server.publishBuildInfo buildInfo
//centos8
buildInfo = Artifactory.newBuildInfo()
buildInfo.name += '-centos8'
uploadSpec= '''{
"files": [
{
"pattern": "artifacts/(carbonio-preview-ce)-(*).rpm",
"target": "centos8-rc/zextras/{1}/{1}-{2}.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras"
}
]
}'''
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
config = [
'buildName' : buildInfo.name,
'buildNumber' : buildInfo.number,
'sourceRepo' : 'centos8-rc',
'targetRepo' : 'centos8-release',
'comment' : 'Do not change anything! Just press the button',
'status' : 'Released',
'includeDependencies': false,
'copy' : true,
'failFast' : true
]
Artifactory.addInteractivePromotion server: server, promotionConfig: config, displayName: 'RHEL8 Promotion to Release'
server.publishBuildInfo buildInfo
}
}
}
}
}