Skip to content

Commit

Permalink
Fix reproducible parameters (#722)
Browse files Browse the repository at this point in the history
Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>
  • Loading branch information
sophia-guo authored Jun 13, 2023
1 parent 96e14e1 commit 198bfce
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tools/reproduce_comparison/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Jenkins job does reproducible build compare.
*/
import groovy.json.JsonOutput

pipeline {
agent any
Expand Down Expand Up @@ -36,12 +37,12 @@ pipeline {
}
}
if (paramFound) {
reproducedParams.put("${propertyItem.name}", "${propertyItem.value}")
reproducedParams.put(propertyItem.name, propertyItem.value)
}
}

def scmRef = reproducedParams["SCM Ref"]
def buildTimeStamp = reproducedParams["Build Timestamp"]
def buildTimeStamp = "'" + reproducedParams["Build Timestamp"] + "'"
def buildRef = reproducedParams["Temurin Build Ref"]
buildRef = buildRef.substring(buildRef.lastIndexOf('/')+1)

Expand All @@ -53,17 +54,18 @@ pipeline {
jobParams = jobParams.replace("ADOPT_DEFAULTS_TEMP", "\"ADOPT_DEFAULTS_JSON\"")
jobParams = jobParams.replace("BUILD_CONFIGURATION", "\"BUILD_CONFIGURATION\"")

// Set Reproducible build parameters
def jsonJobParams = new groovy.json.JsonSlurper().parseText(jobParams)
jsonJobParams.BUILD_CONFIGURATION.SCM_REF = scmRef
jsonJobParams.BUILD_CONFIGURATION.BUILD_REF = buildRef
jsonJobParams.BUILD_CONFIGURATION.BUILD_ARGS += " --build-reproducible-date ${buildTimeStamp}"
jsonJobParams.BUILD_CONFIGURATION.ENABLE_REPRODUCIBLE_COMPARE = "false"

def buildParams = [
text(name: 'BUILD_CONFIGURATION', value: "${jsonJobParams.BUILD_CONFIGURATION}"),
text(name: 'USER_REMOTE_CONFIGS', value: "${jsonJobParams.USER_REMOTE_CONFIGS}"),
text(name: 'DEFAULTS_JSON', value: "${jsonJobParams.DEFAULTS_JSON}"),
text(name: 'ADOPT_DEFAULTS_JSON', value: "${jsonJobParams.ADOPT_DEFAULTS_JSON}")
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))),
text(name: 'DEFAULTS_JSON', value: JsonOutput.prettyPrint(JsonOutput.toJson(jsonJobParams.DEFAULTS_JSON))),
text(name: 'ADOPT_DEFAULTS_JSON', value: JsonOutput.prettyPrint(JsonOutput.toJson(jsonJobParams.DEFAULTS_JSON)))
]
def reproducibleJob = build job: "${COMPARED_JOB_NAME}",
propagate: false,
Expand Down

0 comments on commit 198bfce

Please sign in to comment.