Skip to content

Commit

Permalink
Enable window-x64, s390x, ppc64le reproducible comparison (#757)
Browse files Browse the repository at this point in the history
* Enable windows reproduciable comparison jenkins build

Signed-off-by: Sophia Guo <[email protected]>

* Enable window-x64,ppc64le, s390x jdk17 reproducible comparison

Signed-off-by: Sophia Guo <[email protected]>

* Update to adoptium/temurin-build master

Instead of personal branch for testing

Signed-off-by: Sophia Guo <[email protected]>

---------

Signed-off-by: Sophia Guo <[email protected]>
  • Loading branch information
sophia-guo authored Jul 31, 2023
1 parent 906d888 commit 29aea06
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 27 deletions.
9 changes: 9 additions & 0 deletions pipelines/jobs/configurations/jdk17u_pipeline_config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class Config17 {
arch : 'x64',
additionalNodeLabels: 'win2012&&vs2019',
test : 'default',
reproducibleCompare : [
'temurin' : true
],
buildArgs : [
'temurin' : '--create-jre-image --create-sbom'
]
Expand Down Expand Up @@ -100,6 +103,9 @@ class Config17 {
arch : 's390x',
dockerImage : 'rhel7_build_image',
test : 'default',
reproducibleCompare : [
'temurin' : true
],
configureArgs : '--enable-dtrace',
buildArgs : [
'temurin' : '--create-jre-image --create-sbom'
Expand All @@ -111,6 +117,9 @@ class Config17 {
arch : 'ppc64le',
dockerImage : 'adoptopenjdk/centos7_build_image',
test : 'default',
reproducibleCompare : [
'temurin' : true
],
buildArgs : [
'temurin' : '--create-jre-image --create-sbom'
]
Expand Down
79 changes: 52 additions & 27 deletions tools/reproduce_comparison/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ Jenkins job does reproducible build compare.
*/
import groovy.json.JsonOutput

env.NODE_LABEL = 'dockerBuild&&linux&&x64'
pipeline {
agent { label 'dockerBuild&&linux&&x64' }
agent { label NODE_LABEL }
parameters {
string(name: 'COMPARED_JOB_NUMBER', defaultValue: '', description: 'Compared nightly build job name')
string(name: 'COMPARED_JOB_NAME', defaultValue: '', description: 'Compared nightly build job number')
string(name: 'COMPARED_JOB_NUMBER', defaultValue: '', description: 'Compared nightly build job number')
string(name: 'COMPARED_JOB_NAME', defaultValue: '', description: 'Compared nightly build job name')
string(name: 'COMPARED_JOB_PARAMS', defaultValue: '', description: 'Compared nightly build job parameters')
}

Expand All @@ -17,7 +18,7 @@ pipeline {
cleanWs()
checkout scm
copyArtifacts excludes: '**/OpenJDK*-sbom*metadata.json,**/OpenJDK*-jdk-sources*.tar.gz',
filter: '**/OpenJDK*-jdk*.tar.gz,**/OpenJDK*-sbom*.json',
filter: '**/OpenJDK*-jdk*.tar.gz,**/OpenJDK*-jdk*.zip,**/OpenJDK*-sbom*.json',
fingerprintArtifacts: true,
flatten: true,
projectName: "${params.COMPARED_JOB_NAME}",
Expand Down Expand Up @@ -63,6 +64,9 @@ pipeline {
jsonJobParams.BUILD_CONFIGURATION.ENABLE_TESTS = false
jsonJobParams.BUILD_CONFIGURATION.ENABLE_INSTALLERS = false

if (!COMPARED_JOB_NAME.contains('linux')) {
NODE_LABEL=jsonJobParams.BUILD_CONFIGURATION.NODE_LABEL
}
def buildParams = [
text(name: 'BUILD_CONFIGURATION', value: JsonOutput.prettyPrint(JsonOutput.toJson(jsonJobParams.BUILD_CONFIGURATION))),
text(name: 'USER_REMOTE_CONFIGS', value: JsonOutput.prettyPrint(JsonOutput.toJson(jsonJobParams.USER_REMOTE_CONFIGS))),
Expand All @@ -81,7 +85,7 @@ pipeline {
projectName:"${COMPARED_JOB_NAME}",
selector:specific("${reproducibleJob.getNumber()}"),
excludes: '**/OpenJDK*-jdk-sources*.tar.gz',
filter: '**/OpenJDK*-jdk*.tar.gz',
filter: '**/OpenJDK*-jdk*.tar.gz,**/OpenJDK*-jdk*.zip',
target: 'reproduced/',
fingerprintArtifacts: true,
flatten: true
Expand All @@ -95,45 +99,66 @@ pipeline {
return
}

def originalJDKFile = findFiles(glob: "original/*.tar.gz")
def reproducedJDKFile = findFiles(glob: "reproduced/*.tar.gz")
def untarOriginalJDK = sh returnStatus: true, script: "tar xzf ${originalJDKFile[0].path} --strip-components=1 -C original"
if (untarOriginalJDK != 0 ) {
currentBuild.result = 'UNSTABLE'
error " Untar ${originalJDKFile[0].name} failed"
return
}
def untarReproducedJDK = sh returnStatus: true, script: "tar xzf ${reproducedJDKFile[0].path} --strip-components=1 -C reproduced"
if (untarReproducedJDK != 0 ) {
currentBuild.result = 'UNSTABLE'
error " Untar ${reproducedJDKFile[0].name} failed"
return
}

// Remove artifacts in untarred compared jdk dir before comparison
sh """
find . -type f -name '*.tar.gz' -delete
find . -type f -name '*.json' -delete
"""
archiveArtifacts artifacts: '**/OpenJDK*-jdk*.tar.gz,**/OpenJDK*-jdk*.zip', fingerprint: true
}
}
}
stage('Compare') {
agent { label NODE_LABEL }
steps {
copyArtifacts filter: '**/OpenJDK*-jdk*.tar.gz,**/OpenJDK*-jdk*.zip',
fingerprintArtifacts: true,
projectName: env.JOB_NAME,
selector: specific("${env.BUILD_NUMBER}")
checkout([$class: 'GitSCM', branches: [[name: 'master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "temurin-build"]], submoduleCfg: [], userRemoteConfigs: [[url: "https://github.com/adoptium/temurin-build.git"]]])

script {
if (COMPARED_JOB_NAME.contains('windows')) {
def originalJDKFile = findFiles(glob: "original/*.zip")
def reproducedJDKFile = findFiles(glob: "reproduced/*.zip")
def untarOriginalJDK = sh returnStatus: true, script: "cd original && temp=`mktemp -d` && unzip -d ${temp} ${originalJDKFile[0].name} && mv ${temp}/*/* ./ && rmdir ${temp}/* ${temp}"
if (untarOriginalJDK != 0 ) {
currentBuild.result = 'UNSTABLE'
error " Unzip ${originalJDKFile[0].name} failed"
return
}
def untarReproducedJDK = sh returnStatus: true, script: "cd reproduced && temp=`mktemp -d` && unzip -d ${temp} ${reproducedJDKFile[0].name} && mv ${temp}/*/* ./ && rmdir ${temp}/* ${temp}"
if (untarReproducedJDK != 0 ) {
currentBuild.result = 'UNSTABLE'
error " Unzip ${originalJDKFile[0].name} failed"
return
}
sh "find . -type f -name 'OpenJDK*-jdk*.zip' -delete"
} else {
def originalJDKFile = findFiles(glob: "original/*.tar.gz")
def reproducedJDKFile = findFiles(glob: "reproduced/*.tar.gz")
def untarOriginalJDK = sh returnStatus: true, script: "tar xzf ${originalJDKFile[0].path} --strip-components=1 -C original"
if (untarOriginalJDK != 0 ) {
currentBuild.result = 'UNSTABLE'
error " Untar ${originalJDKFile[0].name} failed"
return
}
def untarReproducedJDK = sh returnStatus: true, script: "tar xzf ${reproducedJDKFile[0].path} --strip-components=1 -C reproduced"
if (untarReproducedJDK != 0 ) {
currentBuild.result = 'UNSTABLE'
error " Untar ${reproducedJDKFile[0].name} failed"
return
}
sh "find . -type f -name 'OpenJDK*-jdk*.tar.gz' -delete"
}
try {
dir('temurin-build/tooling') {
def rc = 0
if (COMPARED_JOB_NAME.contains('linux')) {
rc = sh returnStatus: true, script: "./repro_compare.sh temurin ${WORKSPACE}/original temurin ${WORKSPACE}/reproduced"
rc = sh returnStatus: true, script: "./repro_compare.sh temurin ${WORKSPACE}/original temurin ${WORKSPACE}/reproduced Linux"
} else if (COMPARED_JOB_NAME.contains('mac')) {
// mac
//sh "./tooling/mac_repro_compare.sh temurin ./original temurin ./reproduced ${self_cert_file} ${self_cert_passwd}"
//rc = sh returnStatus: true, script: "./repro_compare.sh temurin ${WORKSPACE}/original temurin ${WORKSPACE}/reproduced Darwin"
echo 'todo mac build comparison'
} else if (COMPARED_JOB_NAME.contains('windows')) {
//windows
echo 'todo windows build comparison'
rc = sh returnStatus: true, script: "./repro_compare.sh temurin `pwd`/../../original temurin `pwd`/../../reproduced CYGWIN"
}
if (rc != 0) {
currentBuild.result = 'FAILURE'
Expand Down

0 comments on commit 29aea06

Please sign in to comment.