From b04cfa5a11f2b3c5d3b1fafdfd37c6719905e6f6 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sun, 5 Jan 2025 12:03:57 +0100 Subject: [PATCH] [Build] Use Maven-Daemon to speed up Maven artifact publication --- JenkinsJobs/Releng/publishToMaven.jenkinsfile | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/JenkinsJobs/Releng/publishToMaven.jenkinsfile b/JenkinsJobs/Releng/publishToMaven.jenkinsfile index 7dbc820af2e..f81316f5066 100644 --- a/JenkinsJobs/Releng/publishToMaven.jenkinsfile +++ b/JenkinsJobs/Releng/publishToMaven.jenkinsfile @@ -15,6 +15,10 @@ pipeline { } environment { REPO = "${WORKSPACE}/repo" + PATH = "${installMavenDaemon('1.0.2')}/bin:${PATH}" + // Folder ~/.m2 is not writable for builds, ensure mvnd metadata are written within the workspace. + // prevent jline warning about inability to create a system terminal and increase keep-alive timeouts to increase stability in concurrent usage + MVND = "mvnd -Dmvnd.daemonStorage=${WORKSPACE}/tools/mvnd -Dorg.jline.terminal.type=dumb -Dmvnd.keepAlive=1000 -Dmvnd.maxLostKeepAlive=100 --no-transfer-progress" } // parameters declared in the definition of the invoking job stages { @@ -64,7 +68,7 @@ pipeline { # Get each artifact and all its transitive dependencies from the Mavenized repository. set -x for i in $(cat coordinates.txt); do - mvn dependency:get --no-transfer-progress -Dosgi.platform=gtk.linux.x86_64 -Dartifact=$i -DremoteRepositories=file://${REPO} + ${MVND} dependency:get -Dosgi.platform=gtk.linux.x86_64 -Dartifact=$i -DremoteRepositories=file://${REPO} done ''' } @@ -160,7 +164,7 @@ pipeline { fi set -x - mvn -f "${configurationPom}" -s ${SETTINGS} --no-transfer-progress \\ + ${MVND} -f "${configurationPom}" -s ${SETTINGS} \\ gpg:sign-and-deploy-file -Dgpg.key.id=${GPG_KEY_ID} \\ -Durl=${URL} -DrepositoryId=${MAVEN_REPO} \\ -DpomFile=${pomFile} -Dfile=${file} \\ @@ -186,4 +190,15 @@ pipeline { to: 'platform-releng-dev@eclipse.org', from:'genie.releng@eclipse.org' } } -} \ No newline at end of file +} + +def installMavenDaemon(String version){ + return install('mvnd', "https://downloads.apache.org/maven/mvnd/${version}/maven-mvnd-${version}-linux-amd64.tar.gz") +} + +def install(String toolType, String url) { + dir("${WORKSPACE}/tools/${toolType}") { + sh "curl -L ${url} | tar -xzf -" + return "${pwd()}/" + sh(script: 'ls', returnStdout: true).strip() + } +}