-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add maven property for build qualifier #25
Conversation
Just learned at OCX24: Instead of the build time stamp we should use the commit time stamp, and there is some tycho plugin for that. But still I prefer do be able to append some extra info like "-pr42" via mvn commandline, to support something like these versioning schemes depending on who initiated the build, for seeing quickly when some non-release binary is used:
|
@Bananeweizen Could you please give a hint on where to find that tycho plugin providing that commit timestamp? Ah... when there are local changes in the workspace, I prefer to see a version number like:
Is that supported as well by that tycho plugin? |
You need the upper half of the code shown in https://wiki.eclipse.org/Tycho/Reproducible_Version_Qualifiers. Adding a "dirty" part doesn't make much sense IMO, details for dirty workspace are on that wiki page. I rather recommend to fail the build for a dirty workspace, because that binary is absolutely not reproducible. If you install that binary somewhere and get an error later, you cannot go back to that code (as there is no commit). If you need more things to be configured, https://github.com/git-commit-id/git-commit-id-maven-plugin would be my recommendation. But again, I would recommend to NOT put all this information into the qualifier (or generally the name of jars) at all. I suggest to rather inject the git variables from the commit id maven plugin into the about.properties, into feature.xml text, into the splash screen text, into the product file or similar. Then they are easily visible in the installation details, in the about dialog etc. and nobody has to "decode" jar names. |
@Bananeweizen Thanks for those information and pointers! So I understand this like having "reproducible builds" as the idea behind: But then, the idea of "reproducible builds" applies to commits that are pushed to the target branch only, or at least are persisted in another way - which does not necessarily apply to pull requests or even local commits. In other words, only the automated builds (e.g. Jenkins Jobs, Github Actions) behind the master branch or even release tags (if necessary then) should create (and publish) binaries having the timestamp-only qualifier. To me, this is important because when testing some change by deploying that binary to some IDE or even application, forgetting about that, then returning back to that IDE or application after a while, wondering why something behaves strange, then looking at the installed version numbers should indicate there's something "unofficial" installed, without the need to look into installed content for lots of installed packages. Or am I still missing something here? |
Using |
Well... how do you handle pull requests then? |
"official" builds are created from commits submitted to master branch, or from a release tag.
The desired build qualifier can now be passed via command line and also includes the current date. Without any flags, the build qualifier defaults to "Alpha" and the current date.
Examples:
mvn clean verify
→ "org.eclipse.tea.core_2.0.1.Alpha-202410171235.jar"mvn clean verify -Dqualifier=Beta
→ "org.eclipse.tea.core_2.0.1.Beta-202410171235.jar"mvn clean verify "-Dtycho.buildqualifier.format='Final'"
→ "org.eclipse.tea.core_2.0.1.Final.jar"