diff --git a/Jenkinsfile b/Jenkinsfile index 8c06391..561138d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,15 +21,35 @@ node('linux && maven && gpg') { ] ]) } - stage('Deploy') { - wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { - script { - def version = sh(returnStdout: true, script: 'mvn help:evaluate -Dexpression=project.version -q -DforceStdout') - def gh = new Github(this, 'testdroid-api', 'bitbar') - gh.release('master', 'v' + version, "Version ${version}") - sh('mvn clean package source:jar javadoc:jar gpg:sign nexus-staging:deploy') + try { + stage('Export gpg keys') { + withCredentials([string(credentialsId: 'gpg_passphrase', variable: 'GPG_PASSPHRASE')]) { + sh('mkdir -p /tmp/gpg') + sh('gpg --batch --pinentry-mode=loopback --yes --passphrase ${GPG_PASSPHRASE} --export-secret-key -a "Info Bitbar" > /tmp/gpg/prv.key') + sh('gpg --export -a "Info Bitbar" > /tmp/gpg/pub.key') } } + docker.image("maven:3.9.8-eclipse-temurin-17").inside("-u 0:0 -v /home/testdroid/.m2:/root/.m2 -v /tmp/gpg:/gpg") { + + stage('Deploy') { + wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { + script { + sh('apt update && apt install -y gnupg') + sh('gpg --list-keys') + sh('gpg --batch --import /gpg/prv.key') + sh('gpg --batch --import /gpg/pub.key') + sh('sleep 5') + sh('gpg --list-keys') + def version = sh(returnStdout: true, script: 'mvn help:evaluate -Dexpression=project.version -q -DforceStdout') + def gh = new Github(this, 'testdroid-api', 'bitbar') + gh.release('master', 'v' + version, "Version ${version}") + sh('mvn clean package source:jar javadoc:jar gpg:sign nexus-staging:deploy') + } + } + } + } + } finally { + sh('rm -rf /tmp/gpg/') } } } diff --git a/pom.xml b/pom.xml index 5f0b5f0..8192be7 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.testdroid testdroid-api - 3.33.0 + 3.33.1 jar Bitbar API v2 https://github.com/bitbar/testdroid-api