diff --git a/Jenkinsfile b/Jenkinsfile index f0b65ebc4..04574dbe1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,50 +3,65 @@ pipeline { timeout(time: 20, unit: 'MINUTES') buildDiscarder(logRotator(numToKeepStr: '10')) } + agent { label 'centos-latest' } + tools { - maven 'apache-maven-latest' + maven 'apache-maven-latest' // https://wiki.eclipse.org/Jenkins#Apache_Maven jdk 'temurin-jdk17-latest' } + stages { + stage('initialize PGP') { + when { + branch 'main' + } steps { withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) { sh 'gpg --batch --import "${KEYRING}"' - sh 'for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u); do echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust; done' + sh 'for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u); do echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust; done' } } } + stage('Build') { steps { - // https://wiki.eclipse.org/Jenkins#Apache_Maven - withMaven(maven:'apache-maven-3.9.5', mavenLocalRepo: '$WORKSPACE/.m2/repository') { - withCredentials([string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_PASSPHRASE')]) { wrap([$class: 'Xvnc', useXauthority: true]) { - sh '''mvn clean verify \ - -Dmaven.test.failure.ignore=true \ - -Dsurefire.rerunFailingTestsCount=3 \ - -Psign -Dgpg.passphrase="${KEYRING_PASSPHRASE}" - ''' - }}} + script { + if (env.BRANCH_NAME == 'main') { + withCredentials([string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_PASSPHRASE')]) { + sh '''mvn clean deploy -B \ + -Dmaven.test.failure.ignore=true \ + -Dsurefire.rerunFailingTestsCount=3 \ + -Psign -Dgpg.passphrase="${KEYRING_PASSPHRASE}" + ''' + } + } else { + sh '''mvn clean verify -B \ + -Dmaven.test.failure.ignore=true \ + -Dsurefire.rerunFailingTestsCount=3 + ''' + } + } + } } post { always { - junit '*/target/surefire-reports/TEST-*.xml' archiveArtifacts artifacts: 'org.eclipse.tm4e.repository/target/repository/**/*,org.eclipse.tm4e.repository/target/*.zip,*/target/work/data/.metadata/.log' + junit '*/target/surefire-reports/TEST-*.xml' } } } + stage('Deploy Snapshot') { when { branch 'main' - // TODO deploy all branch from Eclipse.org Git repo } steps { sshagent (['projects-storage.eclipse.org-bot-ssh']) { - // TODO compute the target URL (snapshots) according to branch name (0.5-snapshots...) sh ''' DOWNLOAD_AREA=/home/data/httpd/download.eclipse.org/tm4e/snapshots/ echo DOWNLOAD_AREA=$DOWNLOAD_AREA @@ -59,5 +74,6 @@ pipeline { } } } + } } diff --git a/org.eclipse.tm4e.core.tests/pom.xml b/org.eclipse.tm4e.core.tests/pom.xml index 4b5e34e91..3e2dca2b0 100644 --- a/org.eclipse.tm4e.core.tests/pom.xml +++ b/org.eclipse.tm4e.core.tests/pom.xml @@ -11,6 +11,10 @@ org.eclipse.tm4e.core.tests eclipse-test-plugin + + true + + diff --git a/org.eclipse.tm4e.feature/pom.xml b/org.eclipse.tm4e.feature/pom.xml index 97e5c848b..e0e257443 100644 --- a/org.eclipse.tm4e.feature/pom.xml +++ b/org.eclipse.tm4e.feature/pom.xml @@ -10,4 +10,9 @@ org.eclipse.tm4e.feature eclipse-feature + + + true + + diff --git a/org.eclipse.tm4e.language_pack.feature/pom.xml b/org.eclipse.tm4e.language_pack.feature/pom.xml index bcfbb64ba..f8813f1dd 100644 --- a/org.eclipse.tm4e.language_pack.feature/pom.xml +++ b/org.eclipse.tm4e.language_pack.feature/pom.xml @@ -10,4 +10,9 @@ org.eclipse.tm4e.language_pack.feature eclipse-feature + + + true + + diff --git a/org.eclipse.tm4e.language_pack/pom.xml b/org.eclipse.tm4e.language_pack/pom.xml index c8a357fd0..fcc2492b8 100644 --- a/org.eclipse.tm4e.language_pack/pom.xml +++ b/org.eclipse.tm4e.language_pack/pom.xml @@ -10,4 +10,9 @@ org.eclipse.tm4e.language_pack eclipse-plugin + + + true + + diff --git a/org.eclipse.tm4e.languageconfiguration.tests/pom.xml b/org.eclipse.tm4e.languageconfiguration.tests/pom.xml index df03c4933..202acaf76 100644 --- a/org.eclipse.tm4e.languageconfiguration.tests/pom.xml +++ b/org.eclipse.tm4e.languageconfiguration.tests/pom.xml @@ -11,6 +11,10 @@ org.eclipse.tm4e.languageconfiguration.tests eclipse-test-plugin + + true + + diff --git a/org.eclipse.tm4e.languageconfiguration/pom.xml b/org.eclipse.tm4e.languageconfiguration/pom.xml index bd2ee4793..0fc1ec61b 100644 --- a/org.eclipse.tm4e.languageconfiguration/pom.xml +++ b/org.eclipse.tm4e.languageconfiguration/pom.xml @@ -10,4 +10,9 @@ org.eclipse.tm4e.languageconfiguration eclipse-plugin + + + true + + diff --git a/org.eclipse.tm4e.markdown/pom.xml b/org.eclipse.tm4e.markdown/pom.xml index 2653471e4..2cd34d2a0 100644 --- a/org.eclipse.tm4e.markdown/pom.xml +++ b/org.eclipse.tm4e.markdown/pom.xml @@ -10,4 +10,9 @@ org.eclipse.tm4e.markdown eclipse-plugin + + + true + + diff --git a/org.eclipse.tm4e.registry/pom.xml b/org.eclipse.tm4e.registry/pom.xml index a7e8704d0..837b7234b 100644 --- a/org.eclipse.tm4e.registry/pom.xml +++ b/org.eclipse.tm4e.registry/pom.xml @@ -10,4 +10,9 @@ org.eclipse.tm4e.registry eclipse-plugin + + + true + + diff --git a/org.eclipse.tm4e.repository/pom.xml b/org.eclipse.tm4e.repository/pom.xml index d2d077481..2e26cd925 100644 --- a/org.eclipse.tm4e.repository/pom.xml +++ b/org.eclipse.tm4e.repository/pom.xml @@ -11,6 +11,10 @@ org.eclipse.tm4e.repository eclipse-repository + + true + + sign diff --git a/org.eclipse.tm4e.samples/pom.xml b/org.eclipse.tm4e.samples/pom.xml index abab9c89c..b2c915941 100644 --- a/org.eclipse.tm4e.samples/pom.xml +++ b/org.eclipse.tm4e.samples/pom.xml @@ -9,4 +9,9 @@ org.eclipse.tm4e.samples eclipse-plugin + + + true + + diff --git a/org.eclipse.tm4e.ui.tests/pom.xml b/org.eclipse.tm4e.ui.tests/pom.xml index 63fee1896..bf1fdbc0a 100644 --- a/org.eclipse.tm4e.ui.tests/pom.xml +++ b/org.eclipse.tm4e.ui.tests/pom.xml @@ -11,6 +11,10 @@ org.eclipse.tm4e.ui.tests eclipse-test-plugin + + true + + @@ -19,4 +23,5 @@ + diff --git a/org.eclipse.tm4e.ui/pom.xml b/org.eclipse.tm4e.ui/pom.xml index 80278114a..3fa420d16 100644 --- a/org.eclipse.tm4e.ui/pom.xml +++ b/org.eclipse.tm4e.ui/pom.xml @@ -10,4 +10,9 @@ org.eclipse.tm4e.ui eclipse-plugin + + + true + +