GitVersion
GitVersion copied to clipboard
Add configuration param to define PreReleaseTag separator
I'm trying to use SemVer as a single identifier for all build artifacts. GitVersion Babmoo plugin is a great solution for almost all cases, but unfortunately I have linux RPM+YUM-based distribution.
RPM+YUM versioning technicaly maps to SemVer abstractions (semver pre-release + build metadata = rpm release), but doesn't allow dashes in rpm-release string. Standard GitVersion config for feature branch feature/JIRA-123
generates invalid artifacts like name-1.4.3-JIRA-123.rpm
. Moreover, branch feature/JIRA.123
also generates invalid rpm version. They say similar problem appears in other package managers, but i have no details.
Current behavior comes from regex replacement of [^a-zA-Z0-9]
symbols with universal separator. Now this separator is hardcoded in core and has dash = -
as default value. I just want to add config parameter to specify other separator, i.e. dot = .
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.
How do we make this unstale?
Sorry for allowing this to become stale without responding. I think this is related to what's being discussed in #2065.
As code has changed and moved a lot since this was created, the replacement being mentioned is now found here:
https://github.com/GitTools/GitVersion/blob/34b21cb9c1e3160766c231d5f981d13f5ca50675/src/GitVersion.Core/Configuration/ConfigExtensions.cs#L138
Thanks for re-opening. I have the same use case for RPM versioning for SLES/OpenSUSE-based RPMs.
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.
This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions
Hi there.
What I'm confused about: If you are defining a different separator then the result is not a semantic version number anymore. I want to point out that the head line of this tool is: From git log to SemVer in no time. Might it be not possible to replace the dash with dot after the execution with e.g. a cmd script?
@asbjornu : Is this really something we need to support?
@HHobeck, I think this has enough interest that we should consider it. #2065 outlines some of the package managers that aren't compatible with SemVer2 and that we quite easily should be able to support:
- Python
- Ruby Gems
- Docker
- Maven
I think @pniederlag's suggestion may be a flexible way to fix this:
In general I'd always think some formatting-string with attached variables (like I can use {branchName} on branches.XX.tag="dev-{BranchName}" has great flexibility, if {PreReleaseNumber} was available (and baked in by default), anyone trying to get rid of it could just get that done.
This feels like something we should be able to tackle more easily with a new CLI (something like gitversion --format '{Any}.{Variable}.{Goes}-{Here}
), but I think we should explore solving it without a new CLI as well.