blob: fb19b42607aa3d925109c6fe7c3140d31570f6a5 [file] [log] [blame]
Ed Merksf5435882022-10-09 13:44:41 +02001// Define global variables
2
3// When the parameters change, this should be increased so that the build does nothing other than update the parameters used for the next build.
4def pipelineVersion = '1'
5def trainLocation = 'staging/2022-12'
6
7pipeline {
8 agent {
9 node {
10 label 'centos-latest'
11 }
12 }
13 options {
14 timeout(time: 30, unit: 'MINUTES')
15 }
16 tools {
17 jdk 'openjdk-jdk11-latest'
18 }
19 environment {
20 TARGET_DIR = "archive"
21 }
22 parameters {
23 string(
24 name: 'PIPELINE_VERSION',
25 defaultValue: "${pipelineVersion}",
26 description: """${pretty(
27 '''
28 If the parameter definitions have changed, this version will be out-dated.
29 The script will run but will do nothing other than updating the parameter definitions of the job as a side-effect.
30 '''
31 )}""")
32 booleanParam(
33 name: 'PROMOTE',
34 defaultValue: false,
Ed Merkse67bedf2022-10-23 12:15:13 +020035 description: 'Whether to promote the repository report to /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo/archive.'
Ed Merksf5435882022-10-09 13:44:41 +020036 )
37 string(
38 name: 'TRAIN_LOCATION',
39 defaultValue: "${trainLocation}",
40 description: """${pretty(
41 '''
42 The repository https://download.eclipse.org/${TRAIN_LOCATION} for which to generate a report.
43 '''
44 )}""")
45 }
46 stages {
47 stage('Run Oomph repository analyzer') {
48 when {
49 environment name: 'PIPELINE_VERSION', value: pipelineVersion
50 not { environment name: 'BUILD_NUMBER', value: '1' }
51 }
52 steps {
Ed Merksc5fa4782022-10-09 15:26:53 +020053 script {
54 if (params.PROMOTE) {
55 sshagent(['projects-storage.eclipse.org-bot-ssh']) {
56 sh '''
57 ssh genie.simrel@projects-storage.eclipse.org "
58 ls /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/
59 mkdir -p /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo
60 rm -rf /home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo/archive
61 "
62 '''
63 }
64 }
Ed Merksf5435882022-10-09 13:44:41 +020065 }
66
67 sh '''
68 #!/bin/bash
69 mkdir -p ${TARGET_DIR}
70
71 wget -q https://download.eclipse.org/oomph/products/latest/eclipse-inst-jre-linux64.tar.gz
72 tar -xf eclipse-inst-jre-linux64.tar.gz
73
74 PUBLISH_ARGUMENT=""
75 if [[ ${PROMOTE} == "true" ]]; then
76 echo "Promoting"
77 PUBLISH_ARGUMENT="-p ${TARGET_DIR}"
78 fi
79
80 OUTPUT="report"
81
82 set -o pipefail
83
84 eclipse-installer/eclipse-inst \
85 -application org.eclipse.oomph.p2.core.RepositoryIntegrityAnalyzer \
86 -consoleLog \
87 -noSplash \
88 -o ${OUTPUT} \
89 -s "${JOB_URL}" \
90 -v \
91 -t "tests" \
92 ${PUBLISH_ARGUMENT} \
93 "https://download.eclipse.org/${TRAIN_LOCATION}" \
94 -vmargs \
95 -Dfile.encoding=UTF-8 \
96 -Dorg.eclipse.emf.ecore.plugin.EcorePlugin.doNotLoadResourcesPlugin=true \
97 -Xmx8g \
98 2>&1 | tee log
99
100 ls -sail *
101 '''
102
Ed Merksc5fa4782022-10-09 15:26:53 +0200103 script {
104 if (params.PROMOTE) {
105 sshagent(['projects-storage.eclipse.org-bot-ssh']) {
106 sh '''
107 scp -r archive genie.simrel@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/${TRAIN_LOCATION}/buildInfo
108 '''
109 }
110 }
Ed Merksf5435882022-10-09 13:44:41 +0200111 }
Ed Merksf5435882022-10-09 13:44:41 +0200112 }
113 }
114 }
Ed Merks5d325f92022-10-09 15:01:03 +0200115 post {
116 always {
117 junit healthScaleFactor: 1.0, testResults: 'tests/*.xml'
118 archiveArtifacts artifacts: 'log, tests/*', fingerprint: true
119 }
Ed Merksc5fa4782022-10-09 15:26:53 +0200120 failure {
121 emailext (
122 subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
123 body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':
124 Check console output at ${env.BUILD_URL}""",
125 recipientProviders: [[$class: 'DevelopersRecipientProvider']],
126 to: 'ed.merks@eclipse-foundation.org'
127 )
128 }
Ed Merks5d325f92022-10-09 15:01:03 +0200129 }
Ed Merksf5435882022-10-09 13:44:41 +0200130}
131
132def pretty(string) {
133 return string.replaceAll("^\r?\n", "").replaceAll("\r?\n\$", "").replace("\r", "").stripIndent()
134}