Skip to content

Commit 3541e81

Browse files
committed
[Build] Use best practices in Maven artifact singing and use BC signer
Passing the 'MAVEN_GPG_PASSPHRASE' as environment variable fixes many build warnings like the following: ''' [WARNING] Do not store passphrase in any file (disk or SCM repository), [WARNING] instead rely on GnuPG agent or provide passphrase in [WARNING] MAVEN_GPG_PASSPHRASE environment variable for batch mode. ''' Additionally using the Bouncy Castle (BC) signer is faster and simplifies the setup as it can use the key-file directly in its armored form and thus avoids the separate import step.
1 parent e759393 commit 3541e81

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

JenkinsJobs/Releng/publishToMaven.jenkinsfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pipeline {
2020
PATH = "${installMavenDaemon('1.0.2')}/bin:${PATH}"
2121
// Folder ~/.m2 is not writable for builds, ensure mvnd metadata are written within the workspace.
2222
// prevent jline warning about inability to create a system terminal and increase keep-alive timeouts to increase stability in concurrent usage
23-
MVND = "mvnd -Dmvnd.daemonStorage=${WORKSPACE}/tools/mvnd -Dorg.jline.terminal.type=dumb -Dmvnd.keepAlive=1000 -Dmvnd.maxLostKeepAlive=100"
23+
MVND = "mvnd -Dmvnd.daemonStorage=${WORKSPACE}/tools/mvnd -Dorg.jline.terminal.type=dumb -Dmvnd.keepAlive=1000 -Dmvnd.maxLostKeepAlive=600"
2424
ECLIPSE = "${installLatestEclipse()}"
2525
URL_AGG_UPDATES = 'https://download.eclipse.org/cbi/updates/p2-aggregator/products/nightly/latest'
2626
}
@@ -174,15 +174,11 @@ pipeline {
174174
// The location of the temporarily file that contains the secret file content
175175
// (see https://www.jenkins.io/doc/book/pipeline/syntax/#supported-credentials-type):
176176
KEYRING = credentials("secret-subkeys-${PROJECT == 'platform' ? 'releng': PROJECT}.asc")
177+
MAVEN_GPG_PASSPHRASE = credentials("secret-subkeys-${PROJECT == 'platform' ? 'releng': PROJECT}.asc-passphrase")
177178
}
178179
steps {
179180
dir("publish-${PROJECT}"){
180181
sh '''#!/bin/sh -xe
181-
gpg --batch --import "${KEYRING}"
182-
for fpr in $(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | sort -u); do
183-
echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust
184-
done
185-
186182
# Copy configuration pom into clean directory to stop maven from finding the .mvn folder of this git-repository
187183
cp "${WORKSPACE}/git-repo/eclipse-platform-parent/pom.xml" eclipse-parent-pom.xml
188184

@@ -240,6 +236,7 @@ pipeline {
240236

241237
${MVND} -f eclipse-parent-pom.xml -s ${SETTINGS} \\
242238
gpg:sign-and-deploy-file -DretryFailedDeploymentCount=5 \\
239+
-Dgpg.signer=bc -Dgpg.keyFilePath=${KEYRING} \\
243240
-Durl=${URL} -DrepositoryId=${REPO_ID} \\
244241
-DpomFile=${pomFile} -Dfile=${file} \\
245242
${SOURCES_ARG} ${JAVADOC_ARG}

eclipse-platform-parent/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,9 @@
714714
<groupId>org.apache.maven.plugins</groupId>
715715
<artifactId>maven-gpg-plugin</artifactId>
716716
<version>3.2.7</version>
717+
<configuration>
718+
<bestPractices>true</bestPractices>
719+
</configuration>
717720
</plugin>
718721
</plugins>
719722
</pluginManagement>

0 commit comments

Comments
 (0)