GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

Add configuration param to define PreReleaseTag separator

Open kalmykov-sergey opened this issue 5 years ago • 10 comments

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 = .

kalmykov-sergey avatar May 08 '19 16:05 kalmykov-sergey

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.

stale[bot] avatar Aug 06 '19 17:08 stale[bot]

How do we make this unstale?

rkleinman-hpe avatar Mar 08 '22 16:03 rkleinman-hpe

Sorry for allowing this to become stale without responding. I think this is related to what's being discussed in #2065.

asbjornu avatar Mar 08 '22 17:03 asbjornu

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

asbjornu avatar Mar 08 '22 17:03 asbjornu

Thanks for re-opening. I have the same use case for RPM versioning for SLES/OpenSUSE-based RPMs.

rkleinman-hpe avatar Mar 08 '22 21:03 rkleinman-hpe

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.

github-actions[bot] avatar Jun 30 '23 11:06 github-actions[bot]

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.

github-actions[bot] avatar Sep 30 '23 11:09 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions

github-actions[bot] avatar Oct 30 '23 11:10 github-actions[bot]

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 avatar Nov 27 '23 08:11 HHobeck

@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.

asbjornu avatar Nov 28 '23 11:11 asbjornu