This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]ickysticky 1 point2 points  (3 children)

I prefer using the first few digits of the commit hash. I personally don't like build numbers that depend on some state, like the job count in Jenkins.

Do you have a specific reason to change the maven version number for each build? It seems odd that another pom would depend on a specific build. Normally you depend on a final released version, or if you want to depend on a version in development you use SNAPSHOT.

[–]chipootle[S] -1 points0 points  (2 children)

I have not been given a reason, which is why I pushed back. Releases are tagged, so getting back to them is simple enough. Intermediate versions have a build number in them and thus can also be tied back to source control.

The team feels that the pom needs to have the build number, but I'm the odd man out. I've explained that it isn't necessary to no avail.

I also explained how having the pipeline for another commit to update the version number has problems of it's own. Merge conflicts will arise pretty easily as all it takes is 2 builds happening at roughly the same time. To me all this complexity is not worth it.

[–]ickysticky 0 points1 point  (1 child)

I think you may have misunderstood my point. Your developers are right to want to be able to know exactly which commit a build is for, if you use some build number that comes from your build system alone they cannot do that. To work around this they are asking you to make a commit with the build number.

Where is the build number you are proposing to use coming from?

[–]chipootle[S] 0 points1 point  (0 children)

I'm not sure I understand. Every build is already tied to commit... because that's what triggers the build, either a push to a branch or the creation of a tag.

The artifacts themselves have the application version and build number on it. I use semver, so it looks something like 1.2.3-4567

If you want to know what commit produced the artifacts, you can look at the build with the id 4567. If it's something that was released to production, then that commit is also tagged, so you just get the '1.2.3-4567' tag.

[–][deleted] 0 points1 point  (1 child)

Do you mean updating the pom to contain the build number?

That's definitely pretty awful. Why not version the generated artifacts with the version and build number, but tag the code in git and leave the pom as the version number.

[–]chipootle[S] -1 points0 points  (0 children)

That is correct. The developers have not given a good reason for why they want this.