Skip to content

Fix the pull request hack needed to build pulls in TeamCity #31

@andreasohlund

Description

@andreasohlund

At the moment we can't figure out the branchname (name of the pull) from the git info so we have to add a build param to each build:

https://github.com/Particular/GitFlowVersion/blob/master/GitFlowVersion/TeamCity.cs#L20

This is a maintenance pain!

@nulltoken any ideas on how we can solve this? (doesn't seem like the git directory on the buildagent contains this info even though TC seems to capture it ok)

This is the ex from LibGit2Sharp we get


[src\NServiceBus.RabbitMQ\NServiceBus.Transports.RabbitMQ.csproj] UpdateAssemblyInfo
[08:23:27][UpdateAssemblyInfo] GitFlowVersionTask.UpdateAssemblyInfo
[08:23:27][GitFlowVersionTask.UpdateAssemblyInfo] Version not in cache. Calculating version.
[08:23:27]
[GitFlowVersionTask.UpdateAssemblyInfo] Error occurred: LibGit2Sharp.InvalidSpecificationException: An error was raised by libgit2. Category = Reference (InvalidSpecification).
The given reference name '(no branch)' is not valid
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_reference_lookup(RepositorySafeHandle repo, String name, Boolean shouldThrowIfNotFound)
   at LibGit2Sharp.ReflogCollection.GetEnumerator()
   at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
   at GitFlowVersion.FeatureVersionFinder.FindFirstCommitOnBranch() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\BranchFinders\FeatureVersionFinder.cs:line 61
   at GitFlowVersion.FeatureVersionFinder.FindVersion() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\BranchFinders\FeatureVersionFinder.cs:line 21
   at GitFlowVersion.GitFlowVersionFinder.FindVersion() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\GitFlowVersionFinder.cs:line 69
   at GitFlowVersion.VersionForRepositoryFinder.GetVersion(Repository repository) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionForDirectoryFinder.cs:line 18
   at GitFlowVersion.VersionCache.GetVersion(String gitDirectory) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionCache.cs:line 39
   at GitFlowVersionTask.UpdateAssemblyInfo.Execute() in c:\Code\Particular\GitFlowVersion\GitFlowVersionTask\UpdateAssemblyInfo.cs:line 57
[08:23:27][src\NServiceBus.RabbitMQ\NServiceBus.Transports.RabbitMQ.csproj] Project src\NServiceBus.RabbitMQ\NServiceBus.Transports.RabbitMQ.csproj failed.
[08:23:27][src\NServiceBus.RabbitMQ.sln] Project src\NServiceBus.RabbitMQ.sln failed.
[08:23:27][src\NServiceBus.RabbitMQ.sln.teamcity] Project src\NServiceBus.RabbitMQ.sln.teamcity failed.

Full build log:

http://builds.particular.net/viewLog.html?buildId=27764&buildTypeId=NServiceBusRabbitMQ_1Buil&tab=buildLog

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions