From 0527a5cc9735d114fc2caf5bb7823018a31df769 Mon Sep 17 00:00:00 2001 From: John Blum Date: Tue, 21 Jun 2022 19:29:52 -0700 Subject: [PATCH] Enable Jenkins CI build to publish Gradle build (scan) reports to ge.spring.io. --- Jenkinsfile | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6ae8497..7c20de1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,8 @@ def p = [:] +def GRADLE_ENTERPRISE_SECRET_ACCESS_KEY = + string(credentialsId: 'gradle_enterprise_secret_access_key', variable: 'GRADLE_ENTERPRISE_ACCESS_KEY') + node { checkout scm p = readProperties interpolate: true, file: 'ci/pipeline.properties' @@ -27,29 +30,32 @@ pipeline { steps { script { docker.image(p['docker.container.image.java.main']).inside(p['docker.container.inside.env.full']) { + withCredentials([GRADLE_ENTERPRISE_SECRET_ACCESS_KEY]) { + withEnv(["GRADLE_ENTERPRISE_ACCESS_KEY=${GRADLE_ENTERPRISE_ACCESS_KEY}"]) { + sh "echo 'Setup build environment...'" + sh "ci/setup.sh" - sh "echo 'Setup build environment...'" - sh "ci/setup.sh" + // Cleanup any prior build system resources + try { + sh "echo 'Clean up GemFire/Geode files & build artifacts...'" + sh "ci/cleanupGemFiles.sh" + sh "ci/cleanupArtifacts.sh" + } + catch (ignore) { } - // Cleanup any prior build system resources - try { - sh "echo 'Clean up GemFire/Geode files & build artifacts...'" - sh "ci/cleanupGemFiles.sh" - sh "ci/cleanupArtifacts.sh" - } - catch (ignore) { } - - // Run the SBDG project Gradle build using JDK 8 inside Docker - try { - sh "echo 'Building SSDG...'" - sh "ci/check.sh" - } - catch (e) { - currentBuild.result = "FAILED: build" - throw e - } - finally { - junit '**/build/test-results/*/*.xml' + // Run the SBDG project Gradle build using JDK 8 inside Docker + try { + sh "echo 'Building SSDG...'" + sh "ci/check.sh" + } + catch (e) { + currentBuild.result = "FAILED: build" + throw e + } + finally { + junit '**/build/test-results/*/*.xml' + } + } } } }