Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For jdk8u aarch32|alpine beta triggers check for existance of a specific asset #1153

Merged
merged 10 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 59 additions & 12 deletions pipelines/build/common/trigger_beta_build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,47 @@ def loadTargetConfigurations(String javaVersion, String variant, String configSe
return targetConfigurationsForVariant
}

// Verify the given published release tag contains the given asset architecture
def checkJDKAssetExistsForArch(String binariesRepo, String version, String releaseTag, String arch) {
def assetExists = false

echo "Verifying ${version} JDK asset for ${arch} in release: ${releaseTag}"

def escRelease = releaseTag.replaceAll("\\+", "%2B")
def releaseAssetsUrl = binariesRepo.replaceAll("github.com","api.github.com/repos") + "/releases/tags/${escRelease}"

// Get list of assets, concatenate into a single string
def rc = sh(script: 'rm -f releaseAssets.json && curl -L -o releaseAssets.json '+releaseAssetsUrl, returnStatus: true)
def releaseAssets = ""
if (rc == 0) {
releaseAssets = sh(script: "cat releaseAssets.json | grep '\"name\"' | tr '\\n' '#'", returnStdout: true)
}

if (releaseAssets == "") {
echo "No release assets for ${releaseAssetsUrl}"
} else {
// Work out the JDK artifact filetype
def filetype
if (arch.contains("windows")) {
filetype = "\\.zip"
} else {
filetype = "\\.tar\\.gz"
}

def findAsset = releaseAssets =~/.*jdk_${arch}_[^"]*${filetype}".*/
if (findAsset) {
assetExists = true
}
}

if (assetExists) {
echo "${arch} JDK asset for version ${version} tag ${releaseTag} exists"
} else {
echo "${arch} JDK asset for version ${version} tag ${releaseTag} NOT FOUND"
}
return assetExists
}

node('worker') {
def adopt_tag_search
if (version == 8) {
Expand Down Expand Up @@ -170,25 +211,29 @@ node('worker') {
echo "Version "+versionStr+" already has a GA tag so not triggering a MAIN build"
}

// Check binaries repo for existance of the given release?
echo "Checking if ${binariesRepoTag} is already published?"
def desiredRepoTagURL="${binariesRepo}/releases/tag/${binariesRepoTag}"
def httpCode=sh(script:"curl -s -o /dev/null -w '%{http_code}' "+desiredRepoTagURL, returnStdout:true)
// Check binaries repo for existance of the given release tag having being already built?
def jdkAssetToCheck = "x64_linux"
if (mirrorRepo.contains("aarch32-jdk8u")) {
// aarch32-jdk8u built in its own pipeline
jdkAssetToCheck = "arm_linux"
} else if (mirrorRepo.contains("alpine-jdk8u")) {
// alpine-jdk8u built in its own pipeline
jdkAssetToCheck = "x64_alpine-linux"
}

echo "Checking if ${binariesRepoTag} is already published for JDK asset ${jdkAssetToCheck} ?"
def assetExists = checkJDKAssetExistsForArch(binariesRepo, versionStr, binariesRepoTag, jdkAssetToCheck)

if (httpCode == "200") {
if (assetExists) {
echo "Build tag ${binariesRepoTag} is already published - nothing to do"
} else if (httpCode == "404") {
} else {
echo "New unpublished build tag ${binariesRepoTag} - triggering builds"
if (gaTagCheck == 0) {
echo "Version "+versionStr+" already has a GA tag so not triggering a MAIN build"
} else {
triggerMainBuild = true
}
triggerEvaluationBuild = true
} else {
def error = "Unexpected HTTP code ${httpCode} when querying for existing build tag at $desiredRepoTagURL"
echo "${error}"
throw new Exception("${error}")
}
} else {
echo "FORCE triggering specified builds.."
Expand Down Expand Up @@ -232,12 +277,14 @@ if (triggerMainBuild || triggerEvaluationBuild) {
def jobs = [:]
def pipelines = [:]

if (triggerMainBuild) {
// Trigger Main pipeline as long as we have a non-empty target configuration
if (triggerMainBuild && mainTargetConfigurations != "{}") {
pipelines["main"] = "build-scripts/openjdk${version}-pipeline"
echo "main build targetConfigurations:"
echo JsonOutput.prettyPrint(mainTargetConfigurations)
}
if (triggerEvaluationBuild) {
// Trigger Evaluation as long as we have a non-empty target configuration
if (triggerEvaluationBuild && evaluationTargetConfigurations != "{}") {
pipelines["evaluation"] = "build-scripts/evaluation-openjdk${version}-pipeline"
echo "evaluation build targetConfigurations:"
echo JsonOutput.prettyPrint(evaluationTargetConfigurations)
Expand Down