Skip to content

Commit

Permalink
feat: deploy Maven snapshot builds
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Jul 19, 2024
1 parent 7d8690e commit 3449089
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 14 deletions.
44 changes: 30 additions & 14 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -59,5 +74,6 @@ pipeline {
}
}
}

}
}
4 changes: 4 additions & 0 deletions org.eclipse.tm4e.core.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<artifactId>org.eclipse.tm4e.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<build>
<pluginManagement>
<plugins>
Expand Down
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

<artifactId>org.eclipse.tm4e.feature</artifactId>
<packaging>eclipse-feature</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.language_pack.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

<artifactId>org.eclipse.tm4e.language_pack.feature</artifactId>
<packaging>eclipse-feature</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.language_pack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

<artifactId>org.eclipse.tm4e.language_pack</artifactId>
<packaging>eclipse-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
4 changes: 4 additions & 0 deletions org.eclipse.tm4e.languageconfiguration.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<artifactId>org.eclipse.tm4e.languageconfiguration.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<build>
<plugins>
<plugin>
Expand Down
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.languageconfiguration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

<artifactId>org.eclipse.tm4e.languageconfiguration</artifactId>
<packaging>eclipse-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.markdown/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

<artifactId>org.eclipse.tm4e.markdown</artifactId>
<packaging>eclipse-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

<artifactId>org.eclipse.tm4e.registry</artifactId>
<packaging>eclipse-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
4 changes: 4 additions & 0 deletions org.eclipse.tm4e.repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<artifactId>org.eclipse.tm4e.repository</artifactId>
<packaging>eclipse-repository</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<profiles>
<profile>
<id>sign</id>
Expand Down
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@

<artifactId>org.eclipse.tm4e.samples</artifactId>
<packaging>eclipse-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<artifactId>org.eclipse.tm4e.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<build>
<plugins>
<plugin>
Expand All @@ -19,4 +23,5 @@
</plugin>
</plugins>
</build>

</project>
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

<artifactId>org.eclipse.tm4e.ui</artifactId>
<packaging>eclipse-plugin</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>

0 comments on commit 3449089

Please sign in to comment.