blob: 11e156eb7ab191066fb7c5e7d4f9436c2db944c4 [file] [log] [blame]
Ed Merks40febf72022-11-29 17:07:11 +01001// The pom.xml can be modified and its contents can copied into pom variable below to test out a modified pom.xml before checking it in.
2def pom = '''\
3'''
4
Frederic Gurr78838f92018-07-06 19:06:02 +02005pipeline {
Ed Merks40febf72022-11-29 17:07:11 +01006 agent any
Frederic Gurr78838f92018-07-06 19:06:02 +02007 tools {
Ed Merks40febf72022-11-29 17:07:11 +01008 jdk 'temurin-jdk17-latest'
Frederic Gurr0872f172019-03-20 18:17:17 +01009 maven 'apache-maven-latest'
Frederic Gurr78838f92018-07-06 19:06:02 +020010 }
Frederic Gurr5da031c2020-12-10 20:24:07 +010011 options {
12 disableConcurrentBuilds()
13 timeout(time: 3, unit: 'HOURS')
Frederic Gurr906eec32021-05-04 21:04:47 +020014 timestamps ()
Frederic Gurr5da031c2020-12-10 20:24:07 +010015 }
Frederic Gurr76a99732018-07-17 19:41:06 +020016 environment {
Ed Merksf72c8f02023-09-13 15:43:11 +020017 TRAIN_NAME = "2023-12"
Frederic Gurr76a99732018-07-17 19:41:06 +020018 STAGING_DIR = "/home/data/httpd/download.eclipse.org/staging/${TRAIN_NAME}"
19 }
Ed Merksdecbf642022-06-21 09:24:15 +020020 parameters {
21 choice(
22 name: 'CBI_TYPE',
23 choices: ['nightly/latest', 'milestone/latest', 'release/latest'],
24 description: '''
25 Choose the type of CBI p2 Aggregator products build to use for aggregation, i.e., the relative path in the <a href="https://download.eclipse.org/cbi/updates/p2-aggregator/products/">products folder</a>.
26 '''
27 )
Ed Merksb12413b2022-11-14 11:36:02 +010028
Ed Merksdecbf642022-06-21 09:24:15 +020029 booleanParam(
30 name: 'PROMOTE',
Ed Merks6ccc6172022-06-21 09:42:12 +020031 defaultValue: true,
Ed Merksdecbf642022-06-21 09:24:15 +020032 description: 'Whether to promote the build to the download server.'
33 )
Ed Merksb12413b2022-11-14 11:36:02 +010034
35 booleanParam(
36 name: 'PGP_SIGN',
Ed Merks214cc6a2022-12-01 06:49:42 +010037 defaultValue: true,
Ed Merksb12413b2022-11-14 11:36:02 +010038 description: 'Whether to PGP sign the repository contents.'
39 )
Ed Merksdecbf642022-06-21 09:24:15 +020040 }
Ed Merks40febf72022-11-29 17:07:11 +010041
Frederic Gurr78838f92018-07-06 19:06:02 +020042 stages {
Ed Merksb12413b2022-11-14 11:36:02 +010043 stage('Setup Environment') {
44 steps {
45 script {
46 env.PGP_SIGN = params.PGP_SIGN
47 env.CBI_TYPE = params.CBI_TYPE
48 env.PROMOTE = params.PROMOTE
49 env.PGP_MVN_ARGUMENTS = ''
Ed Merksb12413b2022-11-14 11:36:02 +010050 if (params.PGP_SIGN) {
Ed Merks6a9e16d2023-07-11 07:55:39 +020051 env.PGP_MVN_ARGUMENTS = '-Pgpg-sign -Dtycho-version=4.0.0'
Ed Merksb12413b2022-11-14 11:36:02 +010052 }
53 }
54 }
55 }
Ed Merks40febf72022-11-29 17:07:11 +010056 stage('Git Checkout') {
57 when {
58 expression {
59 // This stage is useful for testing changes to the pipeline.
60 // The changes can be pasted into a pipeline job to test them before committing them.
61 false
62 }
63 }
64 steps {
65 script {
66 def gitVariables = checkout(
67 poll: false,
68 scm: [
69 $class: 'GitSCM',
70 branches: [[name: '*/master']],
71 doGenerateSubmoduleConfigurations: false,
72 submoduleCfg: [],
73 userRemoteConfigs: [[url: 'https://git.eclipse.org/r/simrel/org.eclipse.simrel.build.git']]
74 ]
75 )
76 echo "$gitVariables"
77 env.GIT_COMMIT = gitVariables.GIT_COMMIT
Ed Merksbe5aa762022-11-13 13:05:41 +010078 }
Ed Merks40febf72022-11-29 17:07:11 +010079 }
Ed Merksbe5aa762022-11-13 13:05:41 +010080 }
Frederic Gurr78838f92018-07-06 19:06:02 +020081 stage('Build clean') {
82 steps {
Ed Merks40febf72022-11-29 17:07:11 +010083 script {
84 if (pom.trim().length() > 0) {
85 writeFile file: 'pom.xml', text: pom
86 }
87 }
88 withCredentials([
89 file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING'),
90 string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_PASSPHRASE')]) {
Ed Merksbe5aa762022-11-13 13:05:41 +010091 sh '''
Ed Merks40febf72022-11-29 17:07:11 +010092 java -version
93 mvn \
94 -Dtycho.pgp.signer="bc" \
95 -Dtycho.pgp.signer.bc.secretKeys="${KEYRING}" \
96 -Dgpg.passphrase="${KEYRING_PASSPHRASE}" \
97 -Pbuild \
98 ${PGP_MVN_ARGUMENTS} \
99 clean \
100 verify
Ed Merksbe5aa762022-11-13 13:05:41 +0100101 '''
102 }
103 // archiveArtifacts 'target/repository/final/**'
Frederic Gurr78838f92018-07-06 19:06:02 +0200104 }
105 }
Frederic Gurr76a99732018-07-17 19:41:06 +0200106 stage('Deploy to staging') {
Ed Merksdecbf642022-06-21 09:24:15 +0200107 when {
108 expression {
109 params.PROMOTE
110 }
111 }
Frederic Gurr76a99732018-07-17 19:41:06 +0200112 steps {
Ed Merks40febf72022-11-29 17:07:11 +0100113 sshagent(['projects-storage.eclipse.org-bot-ssh']) {
Ed Merks528c23d2023-05-31 08:59:29 +0200114 script {
115 lock('staging-repository') {
116 sh '''
117 ssh genie.simrel@projects-storage.eclipse.org "
118 mkdir -p ${STAGING_DIR}
119 rm -rf ${STAGING_DIR}/*
120 "
121 scp -r ${WORKSPACE}/target/repository/final/* genie.simrel@projects-storage.eclipse.org:${STAGING_DIR}/
122 ssh genie.simrel@projects-storage.eclipse.org "
123 ls -sail ${STAGING_DIR}
124 "
125 '''
126 }
127 }
Ed Merks40febf72022-11-29 17:07:11 +0100128 }
Frederic Gurr76a99732018-07-17 19:41:06 +0200129 // Trigger EPP job
Frederic Gurr7dbec6f2021-05-11 17:08:38 +0200130 sh 'curl "https://ci.eclipse.org/packaging/job/simrel.epp-tycho-build/buildWithParameters?delay=600sec&token=Yah6CohtYwO6b?6P"'
Frederic Gurr76a99732018-07-17 19:41:06 +0200131 }
Ed Merksdecbf642022-06-21 09:24:15 +0200132 }
133 stage('Start repository analysis') {
134 when {
135 expression {
136 params.PROMOTE
137 }
138 }
Frederic Gurr79afd232019-12-18 16:16:10 +0100139 steps {
Ed Merksf5435882022-10-09 13:44:41 +0200140 build job: 'simrel.oomph.repository-analyzer.test',
141 parameters: [
Ed Merks0f969822022-10-09 14:02:47 +0200142 booleanParam(name: 'PROMOTE', value: true),
143 string(name: 'TRAIN_LOCATION', value: "staging/${env.TRAIN_NAME}")
Ed Merks40febf72022-11-29 17:07:11 +0100144 ],
Ed Merksf5435882022-10-09 13:44:41 +0200145 wait: false
Frederic Gurr79afd232019-12-18 16:16:10 +0100146 }
Ed Merksdecbf642022-06-21 09:24:15 +0200147 }
Frederic Gurr78838f92018-07-06 19:06:02 +0200148 }
Frederic Gurrbf9a4332018-09-12 18:43:29 +0200149 post {
150 failure {
151 emailext (
152 subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
Frederic Gurr5e0eeb72018-12-19 18:36:21 +0100153 body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':
154 Check console output at ${env.BUILD_URL}""",
Frederic Gurrbf9a4332018-09-12 18:43:29 +0200155 recipientProviders: [[$class: 'DevelopersRecipientProvider']],
Ed Merks142e3382022-06-15 11:51:21 +0200156 to: 'ed.merks@eclipse-foundation.org'
Frederic Gurrbf9a4332018-09-12 18:43:29 +0200157 )
Frederic Gurrca88a942020-12-17 12:19:05 +0100158 archiveArtifacts artifacts: 'target/eclipserun-work/configuration/*.log', allowEmptyArchive: true
Frederic Gurrbf9a4332018-09-12 18:43:29 +0200159 }
Frederic Gurre4f5e3e2018-09-12 18:08:11 +0200160 }
Nitin Dahyabhai5c1f3822021-08-05 18:33:47 -0400161}