forked from eclipse-simrel/simrel.build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile-oomph-report
134 lines (123 loc) · 4.13 KB
/
Jenkinsfile-oomph-report
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
// Define global variables
// When the parameters change, this should be increased so that the build does nothing other than update the parameters used for the next build.
def pipelineVersion = '1'
def trainLocation = 'staging/2023-12'
pipeline {
agent {
node {
label 'centos-latest'
}
}
options {
timeout(time: 30, unit: 'MINUTES')
}
tools {
jdk 'openjdk-jdk11-latest'
}
environment {
TARGET_DIR = "archive"
}
parameters {
string(
name: 'PIPELINE_VERSION',
defaultValue: "${pipelineVersion}",
description: """${pretty(
'''
If the parameter definitions have changed, this version will be out-dated.
The script will run but will do nothing other than updating the parameter definitions of the job as a side-effect.
'''
)}""")
booleanParam(
name: 'PROMOTE',
defaultValue: false,
description: 'Whether to promote the repository report to /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo/archive.'
)
string(
name: 'TRAIN_LOCATION',
defaultValue: "${trainLocation}",
description: """${pretty(
'''
The repository https://download.eclipse.org/${TRAIN_LOCATION} for which to generate a report.
'''
)}""")
}
stages {
stage('Run Oomph repository analyzer') {
when {
environment name: 'PIPELINE_VERSION', value: pipelineVersion
not { environment name: 'BUILD_NUMBER', value: '1' }
}
steps {
script {
lock('staging-repository') {
if (params.PROMOTE) {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''
ssh genie.simrel@projects-storage.eclipse.org "
ls /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/
mkdir -p /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo
rm -rf /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo/archive
"
'''
}
}
sh '''
#!/bin/bash
mkdir -p ${TARGET_DIR}
wget -q https://download.eclipse.org/oomph/products/latest/eclipse-inst-jre-linux64.tar.gz
tar --warning=no-unknown-keyword -xf eclipse-inst-jre-linux64.tar.gz
PUBLISH_ARGUMENT=""
if [[ ${PROMOTE} == "true" ]]; then
echo "Promoting"
PUBLISH_ARGUMENT="-p ${TARGET_DIR}"
fi
OUTPUT="report"
set -o pipefail
eclipse-installer/eclipse-inst \
-application org.eclipse.oomph.p2.core.RepositoryIntegrityAnalyzer \
-consoleLog \
-noSplash \
-o ${OUTPUT} \
-s "${JOB_URL}" \
-v \
-t "tests" \
${PUBLISH_ARGUMENT} \
"https://download.eclipse.org/${TRAIN_LOCATION}" \
-vmargs \
-Dfile.encoding=UTF-8 \
-Dorg.eclipse.emf.ecore.plugin.EcorePlugin.doNotLoadResourcesPlugin=true \
-Xmx8g \
2>&1 | tee log
ls -sail *
'''
if (params.PROMOTE) {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''
scp -r archive genie.simrel@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo
'''
}
}
}
}
}
}
}
post {
always {
junit healthScaleFactor: 1.0, testResults: 'tests/*.xml'
archiveArtifacts artifacts: 'log, tests/*', fingerprint: true
}
failure {
emailext (
subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':
Check console output at ${env.BUILD_URL}""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
to: 'ed.merks@eclipse-foundation.org'
)
}
}
}
def pretty(string) {
return string.replaceAll("^\r?\n", "").replaceAll("\r?\n\$", "").replace("\r", "").stripIndent()
}