Skip to content

Commit

Permalink
Reuse org.eclipse.justj.p2.manager for promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Dec 13, 2023
1 parent ac03e35 commit 7ad1a39
Show file tree
Hide file tree
Showing 5 changed files with 338 additions and 151 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*/*/bin/
/target
/*/*/target
/promotion/target
/gef-updates
*~
*.rej
*.bak
Expand All @@ -9,9 +11,9 @@ heapdump.*
core.*
Snap.*
/.settings/
/.project
.DS_Store
.polyglot.META-INF
*.class
.polyglot*.xml
build.log

22 changes: 22 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.gef.root</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
<filteredResources>
<filter>
<id>1702458489811</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-projectRelativePath-matches-false-true-org.eclipse.*/.*|target-platform/.*</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
209 changes: 148 additions & 61 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,150 @@
pipeline {
options {
timeout(time: 240, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr:'20'))
disableConcurrentBuilds(abortPrevious: true)
}
agent {
label "centos-7"
}
tools {
maven 'apache-maven-latest'
jdk 'openjdk-jdk17-latest'
}
stages {

stage('Build') {
steps {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh '''
export GDK_BACKEND=x11
mvn clean verify -Dmaven.repo.local=$WORKSPACE/.m2/repository \
-DapiBaselineTargetDirectory=${WORKSPACE} \
-Dgpg.passphrase="${KEYRING_PASSPHRASE}" \
-Dproject.build.sourceEncoding=UTF-8 \
-Peclipse-sign
'''
}
}
post {
always {
archiveArtifacts artifacts: '.*log,org.eclipse.gef.repository/target/repository/*', allowEmptyArchive: true
junit(
allowEmptyResults: true,
testResults: '**/target/surefire-reports/*.xml'
)
}
failure {
script {
if (env.BRANCH_NAME == 'master') {
mail bcc: '', body: "<b>GEF Classic: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "ERROR CI: GEF Classic -> ${env.JOB_NAME}", to: "alois.zoitl@gmx.at";
}
}
}
}

}
stage('Deploy') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh '''
ssh -o BatchMode=yes genie.gef@projects-storage.eclipse.org rm -rf /home/data/httpd/download.eclipse.org/tools/gef/classic/latest
ssh -o BatchMode=yes genie.gef@projects-storage.eclipse.org mkdir -p /home/data/httpd/download.eclipse.org/tools/gef/classic/latest
scp -o BatchMode=yes -r org.eclipse.gef.repository/target/repository/* genie.gef@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/tools/gef/classic/latest
'''
}
}
}
}
agent {
label "centos-latest"
}

options {
timeout(time: 240, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
}

tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk17-latest'
}

environment {
BUILD_TIMESTAMP = sh(returnStdout: true, script: 'date +%Y%m%d%H%M').trim()
MAIN_BRANCH = 'issue-313'
BRANCH_NAME = 'issue-313' // TODO REMOVE
}

parameters {
choice(
name: 'BUILD_TYPE',
choices: ['nightly', 'milestone', 'release'],
description: '''
Choose the type of build.
Note that a release build will <b>not</b> promote the build, but rather will promote the most recent milestone build.
'''
)

booleanParam(
name: 'ECLIPSE_SIGN',
defaultValue: true,
description: '''
Choose whether or not the bundles will be signed.
This is relevant only for nightly and milestone builds.
'''
)

booleanParam(
name: 'PROMOTE',
defaultValue: false,
description: 'Whether to promote the build to the download server.'
)
}

stages {
stage('Display Parameters') {
steps {
script {
env.BUILD_TYPE = params.BUILD_TYPE
if (env.BRANCH_NAME == env.MAIN_BRANCH) {
// Only sign the master branch.
//
env.ECLIPSE_SIGN = params.ECLIPSE_SIGN
} else {
// Do not sign PR builds.
env.ECLIPSE_SIGN = false
}

// Only promote signed builds, i.e., do not sign or promote PR builds.
//
env.PROMOTE = params.PROMOTE && (env.ECLIPSE_SIGN == 'true')

def description = """
BUILD_TIMESTAMP=${env.BUILD_TIMESTAMP}
BUILD_TYPE=${env.BUILD_TYPE}
ECLIPSE_SIGN=${env.ECLIPSE_SIGN}
PROMOTE=${env.PROMOTE}
BRANCH_NAME=${env.BRANCH_NAME}
""".trim()
echo description
currentBuild.description = description.replace("\n", "<br/>")
}
}
}

stage('Build GEF') {
steps {
script {
if (env.PROMOTE == 'true') {
// Only provide an agent context, which allows uploading to download.eclipse.org if we are promoting.
// PR builds are not permitted to promote.
//
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
mvn()
}
} else {
mvn()
archiveArtifacts 'org.eclipse.gef.repository/**'
}
}
}
}
}
}
}

post {
always {
junit allowEmptyResults: true, testResults: '**/TEST-*.xml'
}

failure {
archiveArtifacts '**'
mail to: 'ed.merks@gmail.com',
subject: "[GEF CI] 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: 'ed.merks@gmail.com',
subject: "[GEF CI] 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"
}

cleanup {
deleteDir()
}
}
}

def void mvn() {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
// Only promoted builds will be signed.
//
sh '''
if [[ $PROMOTE == true ]]; then
promotion_argument='-Ppromote -Peclipse-sign'
fi
mvn \
$promotion_argument \
--no-transfer-progress \
-DapiBaselineTargetDirectory=${WORKSPACE} \
-Dmaven.repo.local=$WORKSPACE/.m2/repository \
-Dproject.build.sourceEncoding=UTF-8 \
-Dbuild.id=${BUILD_TIMESTAMP} \
-Dcommit.id=$GIT_COMMIT \
-Dbuild.type=$BUILD_TYPE \
-Dorg.eclipse.justj.p2.manager.build.url=$JOB_URL \
-Dorg.eclipse.justj.p2.manager.relative=gef/classic \
-Dorg.eclipse.justj.p2.manager.target=modeling/emf/emf/archive \
-Dorg.eclipse.storage.user=genie.emf \
clean \
verify
'''
}
}

0 comments on commit 7ad1a39

Please sign in to comment.