-
-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reproducible builds for Spoon #4151
Comments
See also thread "Reproducible builds on Java", https://lists.reproducible-builds.org/pipermail/rb-general/2021-September/002374.html |
diff --git a/spoon-pom/pom.xml b/spoon-pom/pom.xml
index 7a352b09..eef300ae 100644
--- a/spoon-pom/pom.xml
+++ b/spoon-pom/pom.xml
@@ -24,6 +24,7 @@
<java.test.version>1.8</java.test.version>
<runtime.log>target/velocity.log</runtime.log>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.build.outputTimestamp>1</project.build.outputTimestamp>
</properties>
<dependencies>
@@ -108,6 +109,11 @@
<build>
<defaultGoal>clean install</defaultGoal>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.2.0</version>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> Yields builds that consistently have the same hash for me. So at least in the core that seems to work (after updating the jar plugin). I haven't checked the other submodules. |
oh nice! would you make a PR?
|
Thanks a lot @I-Al-Istannen for #4152! I would say that the next step is to check reproducibility in CI, by packaging twice. Thoughts? |
Hi Martin @monperrus Great idea to introduce reproductible builds for Spoon. +1 Just a minor notification about one technical issue that arises on Inria CI with project.build.outputTimestamp set to 1. See for instance [1] where you can search for java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0 It seems to be a known bug with JDK 9. See for instance [2] and other references can be found on Google. Moving to a different JDK, 10 or later, seems to fix the issue. If someone can commit interest and time in upgrading the instance of Jenkins and/or pinging the Inria admins to do so... Cheers, [1] https://ci.inria.fr/sos/job/juliac/531/consoleText |
Many thanks to the one who configured the juliac job on Inria CI with JDK 11. This indeed solved the issue. I should have try it myself, but the notice "JDK11 (MUST BE PREINSTALLED ON NODE)" somewhat confused me and I dare not try, although I should have. |
you're welcome Lionel :) --Martin
|
@seintur I put that note there to avoid confusion, hehe. Basically, selecting that JDK only sets it as the default, but if JDK 11 is not installed it will just cause the build to fail. Which might be confusing as the other selections actually install a JDK. I've edited the note to be less scary: |
At some point, we'll also provide secure signing with Linux Foundation's http://sigstore.dev See @bobcallaway's Java component (yet to be documented): https://github.com/sigstore/sigstore-maven-plugin |
Eventually, Spoon will be listed on the reference table of reproducible maven artifacts: https://github.com/jvm-repo-rebuild/reproducible-central For this, we need to contribute with a cc/ @hboutemy |
@monperrus I tried that out and generated a buildspec, but we have a fundamental problem. Your tagged release commit in git has the version
and results in a total KO. Manually changing the version to
Which is a lot better. I am not sure if we want to have the jar with deps reproducible, but it sounds like @algomaster99 fixed that in #4614 anyways. So moving forward would likely require you to use the actual version without SNAPSHOT for the release commit. |
yes, fixing your release Git tag looks like a good idea last: did you diffoscope |
I am not sure how that would work. I tried
The buildspec file also does not seem to offer a way to massage the repository outside of and before the maven invocation, so I can't do this sequentially. I also tried using |
ok, no luck, it will have to be fixed for next releases :) on |
I guess you don't allow manual command fiddling to ensure projects are actually easily reproducible, but it bites us here :P
Yea, that is algomaster's conclusion in the PR I linked above as well. Should be doable :) |
yes, the intent being to keep the rebuild script as simple as possible to maintain, not really forcing to have simple reproducibility |
Thanks to @I-Al-Istannen work, we now have check in the CI for each PR if the build is reproducible. @monperrus What do you mean exactly with "periodically rebuild past builds"? Do you want to check if old builds are still reproducible? |
For the last N releases on central, we take the associated commit, we build it, and we check that we get the same SHA256 as the one on central. |
@monperrus The 10.1.0 release still has a Automatically releasing a commit if the version does not end in |
Thanks @I-Al-Istannen for moving forward on this important topic.
Yes, per our CD process, the commit sha1 is the reference.
Why is that blocking? Which tool is complaining? |
Here: #4151 (comment) The reproducible-central skript works by checking out the git commit corresponding to a maven release. It then builds the project locally on that commit and compares the results with the artifact found in maven central. This does not work for spoon, as the remote pom on maven central and the local pom are different: The local pom has a version of Even if it did though, the comparison would fail. The pom and jar files can not match as the pom.xml differs. |
I see, maven-artifact-plugin complains. We cannot claim a bug there. We have to change the process. In the meantime, I propose to manually release 10.1.1 (hotpatch) with an appropriate commit to make progress here. WDYT? |
Yea, that plugin works as intended. Our workflow is just not reproducible -- there is no commit for the release on maven as the version differs.
That would work fine, but it is also not really urgent. If you want to make a hotpatch feel free and I will update the reproducible-central PR. I am also fine with waiting until a new process has been found and settled on :) |
10.1.1 is released, we can proceed from there This work is very timely because we have a research project about to start on reproducible builds with openings as research assistant, research engineer and PhD student. Would you be interested? |
The Maven release plugin automates creating the release commit and the "next dev cycle" commit. I say we just use that and include those commits in the repo, as is done in Sorald's release script. |
As an update, the PR to reproducible-maven was merged and spoon-core 10.1.1 is now listed in the readme: https://github.com/jvm-repo-rebuild/reproducible-central#fr.inria.gforge.spoon:spoon-core. We could add a badge to the readme if we want or just leave it as is :) With this we can probably tick of the third point in the offpost.
|
Hurray, we can close the issue then. Thanks a lot @I-Al-Istannen |
FTR, added a step to update the buildspec file on https://github.com/jvm-repo-rebuild/reproducible-central for each release see #3890 (comment) |
If you like this issue, I'd recommend to subscribe to the rb-general mailing list https://lists.reproducible-builds.org/listinfo/rb-general |
The status of the reproducible build of spoon releases is published here. Any idea why they do not check for beta releases or have we disabled checks for them intentionally? |
concept: the creation of Jar files should be deterministic, i.e. we should have a reproducible build, see https://reproducible-builds.org/
maybe it is already, maybe it is not, to be checked.
then, we have different solutions:
Tasks:
related to #3867
The text was updated successfully, but these errors were encountered: