GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

Defaults for pre-release-weight

Open tobiasdiez opened this issue 5 years ago • 26 comments

We are using WeightedPreReleaseNumber to create a unique and increasing version number. Everything works fine in principle. However, when releasing a new beta we need to manually change the tag and the pre-release-weight in the configuration file. Is there a way to specify that certain pre-releases correspond to given weights, so that a simple push of a tag 2.0.0-beta is sufficient to set the correct pre-release-label and pre-release-weight?

tobiasdiez avatar Dec 16 '19 12:12 tobiasdiez

Will the fix implemented in #2003 help in any way?

asbjornu avatar Jan 03 '20 10:01 asbjornu

@asbjornu @pi3k14 As far as I understand https://github.com/GitTools/GitVersion/pull/2003, it improves the calculation of the commits-since-tag value. Thus, it doesn't resolve this issue with the pre-release-weight.

tobiasdiez avatar Jan 03 '20 11:01 tobiasdiez

@tobiasdiez #2003 improves the calculation of PreReleaseNumber. I understand that pre-release-weight is used together with PreReleaseNumber to calculate the actual PreReleaseTag (but I don't know much about the concept).

pi3k14 avatar Jan 03 '20 12:01 pi3k14

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 Apr 02 '20 12:04 stale[bot]

There is still no solution if I'm not mistaken...

tobiasdiez avatar Apr 02 '20 13:04 tobiasdiez

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 Jul 01 '20 17:07 stale[bot]

...

tobiasdiez avatar Jul 01 '20 21:07 tobiasdiez

@tobiasdiez, we accept pull requests. As you seem to be the only person interested in this feature, I think you will have to take it upon yourself to implement it. There is no paid labour to work on GitVersion. We are all investing our spare time on this.

asbjornu avatar Jul 01 '20 23:07 asbjornu

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 Sep 30 '20 03:09 stale[bot]

Still relevant for us. I haven't found the time to dive into the code yet, so if somebody else would like to implement it, that would be awesome.

tobiasdiez avatar Sep 30 '20 06:09 tobiasdiez

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 Dec 29 '20 14:12 stale[bot]

...

tobiasdiez avatar Dec 29 '20 16:12 tobiasdiez

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 Jun 02 '21 17:06 stale[bot]

...

tobiasdiez avatar Jun 03 '21 08:06 tobiasdiez

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 Mar 02 '22 11:03 stale[bot]

Still not implemented.

tobiasdiez avatar Mar 02 '22 12:03 tobiasdiez

If you see the following figure then we have alread a fallback mechanism: image

Unfortunately the branch related property PreReleaseWeight defaults to zero if it has not been specified. Thus maybe we need to consolidate the property LabelPreReleaseWeight (in GitVersionConfiguration) and PreReleaseWeight (in BranchConfiguration) to one property and make it branch related!?

HHobeck avatar Mar 16 '23 09:03 HHobeck

@tobiasdiez Could you please provide us an integration test to illustrate and ensure your scenario? Please take the version from main branch.

[Test]
public void IntegrationTest()
{
    var configuration = GitHubFlowConfigurationBuilder.New
        .WithBranch("main", branchBuilder => branchBuilder
            .WithVersioningMode(VersioningMode.ContinuousDelivery)
            .WithLabel("gamma").WithIncrement(IncrementStrategy.Patch)
        ).Build();

    using var fixture = new EmptyRepositoryFixture("main");

    fixture.MakeACommit();

    // ✅ succeeds as expected
    fixture.AssertFullSemver("0.0.1-gamma.1+1", configuration);

    fixture.ApplyTag($"0.0.{patchNumber}-alpha.1");

    // ❌ expected: 0.0.{patchNumber}-gamma.1+1
    fixture.AssertFullSemver($"0.0.{patchNumber}-gamma.1+0", configuration);
}

HHobeck avatar Mar 16 '23 09:03 HHobeck

I don't know how to write a test for this, as it concerns a missing feature and not a bug.

Essentially, what we would like to have is a customizable mapping from commited tags to the default pre-release-weight and pre-release-label, say

alpha -> 15000, 'alpha'
beta -> 30000, 'test'

Then WeightedPreReleaseNumber and PreReleaseLabel should be the following:

  • No tag, first commit: 1, ''
  • Tag with alpha: 15001, 'alpha'
  • next commit: 15002, 'alpha'
  • Tag with beta: 30001, 'test'

tobiasdiez avatar Mar 18 '23 09:03 tobiasdiez

Okay great idea. Please feel free and implement this feature if you need this and provide a PR. :)

HHobeck avatar Mar 20 '23 06:03 HHobeck

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 19 '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]