-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable nightly build with reproducible comparison
Signed-off-by: Sophia Guo <[email protected]>
- Loading branch information
Showing
3 changed files
with
226 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
Jenkins job does comparison for two different build artifacts | ||
If they are identical, build pass; or fail | ||
*/ | ||
|
||
pipeline { | ||
agent any | ||
parameters { | ||
choice(choices: ['linux', 'mac', 'windows'], name: 'platform', description:'select release on different platform') | ||
string(name: 'URL1', defaultValue: '', description: 'URL to one version of the build artifacts\ne.g.: https://ci.adoptium.net/job/build-scripts/job/openjdk18-pipeline/lastSuccessfulBuild/artifact/target/linux/x64/temurin/OpenJDK18U-jdk_x64_linux_hotspot_2022-06-11-23-30.tar.gz') | ||
string(name: 'URL2', defaultValue: '', description: 'URL to the other version of the build artifacts\ne.g.: https://github.com/adoptium/temurin19-binaries/releases/download/jdk-2022-06-09-19-11-beta/OpenJDK-jdk_x64_linux_hotspot_2022-06-09-03-31.tar.gz') | ||
string(name: 'excludeFiles', defaultValue: 'classes_nocoops.jsa', description: 'File names to be excluded while doing the comparison, separated by `;`') | ||
} | ||
|
||
stages { | ||
stage('Lets Compare') { | ||
agent { | ||
label "${params.platform}&&build&&x64" // build label enables comparisons to be done, set to x64 for linux, might need adjust for windows/mac | ||
} | ||
steps { | ||
script { | ||
try { | ||
cleanWs() | ||
// use Jenkins crendential to download JDK if source is from openjdkX-pipline | ||
withCredentials([usernamePassword(credentialsId: 'eclipse_temurin_bot_email_and_token', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) { | ||
echo "Fetching artifact1 from ${params.URL1}" | ||
def ret1 = sh returnStatus: true, script: "mkdir url1Dir1 && curl -s --user ${USERNAME}:${PASSWORD} ${params.URL1} | tar -xz -C url1Dir1" | ||
if (ret1 != 0) { | ||
currentBuild.result = 'UNSTABLE' | ||
error 'Stopping after download and uncompress tar file' | ||
} | ||
echo "Fetching artifact2 from ${params.URL2}" | ||
def ret2 = sh returnStatus: true, script: "mkdir url1Dir2 && curl -s --user ${USERNAME}:${PASSWORD} ${params.URL2} | tar -xz -C url1Dir2" | ||
if (ret2 != 0) { | ||
currentBuild.result = 'UNSTABLE' | ||
error 'Stopping after download and uncompress tar file' | ||
} | ||
} | ||
// call extra platform specific function | ||
if (params.platform != 'linux') { | ||
"prep${platform}" ('url1Dir1', 'url1Dir2') | ||
} | ||
def excludeFlags="" | ||
def excludeFileList = excludeFiles.split(';') | ||
for(String excludeFile in excludeFileList) { | ||
excludeFlags="${excludeFlags} --exclude=${excludeFile}" | ||
} | ||
def retVal = sh returnStatus: true, script: "diff -q -r url1Dir1 url1Dir2 ${excludeFlags}" | ||
if (retVal != 0) { | ||
currentBuild.result = 'FAILURE' | ||
error 'Error: two builds are not the same!' | ||
} else { | ||
echo 'Success: two builds are the same!' | ||
} | ||
} catch (Exception err) { | ||
echo err.getMessage() | ||
currentBuild.result = 'FAILURE' | ||
} finally { | ||
cleanWs() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
/* TODO: | ||
set correct defaultpath for localCert | ||
see: https://github.com/adoptium/temurin-build/issues/3015#issuecomment-1175322612 | ||
*/ | ||
def prepmac(String jdk1, String jdk2, String localCert='defaultpath') { | ||
sh "chmod 776 ${WORKSPACE}/tools/reproduce_comparison/compareMacOS.sh" | ||
sh "${WORKSPACE}/tools/reproduce_comparison/compareMacOS.sh $jdk1 $jdk2 $localCert skip" | ||
} | ||
|
||
/* | ||
TODO: placeholder for windows comparison | ||
def prepwindows(String jdk1, String jdk2, ...) { | ||
sh "./tools/reproduce_comparison/compareWindows.sh ..." | ||
} | ||
*/ |