-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
108 lines (102 loc) · 3.85 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
pipeline {
options {
timeout(time: 240, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr:'5'))
disableConcurrentBuilds(abortPrevious: true)
timestamps()
}
agent {
label "centos-latest-8gb"
}
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk21-latest'
}
stages {
stage('Use master') {
steps {
sh 'git submodule foreach "git fetch origin master; git checkout FETCH_HEAD"'
}
}
stage('Deploy parent-pom and SDK-target') {
when {
anyOf {
branch 'master'
branch 'R*_maintenance'
branch 'prepare_R*'
}
}
steps {
sh 'mvn clean deploy -f eclipse-platform-parent/pom.xml'
sh 'mvn clean deploy -f eclipse.platform.releng.prereqs.sdk/pom.xml'
}
}
stage('Deploy RelEng scripts') {
when {
allOf {
branch 'master'
expression { // Only deploy scripts on actual changes in the deployed folders
return !sh(script:'''
latestCommitID=$(curl https://download.eclipse.org/eclipse/relengScripts/state)
git diff --name-only ${latestCommitID} HEAD \\
production/ scripts/ cje-production/ eclipse.platform.releng.tychoeclipsebuilder/
''', returnStdout: true).trim().isEmpty()
}
}
}
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''
serverBase='/home/data/httpd/download.eclipse.org/eclipse'
serverStaging="${serverBase}/relengScripts-staging"
ssh [email protected] rm -rf ${serverStaging}
ssh [email protected] mkdir -p ${serverStaging}
scp -r production [email protected]:${serverStaging}
scp -r scripts [email protected]:${serverStaging}
scp -r cje-production [email protected]:${serverStaging}
scp -r eclipse.platform.releng.tychoeclipsebuilder/eclipse/buildScripts [email protected]:${serverStaging}
scp -r eclipse.platform.releng.tychoeclipsebuilder/entitlement [email protected]:${serverStaging}
# Create state file that contains the current commitID for later diffs in this stage's conditional
commitID=$(git rev-parse HEAD)
ssh [email protected] "echo ${commitID}>${serverStaging}/state"
# To minimize 'downtime', all files are first transfered to a staging folder on the server,
# then the existing folder is moved to 'disposal' and the 'staging' to the desired target.
# Eventually the previously existing content is deleted with the 'disposal'-folder.
serverTarget="${serverBase}/relengScripts"
serverDisposal="${serverBase}/relengScripts-disposal"
ssh [email protected] "\
mv -f ${serverTarget} ${serverDisposal} ;\
mv -f ${serverStaging} ${serverTarget} &&\
rm -rf ${serverDisposal}"
'''
}
}
}
stage('Build') {
when { not { branch pattern: "prepare_R.*", comparator: "REGEXP" } }
steps {
sh '''
mvn clean install -pl :eclipse-sdk-prereqs,:org.eclipse.jdt.core.compiler.batch -DlocalEcjVersion=99.99 -Dmaven.repo.local=$WORKSPACE/.m2/repository -U
mvn clean verify -e -Dmaven.repo.local=$WORKSPACE/.m2/repository \
-T 1C \
-Pbree-libs \
-DskipTests=true \
-Dcompare-version-with-baselines.skip=false \
-DapiBaselineTargetDirectory=${WORKSPACE} \
-Dgpg.passphrase="${KEYRING_PASSPHRASE}" \
-Dcbi-ecj-version=99.99 \
-U
'''
}
post {
always {
archiveArtifacts allowEmptyArchive: true, artifacts: '\
.*log,*/target/work/data/.metadata/.*log,\
*/tests/target/work/data/.metadata/.*log,\
apiAnalyzer-workspace/.metadata/.*log,\
eclipse.platform.releng.tychoeclipsebuilder/eclipse.platform.repository/target/repository/*'
}
}
}
}
}