From 10e8dc4ccafbaece6a0db9dd6064faceb2a57979 Mon Sep 17 00:00:00 2001 From: Andrew Leonard Date: Wed, 13 Mar 2024 09:34:43 +0000 Subject: [PATCH 1/3] Update release testenv jdkBranch check to resolve -ga commit Signed-off-by: Andrew Leonard --- pipelines/build/openjdk_pipeline.groovy | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pipelines/build/openjdk_pipeline.groovy b/pipelines/build/openjdk_pipeline.groovy index 628dbf2cc..f5b37ecdf 100644 --- a/pipelines/build/openjdk_pipeline.groovy +++ b/pipelines/build/openjdk_pipeline.groovy @@ -57,6 +57,30 @@ node('worker') { break } } + + // If testenv tag is a "-ga" tag, then resolve to the actual openjdk build tag it's tagging + if (jdkBranch.contains("-ga")) + def openjdkRepo = "https://github.com/openjdk/jdk${params.jdkVersion}.git" + + def gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep "${jdkBranch}" | tr -s '\\t ' ' ' | cut -d' ' -f1") + if (gaCommitSHA == "") { + openjdkRepo = "https://github.com/openjdk/jdk${params.jdkVersion}u.git" + gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep "${jdkBranch}" | tr -s '\\t ' ' ' | cut -d' ' -f1") + } + + if (gaCommitSHA == "") { + println "[ERROR] Unable to resolve ${jdkBranch} upstream commit, will try to match tag as-is" + } else { + def upstreamTag = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep "${gaCommitSHA}" | tr -s '\\t ' ' ' | cut -d' ' -f2 | sed \"s,refs/tags/,,\"") + if (upstreamTag != "") { + println "[INFO] Resolved ${jdkBranch} to upstream build tag ${upstreamTag}" + jdkBranch = upstreamTag + } else { + println "[ERROR] Unable to resolve ${jdkBranch} upstream commit, will try to match tag as-is" + } + } + } + if (jdkBranch == buildTag) { println "[INFO] scmReference=${buildTag} matches with JDK${params.jdkVersion}_BRANCH=${jdkBranch} in ${propertyFile} in aqa-tests release branch." } else if (jdkOpenj9Branch == buildTag) { From 5f9034abfb2efad8138a320e803319ca80b60d73 Mon Sep 17 00:00:00 2001 From: Andrew Leonard Date: Wed, 13 Mar 2024 10:17:11 +0000 Subject: [PATCH 2/3] Update release testenv jdkBranch check to resolve -ga commit Signed-off-by: Andrew Leonard --- pipelines/build/openjdk_pipeline.groovy | 60 +++++++++++++++++-------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/pipelines/build/openjdk_pipeline.groovy b/pipelines/build/openjdk_pipeline.groovy index f5b37ecdf..933014c57 100644 --- a/pipelines/build/openjdk_pipeline.groovy +++ b/pipelines/build/openjdk_pipeline.groovy @@ -21,6 +21,46 @@ Closure configureBuild = null def buildConfigurations = null Map DEFAULTS_JSON = null + +// Resolve a "-ga" tag to the actual upstream openjdk build tag of the same commit +// Also check adoptium mirror for "dryrun" tags +def resolveGaTag(String jdkVersion, String jdkBranch) { + def resolvedTag = jdkBranch // Default to as-is + + def openjdkRepo = "https://github.com/openjdk/jdk${jdkVersion}.git" + + def gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep \"${jdkBranch}\" | tr -s '\\t ' ' ' | cut -d' ' -f1 | tr -d '\\n'") + if (gaCommitSHA == "") { + // Try "updates" repo.. + openjdkRepo = "https://github.com/openjdk/jdk${jdkVersion}u.git" + gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep \"${jdkBranch}\" | tr -s '\\t ' ' ' | cut -d' ' -f1 | tr -d '\\n'") + } + if (gaCommitSHA == "") { + // Maybe an Adoptium "dryrun" try Adoptium mirror repo.. + openjdkRepo = "https://github.com/adoptium/jdk${jdkVersion}.git" + gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep \"${jdkBranch}\" | tr -s '\\t ' ' ' | cut -d' ' -f1 | tr -d '\\n'") + } + if (gaCommitSHA == "") { + // Maybe an Adoptium "dryrun" try Adoptium mirror "updates" repo.. + openjdkRepo = "https://github.com/adoptium/jdk${jdkVersion}u.git" + gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep \"${jdkBranch}\" | tr -s '\\t ' ' ' | cut -d' ' -f1 | tr -d '\\n'") + } + + if (gaCommitSHA == "") { + println "[ERROR] Unable to resolve ${jdkBranch} upstream commit, will try to match tag as-is" + } else { + def upstreamTag = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep \"${gaCommitSHA}\" | grep -v \"${jdkBranch}\" | tr -s '\\t ' ' ' | cut -d' ' -f2 | sed \"s,refs/tags/,,\" | sed \"s,\\^{},,\" | tr -d '\\n'") + if (upstreamTag != "") { + println "[INFO] Resolved ${jdkBranch} to upstream build tag ${upstreamTag}" + resolvedTag = upstreamTag + } else { + println "[ERROR] Unable to resolve ${jdkBranch} upstream commit, will try to match tag as-is" + } + } + + return resolvedTag +} + node('worker') { // Ensure workspace is clean so we don't archive any old failed pipeline artifacts println '[INFO] Cleaning up controller worker workspace prior to running pipelines..' @@ -60,25 +100,7 @@ node('worker') { // If testenv tag is a "-ga" tag, then resolve to the actual openjdk build tag it's tagging if (jdkBranch.contains("-ga")) - def openjdkRepo = "https://github.com/openjdk/jdk${params.jdkVersion}.git" - - def gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep "${jdkBranch}" | tr -s '\\t ' ' ' | cut -d' ' -f1") - if (gaCommitSHA == "") { - openjdkRepo = "https://github.com/openjdk/jdk${params.jdkVersion}u.git" - gaCommitSHA = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep "${jdkBranch}" | tr -s '\\t ' ' ' | cut -d' ' -f1") - } - - if (gaCommitSHA == "") { - println "[ERROR] Unable to resolve ${jdkBranch} upstream commit, will try to match tag as-is" - } else { - def upstreamTag = sh(returnStdout: true, script:"git ls-remote --tags ${openjdkRepo} | grep '\\^{}' | grep "${gaCommitSHA}" | tr -s '\\t ' ' ' | cut -d' ' -f2 | sed \"s,refs/tags/,,\"") - if (upstreamTag != "") { - println "[INFO] Resolved ${jdkBranch} to upstream build tag ${upstreamTag}" - jdkBranch = upstreamTag - } else { - println "[ERROR] Unable to resolve ${jdkBranch} upstream commit, will try to match tag as-is" - } - } + jdkBranch = resolveGaTag("${params.jdkVersion}", jdkBranch) } if (jdkBranch == buildTag) { From 01d5df584b566b1319e820ad12b83ff6a342cb9f Mon Sep 17 00:00:00 2001 From: Andrew Leonard Date: Wed, 13 Mar 2024 10:40:19 +0000 Subject: [PATCH 3/3] Update release testenv jdkBranch check to resolve -ga commit Signed-off-by: Andrew Leonard --- pipelines/build/openjdk_pipeline.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/build/openjdk_pipeline.groovy b/pipelines/build/openjdk_pipeline.groovy index 933014c57..467f4d9d0 100644 --- a/pipelines/build/openjdk_pipeline.groovy +++ b/pipelines/build/openjdk_pipeline.groovy @@ -99,7 +99,7 @@ node('worker') { } // If testenv tag is a "-ga" tag, then resolve to the actual openjdk build tag it's tagging - if (jdkBranch.contains("-ga")) + if (jdkBranch.contains("-ga")) { jdkBranch = resolveGaTag("${params.jdkVersion}", jdkBranch) }