From f25c70a9cde37d85edcb1f3c73f80ff2bf0868e8 Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Thu, 29 Aug 2024 09:57:55 +0200 Subject: [PATCH] HHH-18488 Add a CI check for build reproducibility --- nightly.Jenkinsfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/nightly.Jenkinsfile b/nightly.Jenkinsfile index dfe47ef1f4..f1601ebeb1 100644 --- a/nightly.Jenkinsfile +++ b/nightly.Jenkinsfile @@ -204,6 +204,35 @@ stage('Build') { } }) } + // Don't run additional checks when this is a PR + if ( !helper.scmSource.pullRequest ) { + executions.put('Reproducible build check', { + runBuildOnNode(NODE_PATTERN_BASE) { + def javaHome = tool(name: DEFAULT_JDK_TOOL, type: 'jdk') + // Use withEnv instead of setting env directly, as that is global! + // See https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md + withEnv(["JAVA_HOME=${javaHome}", "PATH+JAVA=${javaHome}/bin"]) { + stage('Checkout') { + checkout scm + } + stage('Test') { + withGradle { + def tempDir = pwd(tmp: true) + def repo1 = tempDir + '/repo1' + def repo2 = tempDir + '/repo2' + // build Hibernate ORM two times without any cache and "publish" the resulting artifacts to different maven repositories + // so that we can compare them afterwards: + sh "./gradlew --no-daemon clean publishToMavenLocal --no-build-cache -Dmaven.repo.local=$repo1" + sh "./gradlew --no-daemon clean publishToMavenLocal --no-build-cache -Dmaven.repo.local=$repo2" + + sh "sh ci/compare-build-results.sh $repo1 $repo2" + sh "cat .buildcompare" + } + } + } + } + }) + } parallel(executions) }