Skip to content

[Feature] provide an option to choose which version type use to update Build.BuildNumber #2580

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

Closed
quasarea opened this issue Feb 2, 2021 · 5 comments

Comments

@quasarea
Copy link

quasarea commented Feb 2, 2021

I'm not entirely sure how it works, but when called from azure devops it updates pipeline version to current "FullSemVer"

I suspect it has to do with /output buildsystem and generated yml file, that is somehow gets propagated into Build.BuildNumber variable later on.

Currently there is no way of deciding on format of version and it would be great to be able i.e. to use SemVer rather then FullSemVer

Initially created at GitTools/actions#318 but it seems its handled by gitversion itself

@asbjornu
Copy link
Member

asbjornu commented Feb 2, 2021

This is a great suggestion, but I think, unfortunately, it points to the need for GitVersion to do less. Having to change GitVersion in order to have the AzDO Task change its behavior indicates that we have drawn the wrong boundaries around the different moving parts of our code and that the architecture needs to change.

Ideally, GitVersion should only produce version variables and then an AzDO Task or any other implementation of GitVersion can take these version variables and do whatever it pleases with them without having to change anything within GitVersion itself. #2262 and #2275 deals with this refactoring.

Introducing a configuration property in GitVersion.yml regarding this feels very wrong to me, as the configuration belongs in the AzDO Task. I'm not sure how we can fix this before we get v6 out the door.

@arturcic
Copy link
Member

arturcic commented Feb 2, 2021

I agree that would be a great addition, but in version 6 . There we have a clear separation of the version calculation and output, Maybe we add it to 6.0.0 milestone

@asbjornu asbjornu added this to the 6.0.0 milestone Feb 2, 2021
@quasarea
Copy link
Author

Workaround:

      - task: gitversion/execute@0
        displayName: Calculating version
        inputs:
          additionalArguments: /output file /outputfile $(Build.SourcesDirectory)\GitVersion.json

      - pwsh: |
          $GitVersion = ConvertFrom-Json -AsHashtable ( Get-Content -Raw -Path 'GitVersion.json' )
          Write-Host "##vso[build.updatebuildnumber]$($GitVersion.SemVer)"
        displayName: 'Update Build.BuildNumber'

@arturcic arturcic modified the milestones: 6.x, 7.x Feb 18, 2023
@github-actions
Copy link

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 github-actions bot added the stale label May 20, 2023
@github-actions
Copy link

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
@arturcic arturcic removed this from the 7.x milestone Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants