11/*
22Jenkins job does reproducible build compare.
33*/
4+ import groovy.json.JsonOutput
45
56pipeline {
67 agent any
@@ -36,12 +37,12 @@ pipeline {
3637 }
3738 }
3839 if (paramFound) {
39- reproducedParams. put(" ${ propertyItem.name} " , " ${ propertyItem.value} " )
40+ reproducedParams. put(propertyItem. name, propertyItem. value)
4041 }
4142 }
42-
43+
4344 def scmRef = reproducedParams[" SCM Ref" ]
44- def buildTimeStamp = reproducedParams[" Build Timestamp" ]
45+ def buildTimeStamp = " ' " + reproducedParams[" Build Timestamp" ] + " ' "
4546 def buildRef = reproducedParams[" Temurin Build Ref" ]
4647 buildRef = buildRef. substring(buildRef. lastIndexOf(' /' )+1 )
4748
@@ -53,17 +54,18 @@ pipeline {
5354 jobParams = jobParams. replace(" ADOPT_DEFAULTS_TEMP" , " \" ADOPT_DEFAULTS_JSON\" " )
5455 jobParams = jobParams. replace(" BUILD_CONFIGURATION" , " \" BUILD_CONFIGURATION\" " )
5556
57+ // Set Reproducible build parameters
5658 def jsonJobParams = new groovy.json.JsonSlurper (). parseText(jobParams)
5759 jsonJobParams. BUILD_CONFIGURATION . SCM_REF = scmRef
5860 jsonJobParams. BUILD_CONFIGURATION . BUILD_REF = buildRef
5961 jsonJobParams. BUILD_CONFIGURATION . BUILD_ARGS + = " --build-reproducible-date ${ buildTimeStamp} "
6062 jsonJobParams. BUILD_CONFIGURATION . ENABLE_REPRODUCIBLE_COMPARE = " false"
6163
6264 def buildParams = [
63- text(name : ' BUILD_CONFIGURATION' , value : " ${ jsonJobParams.BUILD_CONFIGURATION} " ),
64- text(name : ' USER_REMOTE_CONFIGS' , value : " ${ jsonJobParams.USER_REMOTE_CONFIGS} " ),
65- text(name : ' DEFAULTS_JSON' , value : " ${ jsonJobParams.DEFAULTS_JSON} " ),
66- text(name : ' ADOPT_DEFAULTS_JSON' , value : " ${ jsonJobParams.ADOPT_DEFAULTS_JSON } " )
65+ text(name : ' BUILD_CONFIGURATION' , value : JsonOutput . prettyPrint( JsonOutput . toJson( jsonJobParams. BUILD_CONFIGURATION )) ),
66+ text(name : ' USER_REMOTE_CONFIGS' , value : JsonOutput . prettyPrint( JsonOutput . toJson( jsonJobParams. USER_REMOTE_CONFIGS )) ),
67+ text(name : ' DEFAULTS_JSON' , value : JsonOutput . prettyPrint( JsonOutput . toJson( jsonJobParams. DEFAULTS_JSON )) ),
68+ text(name : ' ADOPT_DEFAULTS_JSON' , value : JsonOutput . prettyPrint( JsonOutput . toJson( jsonJobParams. DEFAULTS_JSON )) )
6769 ]
6870 def reproducibleJob = build job : " ${ COMPARED_JOB_NAME} " ,
6971 propagate : false ,
0 commit comments