Skip to content

Identify multiple builds against same commit/tag/branch on Team Foundation Build (vNext) #1157

@ralphhendriks

Description

@ralphhendriks

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions