Skip to content

Using GitVersion on Teamcity crashes on InvalidOperationException  #1825

@jakubsuchybio

Description

@jakubsuchybio

Hi,
long story. I'll try to be short.
We are migrating from SVN to GIT.
We already migrated prototype, created TeamCity configuration to use GitVersionTask and it worked.
Then we found, that commit author names and emails were wrong.
We did new migration which fixed commit authors, but broke GitVersioning on Teamcity.
We didn't change anything inside GitVersion.yml.

When I install GitVersionTask as nuget to one of 160+ projects, it creates the version fine on my dev machine with this GitVersion.yml

next-version: 3.0.0
assembly-versioning-scheme: MajorMinorPatch
mode: MainLine

When I switch mode to ContinuousDelivery it works on teamcity.
When I switch mode to ContinuousDeployment it works on teamcity.
I found this in one of these:
#1671
#1625
#453

However the ContinuousDelivery or ContinuousDeployment versioning is not what we want as the final versioning scheme.

Build logs from teamcity has this error:

System.InvalidOperationException: Sequence contains no matching element
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
at GitVersion.VersionCalculation.MainlineVersionCalculator.GetMainline(GitVersionContext context, Commit baseVersionSource)
at GitVersion.VersionCalculation.MainlineVersionCalculator.FindMainlineModeVersion(BaseVersion baseVersion, GitVersionContext context)
at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion(GitVersionContext context)
at GitVersion.GitVersionFinder.FindVersion(GitVersionContext context)
at GitVersion.ExecuteCore.<>c__DisplayClass7_0.<ExecuteInternal>b__0(IRepository repo)
at GitVersion.GitPreparer.WithRepository[TResult](Func`2 action)
at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache)
at GitVersion.SpecifiedArgumentRunner.Run(Arguments arguments, IFileSystem fileSystem)
at GitVersion.Program.VerifyArgumentsAndRun()

I tried to run the same command by hand:

gitversion.exe "C:\TeamCity\buildAgent\work\51009f2c24bb10ed" /output "buildserver" /UpdateAssemblyInfo

With added /verbosity debug, but it didn't log anything additional...

Here is the full log of that versioning step:
https://gist.github.com/jakubsuchybio/6bcc7bcc230c3a16e3cacfa29e993937

I don't know what to do here. I am pretty confident that this is a bug in GitVersion sw. Can you please try to fix this? When it showed at least 2-4times already?

If you need any additional info or some tests, just let me know.

Thanks Jacob :)

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