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

Trigger the release dry run right after each jdk build is done #923

Merged
merged 2 commits into from
Feb 13, 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
53 changes: 44 additions & 9 deletions pipelines/build/common/build_base_file.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,6 @@ class Builder implements Serializable {
Call job to push artifacts to github. Usually it's only executed on a nightly build
*/
def publishBinary() {
if (release) {
// make sure to skip on release
context.println('Not publishing release')
return
}

def timestamp = new Date().format('yyyy-MM-dd-HH-mm', TimeZone.getTimeZone('UTC'))
def tag = "${javaToBuild}-${timestamp}"
Expand All @@ -784,8 +779,8 @@ class Builder implements Serializable {
}

context.stage('publish') {
context.println "publishing with publishName: ${publishName}"
context.build job: 'build-scripts/release/refactor_openjdk_release_tool',
context.println "publishing with publishName: ${publishName}"
context.build job: 'build-scripts/release/refactor_openjdk_release_tool',
parameters: [
['$class': 'BooleanParameterValue', name: 'RELEASE', value: release],
['$class': 'BooleanParameterValue', name: 'DRY_RUN', value: false],
Expand All @@ -798,6 +793,41 @@ class Builder implements Serializable {
}
}

/*
Call job to dry run Release Publish, generate release publish jenkins link
*/
def dryrunReleasePublish(IndividualBuildConfig config) {
def javaVersion=determineReleaseToolRepoVersion()
context.stage('Dry run release publish') {
def prefixOfArtifactsToCopy = "**/${config.TARGET_OS}/${config.ARCHITECTURE}/${config.VARIANT}"
def artifactsToCopy = "${prefixOfArtifactsToCopy}/*.tar.gz,${prefixOfArtifactsToCopy}/*.zip,${prefixOfArtifactsToCopy}/*.sha256.txt,${prefixOfArtifactsToCopy}/*.msi,${prefixOfArtifactsToCopy}/*.pkg,${prefixOfArtifactsToCopy}/*.json,${prefixOfArtifactsToCopy}/*.sig"
context.println "Dry run publishing : ${publishName} ${config.TARGET_OS} ${config.ARCHITECTURE}"
def releaseJob = context.build job: 'build-scripts/release/refactor_openjdk_release_tool',
parameters: [
['$class': 'BooleanParameterValue', name: 'RELEASE', value: release],
['$class': 'BooleanParameterValue', name: 'DRY_RUN', value: true],
context.string(name: 'TAG', value: publishName),
context.string(name: 'UPSTREAM_JOB_NAME', value: env.JOB_NAME),
context.string(name: 'UPSTREAM_JOB_NUMBER', value: "${currentBuild.getNumber()}"),
context.string(name: 'ARTIFACTS_TO_COPY', value: "${artifactsToCopy}"),
context.string(name: 'ARTIFACTS_TO_SKIP', value: '**/*testimage*'),
context.string(name: 'VERSION', value: javaVersion)
]
String releaseToolUrl = "${HUDSON_URL}job/build-scripts/job/release/job/refactor_openjdk_release_tool/parambuild?"
// publish release link - if dry run succeeds the link to ready to publish, if dry run fails the link is dry run link
releaseToolUrl += "VERSION=${javaVersion}&TAG=${publishName}&RELEASE=true&UPSTREAM_JOB_NAME=${env.JOB_NAME}&UPSTREAM_JOB_NUMBER=${currentBuild.getNumber()}&ARTIFACTS_TO_COPY=${artifactsToCopy}&ARTIFACTS_TO_SKIP=**/*testimage*"
def releaseComment = "Release Publish"
if (releaseJob.getResult()) {
releaseToolUrl += "&DRY_RUN=false"
releaseComment = "Dry run release publish"
} else {
releaseToolUrl += "&DRY_RUN=true"
}
URLEncoder.encode(releaseToolUrl.toString(), "UTF-8")
return ["${releaseToolUrl}", "${releaseComment}"]
}
}

/*
Main function. This is what is executed remotely via the [release-|evaluation-]openjdkxx-pipeline and pr-tester jobs
Running in the *openjdkX-pipeline
Expand Down Expand Up @@ -843,6 +873,9 @@ class Builder implements Serializable {
context.echo "Force auto generate AQA test jobs: ${aqaAutoGen}"
context.echo "Keep test reportdir: ${keepTestReportDir}"
context.echo "Keep release logs: ${keepReleaseLogs}"
def releaseSummary = manager.createSummary('next.svg')
releaseSummary.appendText('<b>RELEASE PUBLISH BINARIES:</b><ul>', false)

jobConfigurations.each { configuration ->
jobs[configuration.key] = {
IndividualBuildConfig config = configuration.value
Expand Down Expand Up @@ -891,7 +924,7 @@ class Builder implements Serializable {
if ( ! ( "${config.TARGET_OS}" ==~ /^[A-Za-z0-9\/\.\-_]*$/ ) ||
! ( "${config.ARCHITECTURE}" ==~ /^[A-Za-z0-9\/\.\-_]*$/ ) ||
! ( "${config.VARIANT}" ==~ /^[A-Za-z0-9\/\.\-_]*$/ ) ) {
throw new Exception("[ERROR] Dubious character in TARGET_OS, ARCHITECTURE or VARIANT - aborting");
throw new Exception('[ERROR] Dubious character in TARGET_OS, ARCHITECTURE or VARIANT - aborting')
}
context.sh "rm -rf target/${config.TARGET_OS}/${config.ARCHITECTURE}/${config.VARIANT}/"
}
Expand Down Expand Up @@ -934,6 +967,8 @@ class Builder implements Serializable {
}

copyArtifactSuccess = true
def (String releaseToolUrl, String releaseComment) = dryrunReleasePublish(config)
releaseSummary.appendText("<li><a href=${releaseToolUrl}> ${releaseComment} ${config.VARIANT} ${publishName} ${config.TARGET_OS} ${config.ARCHITECTURE}</a></li>")
}
}
context.println '[NODE SHIFT] OUT OF CONTROLLER NODE!'
Expand All @@ -957,7 +992,7 @@ class Builder implements Serializable {
}
}
context.parallel jobs

releaseSummary.appendText('</ul>', false)
// publish to github if needed
// Don't publish release automatically
if (publish && !release) {
Expand Down
Loading