forked from eclipse-cbi/targetplatform-dsl
/
Jenkinsfile
183 lines (172 loc) · 6.65 KB
/
Jenkinsfile
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
pipeline {
agent {
label 'jipp-migration'
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
checkoutToSubdirectory('scm')
disableConcurrentBuilds()
timestamps()
}
tools {
maven 'apache-maven-latest'
jdk 'openjdk-jdk11-latest'
}
environment {
PUBLISH_LOCATION = 'cbi/updates'
}
parameters {
choice(
name: 'BUILD_TYPE',
choices: ['nightly', 'milestone', 'release'],
description: '''
Choose the type of build.
Note that a release build will not promote the build, but rather will promote the most recent milestone build.
'''
)
booleanParam(
name: 'PROMOTE',
defaultValue: false,
description: 'Whether to promote the build to the download server.'
)
booleanParam(
name: 'ARCHIVE',
defaultValue: false,
description: 'Whether to archive the workspace.'
)
}
stages {
stage('Display Parameters') {
steps {
echo "BUILD_TYPE=${params.BUILD_TYPE}"
echo "PROMOTE=${params.PROMOTE}"
echo "ARCHIVE=${params.ARCHIVE}"
echo "GIT_COMMIT=${env.GIT_COMMIT}"
script {
env.PROMOTE = params.PROMOTE
env.BUILD_TYPE = params.BUILD_TYPE
}
}
}
stage('Build') {
steps {
dir('scm') {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh '''
if [[ $PROMOTE == false ]]; then
promotion_argument='-Dorg.eclipse.justj.p2.manager.args='
fi
mvn \
-B \
-Ptarget-default \
-Peclipse-sign \
$promotion_argument \
-Dorg.eclipse.storage.user=genie.cbi \
-Dorg.eclipse.justj.p2.manager.build.url=$JOB_URL \
-Dorg.eclipse.download.location.relative=$PUBLISH_LOCATION \
-Dorg.eclipse.justj.p2.manager.relative= \
-Dbuild.type=$BUILD_TYPE \
-Dgit.commit=$GIT_COMMIT \
-Dbuild.id=$BUILD_NUMBER \
clean \
install \
'''
}
}
}
}
}
/*
stage('Tests against 4.5 - Mars') {
steps {
dir('4.5') {
sh 'cp -rf ../scm/* . && cp -rf ../scm/.git .'
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh 'mvn -B clean verify -Ptarget-4_5-mars'
}
}
}
}
stage('Tests against 4.6 - Neon') {
steps {
dir('4.6') {
sh 'cp -rf ../scm/* . && cp -rf ../scm/.git .'
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh 'mvn -B clean verify -Ptarget-4_6-neon'
}
}
}
}
stage('Tests against 4.7 - Oxygen') {
steps {
dir('4.7') {
sh 'cp -rf ../scm/* . && cp -rf ../scm/.git .'
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh 'mvn -B clean verify -Ptarget-4_7-oxygen'
}
}
}
}
stage('Tests against 4.8 - Photon') {
steps {
dir('4.8') {
sh 'cp -rf ../scm/* . && cp -rf ../scm/.git .'
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh 'mvn -B clean verify -Ptarget-4_8-photon'
}
}
}
}
*/
/*
stage('Deploy') {
steps {
dir('scm') {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh '''
POM_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:3.1.0:exec)
DEPLOY_PATH="/home/data/httpd/download.eclipse.org/cbi/tpd/${POM_VERSION}"
ssh genie.cbi@projects-storage.eclipse.org<<ENDSSH
mkdir -p "${DEPLOY_PATH}.new"
rm -rf "${DEPLOY_PATH}.new/*"
ENDSSH
scp org.eclipse.cbi.targetplatform-update/target/org.eclipse.cbi.targetplatform-*.zip genie.cbi@projects-storage.eclipse.org:"${DEPLOY_PATH}.new/"
scp -r org.eclipse.cbi.targetplatform-update/target/repository/* genie.cbi@projects-storage.eclipse.org:"${DEPLOY_PATH}.new/"
ssh genie.cbi@projects-storage.eclipse.org <<ENDSSH
mv "${DEPLOY_PATH}" "${DEPLOY_PATH}.old"
mv "${DEPLOY_PATH}.new" "${DEPLOY_PATH}"
rm -rf "${DEPLOY_PATH}.old"
ENDSSH
'''
}
}
}
}
*/
stage('Archive Results') {
when {
expression {
params.ARCHIVE
}
}
steps {
archiveArtifacts 'scm/**'
}
}
}
post {
failure {
mail to: 'releng-team@eclipse-foundation.org',
subject: "[CBI-TPD] Build Failure ${currentBuild.fullDisplayName}",
mimeType: 'text/html',
body: "Project: ${env.JOB_NAME}<br/>Build Number: ${env.BUILD_NUMBER}<br/>Build URL: ${env.BUILD_URL}<br/>Console: ${env.BUILD_URL}/console"
}
fixed {
mail to: 'releng-team@eclipse-foundation.org',
subject: "[CBI-TPD] Back to normal ${currentBuild.fullDisplayName}",
mimeType: 'text/html',
body: "Project: ${env.JOB_NAME}<br/>Build Number: ${env.BUILD_NUMBER}<br/>Build URL: ${env.BUILD_URL}<br/>Console: ${env.BUILD_URL}/console"
}
}
}