-
Notifications
You must be signed in to change notification settings - Fork 655
Identify multiple builds against same commit/tag/branch on Team Foundation Build (vNext) #1157
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
Comments
I think the ideal solution is to allow GitVersion to take some sort of build_number or revision parameter which can be used, surfaced in variables and in the build metadata. That way you can pass in an external variable into GitVersion and it will affect the build number. Would love a PR for this :) |
The discussion at #648 raised a similar issue. Going to close it in favor of this. I am now more keen on the idea than I was then |
Where would the build number be used? If it's in any of the I'm envisioning something like this: assembly-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER}'
assembly-file-versioning-format: '{Major}.{Minor}.{Patch}'
assembly-informational-format: '{InformationalVersion}-{env:MY_ENV_VAR}' The novel thing here is the PS: The discussion in #648 concludes that this is something we don't want to do. That conclusion doesn't hold up anymore, I think. This feature has been asked for consistently and frequently over the years and while I think it's a great feature of GitVersion to be able to produce the same version number wherever a commit is built, that might not be a requirement for everyone. See #1367 (comment) for the requirements on traceability in the medical industry, for instance. |
Regarding the discussion in #648: I think the conclusion over there is still valid. But here we're taking about something else. As far as I understood, the decision was against the expansion of env-vars within the config.yml ( We need some fall-back though in case the env var is not set. In our case we want the build number from the CI-server as forth digit in the AssemblyFileVersion (and only there; to properly support Windows Installer's "Major Upgrades", see #1366). On a developer's machine I don't want to set dummy build server env vars. What do you think about the following?
In a format string we could have either
|
@ruhullahshah can I use this I'm currently pushing NuGet packages as part of my PR builds in Azure DevOps. But if I use |
@sanderaernouts For the first part of your query, AFAIK you will have to add support for enabling For the second part, you could achieve this without any changes by setting the An example might help. In your GitVersion.yml, set: |
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. |
Support for environment variables in the |
Dear all,
I am trying to figure out the best practice to distinguish between multiple builds against the same commit/tag/branch. My current project is on TFS (on premise). TFS (as well VSTS) stores the build configuration separately from the source repository. Hence, multiple builds against the same commit/tag/branch could result in different artifacts. I would like the build metadata to reflect this.
Before using GitVersion we have solved this by using the revision counter from the TFS Build. The default mechanism of TFS determines the build number before any build task is invoked. There is a build number replacement token
$(Rev:.r)
that can be used to make the build number unique when nothing else changed (docs). We used to rely on the build number, and parse the SemVer and build metadata from it.As explained in the docs, GitVersion doesn't play nice with the revision number replacement token on the build number because of delayed expansion in the GitVersion TFS task. That leaves the problem that multiple builds against the same commit/tag/branch will result in the same output of GitVersion.
I am wondering how others cope with this issue. I am willing to contribute to the docs if there is a clear consensus on how to handle this. If there isn't, then adding something to the GitVersion output that is sufficiently unique and sortable (i.e. a timestamp) might be a way forward.
I am interested in hearing you opinions.
The text was updated successfully, but these errors were encountered: