From 0c47c2522ede9316494a089e4e1a9bbc558c01a8 Mon Sep 17 00:00:00 2001 From: Kostas Tsiounis Date: Tue, 19 Dec 2023 11:02:59 -0500 Subject: [PATCH] Use credentials to load GSKit binaries from Artifactory --- buildenv/jenkins/common/build.groovy | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/buildenv/jenkins/common/build.groovy b/buildenv/jenkins/common/build.groovy index feb2340c334..7e1a1d375d3 100644 --- a/buildenv/jenkins/common/build.groovy +++ b/buildenv/jenkins/common/build.groovy @@ -58,6 +58,21 @@ def get_sources_with_authentication() { } } +def get_source_call(gskit_cred="") { + sh "bash get_source.sh ${EXTRA_GETSOURCE_OPTIONS} ${gskit_cred} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${OPENJ9_REFERENCE} ${OMR_REPO_OPTION} ${OMR_BRANCH_OPTION} ${OMR_SHA_OPTION} ${OMR_REFERENCE}" +} + +def get_source_call_optional_gskit() { + if (EXTRA_GETSOURCE_OPTIONS.contains("-gskit-bin") || (EXTRA_CONFIGURE_OPTIONS.contains("-gskit-sdk-bin"))) { + gskitCredentialID = variableFile.get_user_credentials_id('gskit') + withCredentials([usernamePassword(credentialsId: "${gskitCredentialID}", passwordVariable: 'GSKIT_PASSWORD', usernameVariable: 'GSKIT_USERNAME')]) { + get_source_call("-gskit-credential=\$GSKIT_USERNAME:\$GSKIT_PASSWORD") + } + } else { + get_source_call() + } +} + def get_sources() { // Temp workaround for Windows clones // See #3633 and JENKINS-54612 @@ -107,7 +122,7 @@ def get_sources() { // Look for dependent changes and checkout PR(s) checkout_pullrequest() } else { - sh "bash get_source.sh ${EXTRA_GETSOURCE_OPTIONS} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${OPENJ9_REFERENCE} ${OMR_REPO_OPTION} ${OMR_BRANCH_OPTION} ${OMR_SHA_OPTION} ${OMR_REFERENCE}" + get_source_call_optional_gskit() } } @@ -227,7 +242,7 @@ def checkout_pullrequest() { checkout_pullrequest(OPENJDK_PR, "ibmruntimes/openj9-openjdk-jdk${JDK_REPO_SUFFIX}") } - sh "bash get_source.sh ${EXTRA_GETSOURCE_OPTIONS} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${OPENJ9_REFERENCE} ${OMR_REPO_OPTION} ${OMR_BRANCH_OPTION} ${OMR_SHA_OPTION} ${OMR_REFERENCE}" + get_source_call_optional_gskit() // Checkout dependent PRs, if any were specified if (openj9_bool) {