From a25df89944d1d79607b1b214cb1c539a7cbebe1d Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Mon, 13 May 2024 13:53:33 -0700 Subject: [PATCH] Update gradle publish library to handle invokeType Signed-off-by: Prudhvi Godithi --- jenkins/gradle/gradle-check.jenkinsfile | 28 +++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/jenkins/gradle/gradle-check.jenkinsfile b/jenkins/gradle/gradle-check.jenkinsfile index c1e320f4da..ffa9e91f2e 100644 --- a/jenkins/gradle/gradle-check.jenkinsfile +++ b/jenkins/gradle/gradle-check.jenkinsfile @@ -7,7 +7,7 @@ * compatible open source license. */ -lib = library(identifier: 'jenkins@6.4.2', retriever: modernSCM([ +lib = library(identifier: 'jenkins@6.4.6', retriever: modernSCM([ $class: 'GitSCMSource', remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', ])) @@ -147,7 +147,31 @@ pipeline { junit allowEmptyResults: true, testResults: '**/build/test-results/**/*.xml' archiveArtifacts artifacts: 'codeCoverage.xml', onlyIfSuccessful: true script { - publishGradleCheckTestResults(prNumber: "${pr_number}", prDescription: "${pr_title}") + def invokedBy + def pullRequest + def pullRequestTitle + switch (true) { + case env.BUILD_CAUSE.contains('Started by user'): + invokedBy = 'User' + pullRequest = "${GIT_REFERENCE}" + pullRequestTitle = "Null" + break + case env.BUILD_CAUSE.contains('Started by timer'): + invokedBy = 'Timer' + pullRequest = "${GIT_REFERENCE}" + pullRequestTitle = "Null" + break + case "${pr_number}" == "Null": + invokedBy = 'Post Merge Action' + pullRequest = "${GIT_REFERENCE}" + pullRequestTitle = "${pr_title}" + break + default: + invokedBy = 'Pull Request' + pullRequest = "${pr_number}" + pullRequestTitle = "${pr_title}" + } + publishGradleCheckTestResults(prNumber: "${pullRequest}" , prDescription: "${pr_title}", invokeType: "${invokedBy}") sh("rm -rf *") postCleanup() }