From aae3681d86672728ee34682e08ff757e5c111e02 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Wed, 1 Mar 2023 16:36:41 -0500 Subject: [PATCH 1/7] Source control release process Move release job setting and code to git repo Only upload test results for releases Signed-off-by: Sophia Guo --- Jenkinsfile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ sbin/Release.sh | 11 ++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..25b8028 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,48 @@ +#!groovy + +pipeline { + agent { label 'master' } + parameters { + password(name: 'GITHUB_TOKEN', defaultValue: 'SECRET', description: 'Leave this') + string(name: 'TAG', defaultValue: '', description: 'The GitHub tag of the release, e.g. jdk-12+33') + choice(name: 'VERSION', choices: ['JDK21', 'JDK20', 'JDK19', 'JDK17', 'JDK11', 'JDK8'], description: 'Which JDK Version?') + string(name: 'UPSTREAM_JOB_NAME', defaultValue: '', description: 'The full path to the pipeline / job, e.g. build-scripts/openjdk12-pipeline') + string(name: 'UPSTREAM_JOB_NUMBER', defaultValue: '', description: 'The build number of the pipeline / job you want to release, e.g. 92') + booleanParam(name: 'RELEASE', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') + string(name: 'ARTIFACTS_TO_COPY', defaultValue: '**/*.tar.gz,**/*.zip,**/*.sha256.txt,**/*.msi,**/*.pkg,**/*.json,**/*.sig', description: 'For example to only ship linux x64:
+target/linux/x64/**/*.tar.gz,target/linux/x64/**/*.sha256.txt,target/linux/x64/**/*.json,target/linux/x64/**/*.sig
+Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_linux*.sig') + string(name: 'ARTIFACTS_TO_SKIP', defaultValue: '', description: 'For example in most release builds we skip the testimage: *testimage*.') + string(name: 'TIMESTAMP', defaultValue: '', description: 'Optional timestamp to add for nightly builds.') + booleanParam(name: 'DRY_RUN', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') + booleanParam(name: 'UPLOAD_TESTRESULTS_ONLY', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') + } + stages { + stage('Upload Releases') { + steps { + script { + try { + cleanWs() + // use Jenkins crendential to download JDK if source is from openjdkX-pipline + checkout scm + step([$class: 'CopyArtifact', + fingerprintArtifacts: true, + flatten: true, + filter: "${ARTIFACTS_TO_COPY}", + excludes: "${ARTIFACTS_TO_SKIP}", + projectName: "${params.UPSTREAM_JOB_NAME}", + selector: [$class: 'SpecificBuildSelector', buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]]) + sh 'JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ./sbin/Release.sh' + //withCredentials([usernamePassword(credentialsId: 'eclipse_temurin_bot_email_and_token', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {} + } + } catch (Exception err) { + echo err.getMessage() + currentBuild.result = 'FAILURE' + } finally { + cleanWs() + } + } + } + } + } +} \ No newline at end of file diff --git a/sbin/Release.sh b/sbin/Release.sh index b4f2ac7..9a680ce 100755 --- a/sbin/Release.sh +++ b/sbin/Release.sh @@ -71,7 +71,7 @@ else org="--org \"${GITHUB_ORG}\"" fi -if [ "$UPLOAD_TAPS_ONLY" == "false" ]; then +if [ "$UPLOAD_TESTRESULTS_ONLY" == "false" ]; then # Rename archive files (and their associated files: checksum, metadata, sig) to ensure a consistent timestamp across release for file in OpenJDK* do @@ -136,6 +136,7 @@ if [ "$UPLOAD_TAPS_ONLY" == "false" ]; then # NOTE: If adding something here you may need to change the EXPECTED values in releaseCheck.sh files=$(ls "$PWD"/OpenJDK*{.tar.gz,.sha256.txt,.zip,.pkg,.msi,.json,*.sig} | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g') else + #TODO: enhance to a general file name - update groovy release() - case ~/.*AQAvitTapFiles.*/: "adopt"; break; files=$(ls "$PWD"/AQAvitTapFiles.tar.gz) fi @@ -147,6 +148,9 @@ RELEASE_OPTION="" if [ "$RELEASE" == "true" ]; then description="Official Release of $TAG" RELEASE_OPTION="--release" +else if [ "$UPLOAD_TESTRESULTS_ONLY" == "true" ]; then + echo "Test results are only needed to upload for releases!" + exit 1 else # -beta is a special designation that we must use to indicate non GA (non TCK'd) builds. TAG="${TAG}-beta" @@ -158,4 +162,9 @@ if [ "$DRY_RUN" == "false" ]; then cd adopt-github-release || exit 1 chmod +x gradlew GRADLE_USER_HOME=./gradle-cache ./gradlew --no-daemon run --args="--version \"${VERSION}\" --tag \"${TAG}\" --description \"${description}\" ${server} ${org} $RELEASE_OPTION $files" + # Run releaseCheck.sh to check that the correct number of artifacts are live + if [ -z "$TIMESTAMP" -a "$UPLOAD_TESTRESULTS_ONLY" = "false" ]; then + echo "*** PERFORMING RELEASE CHECK TO SEE IF THERE ARE ANY UNEXPECTED PROBLEMS ***" + ./sbin/releaseCheck.sh ${VERSION#JDK} $TAG VERBOSE + fi fi From cc79bdf89fdfd08e097d0832e3c104ca9cf253ba Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Fri, 3 Mar 2023 13:58:00 -0500 Subject: [PATCH 2/7] source control jenkin job Signed-off-by: Sophia Guo --- Jenkinsfile | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 25b8028..c01e6ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,7 @@ pipeline { choice(name: 'VERSION', choices: ['JDK21', 'JDK20', 'JDK19', 'JDK17', 'JDK11', 'JDK8'], description: 'Which JDK Version?') string(name: 'UPSTREAM_JOB_NAME', defaultValue: '', description: 'The full path to the pipeline / job, e.g. build-scripts/openjdk12-pipeline') string(name: 'UPSTREAM_JOB_NUMBER', defaultValue: '', description: 'The build number of the pipeline / job you want to release, e.g. 92') + string(name: 'UPSTREAM_JOB_LINK', defaultValue: '', description: 'The build link of the pipeline / job you want to release, e.g. 92') booleanParam(name: 'RELEASE', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') string(name: 'ARTIFACTS_TO_COPY', defaultValue: '**/*.tar.gz,**/*.zip,**/*.sha256.txt,**/*.msi,**/*.pkg,**/*.json,**/*.sig', description: 'For example to only ship linux x64:
target/linux/x64/**/*.tar.gz,target/linux/x64/**/*.sha256.txt,target/linux/x64/**/*.json,target/linux/x64/**/*.sig
@@ -25,16 +26,38 @@ Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_l cleanWs() // use Jenkins crendential to download JDK if source is from openjdkX-pipline checkout scm + + def upstreamJobName = params.UPSTREAM_JOB_NAME + def upstreamJobNumber = params.UPSTREAM_JOB_NUMBER + if (params.RELEASE && !params.UPSTREAM_JOB_NAME && !params.UPSTREAM_JOB_NUMBER) { + //JOB_LINK could be specific artifact one or the general one + def upstreamJobLink = params.UPSTREAM_JOB_LINK + if (params.UPSTREAM_JOB_LINK) { + if (params.UPSTREAM_JOB_LINK.contains('/artifact/')) { + upstreamJobLink = upstreamJobLink.substring(0, upstreamJobLink.indexOf('/artifact/')) + } + if (upstreamJobLink.endsWith("/")) { + upstreamJobLink= upstreamJobLink.substring(0, upstreamJobLink.length() - 1) + } + upstreamJobNumber = upstreamJobLink.tokenize('/').last() + upstreamJobName = upstreamJobLink.substring(0, upstreamJobLink.indexOf("${upstreamJobNumber}")) + } else { + echo "Set up UPSTREAM_JOB_LINK or UPSTREAM_JOB_NAME with UPSTREAM_JOB_NUMBER " + currentBuild.result = 'FAILURE' + return + } + + } step([$class: 'CopyArtifact', - fingerprintArtifacts: true, - flatten: true, - filter: "${ARTIFACTS_TO_COPY}", + fingerprintArtifacts: true, + flatten: true, + filter: "${ARTIFACTS_TO_COPY}", excludes: "${ARTIFACTS_TO_SKIP}", - projectName: "${params.UPSTREAM_JOB_NAME}", - selector: [$class: 'SpecificBuildSelector', buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]]) + projectName: "${upstreamJobName}", + selector: [$class: 'SpecificBuildSelector', buildNumber: "${upstreamJobNumber}"]]) + sh 'JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ./sbin/Release.sh' //withCredentials([usernamePassword(credentialsId: 'eclipse_temurin_bot_email_and_token', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {} - } } catch (Exception err) { echo err.getMessage() currentBuild.result = 'FAILURE' From db829a2298e43216db2d6084c5cc08416583d6c3 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Fri, 3 Mar 2023 14:02:54 -0500 Subject: [PATCH 3/7] source control jenkin job Signed-off-by: Sophia Guo --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c01e6ac..775ca8b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,8 +10,8 @@ pipeline { string(name: 'UPSTREAM_JOB_NUMBER', defaultValue: '', description: 'The build number of the pipeline / job you want to release, e.g. 92') string(name: 'UPSTREAM_JOB_LINK', defaultValue: '', description: 'The build link of the pipeline / job you want to release, e.g. 92') booleanParam(name: 'RELEASE', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') - string(name: 'ARTIFACTS_TO_COPY', defaultValue: '**/*.tar.gz,**/*.zip,**/*.sha256.txt,**/*.msi,**/*.pkg,**/*.json,**/*.sig', description: 'For example to only ship linux x64:
-target/linux/x64/**/*.tar.gz,target/linux/x64/**/*.sha256.txt,target/linux/x64/**/*.json,target/linux/x64/**/*.sig
+ string(name: 'ARTIFACTS_TO_COPY', defaultValue: '**/*.tar.gz,**/*.zip,**/*.sha256.txt,**/*.msi,**/*.pkg,**/*.json,**/*.sig', description: 'For example to only ship linux x64:
\n +target/linux/x64/**/*.tar.gz,target/linux/x64/**/*.sha256.txt,target/linux/x64/**/*.json,target/linux/x64/**/*.sig
\n Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_linux*.sig') string(name: 'ARTIFACTS_TO_SKIP', defaultValue: '', description: 'For example in most release builds we skip the testimage: *testimage*.') string(name: 'TIMESTAMP', defaultValue: '', description: 'Optional timestamp to add for nightly builds.') From 8d896bb6a5fb689436956bb709d5b9b0ac2419b8 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Fri, 3 Mar 2023 14:04:38 -0500 Subject: [PATCH 4/7] source control jenkin job Signed-off-by: Sophia Guo --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 775ca8b..7d7700e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,9 +10,9 @@ pipeline { string(name: 'UPSTREAM_JOB_NUMBER', defaultValue: '', description: 'The build number of the pipeline / job you want to release, e.g. 92') string(name: 'UPSTREAM_JOB_LINK', defaultValue: '', description: 'The build link of the pipeline / job you want to release, e.g. 92') booleanParam(name: 'RELEASE', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') - string(name: 'ARTIFACTS_TO_COPY', defaultValue: '**/*.tar.gz,**/*.zip,**/*.sha256.txt,**/*.msi,**/*.pkg,**/*.json,**/*.sig', description: 'For example to only ship linux x64:
\n -target/linux/x64/**/*.tar.gz,target/linux/x64/**/*.sha256.txt,target/linux/x64/**/*.json,target/linux/x64/**/*.sig
\n -Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_linux*.sig') + string(name: 'ARTIFACTS_TO_COPY', defaultValue: '**/*.tar.gz,**/*.zip,**/*.sha256.txt,**/*.msi,**/*.pkg,**/*.json,**/*.sig', description: '''For example to only ship linux x64:
+target/linux/x64/**/*.tar.gz,target/linux/x64/**/*.sha256.txt,target/linux/x64/**/*.json,target/linux/x64/**/*.sig
+Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_linux*.sig''') string(name: 'ARTIFACTS_TO_SKIP', defaultValue: '', description: 'For example in most release builds we skip the testimage: *testimage*.') string(name: 'TIMESTAMP', defaultValue: '', description: 'Optional timestamp to add for nightly builds.') booleanParam(name: 'DRY_RUN', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') From c2cb60d8b26d42ac5ad8aa46a2f1b5202108f727 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Fri, 3 Mar 2023 14:10:44 -0500 Subject: [PATCH 5/7] source control jenkin job Signed-off-by: Sophia Guo --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7d7700e..942abef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ target/linux/x64/**/*.tar.gz,target/linux/x64/**/*.sha256.txt,target/linux/x64/* Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_linux*.sig''') string(name: 'ARTIFACTS_TO_SKIP', defaultValue: '', description: 'For example in most release builds we skip the testimage: *testimage*.') string(name: 'TIMESTAMP', defaultValue: '', description: 'Optional timestamp to add for nightly builds.') - booleanParam(name: 'DRY_RUN', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') + booleanParam(name: 'DRY_RUN', defaultValue: false, description: 'Tick this box will not release the binary to GitHub') booleanParam(name: 'UPLOAD_TESTRESULTS_ONLY', defaultValue: false, description: 'Tick this box to actually release the binary to GitHub') } stages { @@ -51,8 +51,8 @@ Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_l step([$class: 'CopyArtifact', fingerprintArtifacts: true, flatten: true, - filter: "${ARTIFACTS_TO_COPY}", - excludes: "${ARTIFACTS_TO_SKIP}", + filter: "${params.ARTIFACTS_TO_COPY}", + excludes: "${params.ARTIFACTS_TO_SKIP}", projectName: "${upstreamJobName}", selector: [$class: 'SpecificBuildSelector', buildNumber: "${upstreamJobNumber}"]]) From 8442f09b9beac956625a026ae4cdd3c23c8a4f38 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Fri, 3 Mar 2023 15:38:28 -0500 Subject: [PATCH 6/7] source control jenkin job Signed-off-by: Sophia Guo --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 942abef..95413cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,6 +2,9 @@ pipeline { agent { label 'master' } + options { + copyArtifactPermission('*'); + } parameters { password(name: 'GITHUB_TOKEN', defaultValue: 'SECRET', description: 'Leave this') string(name: 'TAG', defaultValue: '', description: 'The GitHub tag of the release, e.g. jdk-12+33') @@ -55,7 +58,7 @@ Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_l excludes: "${params.ARTIFACTS_TO_SKIP}", projectName: "${upstreamJobName}", selector: [$class: 'SpecificBuildSelector', buildNumber: "${upstreamJobNumber}"]]) - + sh 'printenv' sh 'JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ./sbin/Release.sh' //withCredentials([usernamePassword(credentialsId: 'eclipse_temurin_bot_email_and_token', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {} } catch (Exception err) { From 6ca377bb78575d8771906b2daeef0d659589a999 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Fri, 3 Mar 2023 15:50:32 -0500 Subject: [PATCH 7/7] source control jenkin job Signed-off-by: Sophia Guo --- Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 95413cf..195e306 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,9 +58,7 @@ Or **/*x64_linux*.tar.gz,**/*x64_linux*.sha256.txt,**/*x64_linux*.json,**/*x64_l excludes: "${params.ARTIFACTS_TO_SKIP}", projectName: "${upstreamJobName}", selector: [$class: 'SpecificBuildSelector', buildNumber: "${upstreamJobNumber}"]]) - sh 'printenv' sh 'JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ./sbin/Release.sh' - //withCredentials([usernamePassword(credentialsId: 'eclipse_temurin_bot_email_and_token', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {} } catch (Exception err) { echo err.getMessage() currentBuild.result = 'FAILURE'