Skip to content

Commit

Permalink
Ensure reproducible build on a different agent if it is non-container…
Browse files Browse the repository at this point in the history
… build (adoptium#760)

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

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Fix lib issues on non-linux platforms

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Ensure non docker image build reproduced on different agent.

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Update to temurin-build master branch

Instead of personal branch for testing

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

---------

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>
  • Loading branch information
sophia-guo authored and luhenry committed Feb 3, 2024
1 parent 55646d8 commit 9f6ecdf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ class Build {
return remoteTargets
}

def compareReproducibleBuild() {
def compareReproducibleBuild(String nonDockerNodeName) {
// Currently only enable for jdk17, linux_x64, temurin, nightly, which shouldn't affect current build
// Move out of normal jdk** folder as it won't be regenerated automatically right now
def jobName = "${env.JOB_NAME}"
Expand All @@ -601,6 +601,7 @@ class Build {
parameters: [
context.string(name: 'COMPARED_JOB_NUMBER', value: "${env.BUILD_NUMBER}"),
context.string(name: 'COMPARED_JOB_NAME', value: "${env.JOB_NAME}"),
context.string(name: 'COMPARED_AGENT', value: nonDockerNodeName),
context.string(name: 'COMPARED_JOB_PARAMS', value: buildParams)
],
wait: false
Expand Down Expand Up @@ -1734,6 +1735,7 @@ class Build {
def cleanWorkspaceBuildOutputAfter = Boolean.valueOf(buildConfig.CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER)
// Get branch/tag of temurin-build, ci-jenkins-pipeline and jenkins-helper repo from BUILD_CONFIGURATION or defaultsJson
def helperRef = buildConfig.HELPER_REF ?: DEFAULTS_JSON['repository']['helper_ref']
def nonDockerNodeName = ''

context.stage('queue') {
/* This loads the library containing two Helper classes, and causes them to be
Expand Down Expand Up @@ -1867,6 +1869,7 @@ class Build {
context.println "[NODE SHIFT] MOVING INTO JENKINS NODE MATCHING LABELNAME ${buildConfig.NODE_LABEL}..."
context.node(buildConfig.NODE_LABEL) {
addNodeToBuildDescription()
nonDockerNodeName = context.NODE_NAME
// This is to avoid windows path length issues.
context.echo("checking ${buildConfig.TARGET_OS}")
if (buildConfig.TARGET_OS == 'windows') {
Expand Down Expand Up @@ -1911,7 +1914,7 @@ class Build {

// Compare reproducible build if needed
if (enableReproducibleCompare) {
compareReproducibleBuild()
compareReproducibleBuild(nonDockerNodeName)
}
// Run Smoke Tests and AQA Tests
if (enableTests) {
Expand Down
6 changes: 4 additions & 2 deletions tools/reproduce_comparison/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pipeline {
parameters {
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_AGENT', defaultValue: '', description: 'Compared nightly build job agent')
string(name: 'COMPARED_JOB_PARAMS', defaultValue: '', description: 'Compared nightly build job parameters')
}

Expand Down Expand Up @@ -64,8 +65,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
NODE_LABEL=jsonJobParams.BUILD_CONFIGURATION.NODE_LABEL
if (!jsonJobParams.BUILD_CONFIGURATION.DOCKER_IMAGE) {
jsonJobParams.BUILD_CONFIGURATION.NODE_LABEL = "${NODE_LABEL}&&!${COMPARED_AGENT}"
}
def buildParams = [
text(name: 'BUILD_CONFIGURATION', value: JsonOutput.prettyPrint(JsonOutput.toJson(jsonJobParams.BUILD_CONFIGURATION))),
Expand Down

0 comments on commit 9f6ecdf

Please sign in to comment.