question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] 5.6.5 Does not recognise master as a source-branch

See original GitHub issue

GitVersion 5.6.5 fails to calculate a version for our latest merge to master. “An unexpected error occurred: GitVersion.Configuration.ConfigurationException: Branch configuration ‘breaking’ defines these ‘source-branches’ that are not configured: ‘[master]’”.

Expected Behavior

GitVersion calculates a new version for the latest merge to master.

Actual Behavior

It fails to generate a version.

C:\buildAgent\work\8279e39e642aeaf7\MyProject\build\build.ps1 : INFO [02/08/21 9:24:27:82] Applicable
build agent found: 'TeamCity'.
INFO [02/08/21 9:24:27:86] Working directory: C:\buildAgent\work\8279e39e642aeaf7\MyProject\build
INFO [02/08/21 9:24:27:89] Branch from build environment: refs/heads/master
INFO [02/08/21 9:24:27:89] Project root is: C:\buildAgent\work\8279e39e642aeaf7\
INFO [02/08/21 9:24:27:89] DotGit directory is: C:\buildAgent\work\8279e39e642aeaf7\.git
INFO [02/08/21 9:24:27:89] Begin: Normalizing git directory for branch 'refs/heads/master'
  INFO [02/08/21 9:24:27:94] One remote found (origin ->
'https://git-server/scm/MyProject.git').
  INFO [02/08/21 9:24:27:94] Skipping fetching, if GitVersion does not calculate your version as expected you might
need to allow fetching or use dynamic repositories
  INFO [02/08/21 9:24:27:95] Updating local branch master to point at 3deb3f6 Merge pull request #293 in
MyProject from feature/latest-feature to master
  INFO [02/08/21 9:24:28:02] Skipping update of 'refs/remotes/origin/refactor/a-refactor' as it already
matches the remote ref.
  INFO [02/08/21 9:24:28:02] Skipping update of 'refs/remotes/origin/spike/a-spike' as it already matches the
remote ref.
  INFO [02/08/21 9:24:28:03] HEAD points at branch 'refs/heads/master'.
  INFO [02/08/21 9:24:28:03] End: Normalizing git directory for branch 'refs/heads/master' (Took: 134.79ms)
  INFO [02/08/21 9:24:28:05] Begin: Loading version variables from disk cache
    INFO [02/08/21 9:24:28:05] Cache file
C:\buildAgent\work\8279e39e642aeaf7\.git\gitversion_cache\7286C5B59843A8EFFCC658F1495ED9B50FADA2E1.yml not found.
  INFO [02/08/21 9:24:28:05] End: Loading version variables from disk cache (Took: 1.27ms)
  ERROR [02/08/21 9:24:28:18] An unexpected error occurred:
GitVersion.Configuration.ConfigurationException: Branch configuration 'breaking' defines these 'source-branches' that
are not configured: '[master]'
See https://gitversion.net/docs/configuration for more info
   at GitVersion.Configuration.ConfigurationBuilder.ValidateConfiguration(Config config)
   at GitVersion.Configuration.ConfigurationBuilder.Build()
   at GitVersion.Configuration.ConfigProvider.Provide(String workingDirectory, Config overrideConfig)
   at GitVersion.Configuration.ConfigProvider.Provide(Config overrideConfig)
   at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions)
   at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__3()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at GitVersion.VersionCalculation.NextVersionCalculator.get_context()
   at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion()
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables()
   at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions)
  INFO [02/08/21 9:24:28:18] Attempting to show the current git graph (please include in issue):
  INFO [02/08/21 9:24:28:18] Showing max of 100 commits
  INFO [02/08/21 9:24:28:41] *   3deb3f6 77 seconds ago  (HEAD -> master, origin/master)
|\
| * 54d51b0 3 days ago
|/
*   0e71916 3 days ago  (tag: 0.93.0)
|\
| * 04854f7 3 days ago
|/
*   fe91a20 3 days ago  (tag: 0.92.0)
|\
| * 378b105 3 days ago
| * c7ec444 3 days ago
|/
*   7ff164f 4 days ago  (tag: 0.91.1)

Steps to Reproduce

Use this custom GitVersion configuration. Merge into master, attempt to calculate a new master version.

mode: Mainline
branches:
  breaking:
    regex: breaking[/]
    mode: ContinuousDeployment
    increment: Major
    source-branches: ['master']
    is-release-branch: false
  feature:
    regex: feature[/]
    mode: ContinuousDeployment
    increment: Minor
    source-branches: ['master']
    is-release-branch: false
  bugfix:
    regex: bugfix[/]
    mode: ContinuousDeployment
    increment: Patch
    source-branches: ['master']
    is-release-branch: false
  refactor:
    regex: refactor[/]
    mode: ContinuousDeployment
    increment: Patch
    source-branches: ['master']
    is-release-branch: false
  ci:
    regex: ci[/]
    mode: ContinuousDeployment
    increment: Patch
    source-branches: ['master']
    is-release-branch: false
  ci:
    regex: test[/]
    mode: ContinuousDeployment
    increment: Patch
    source-branches: ['master']
    is-release-branch: false
tag-prefix: 'v'
ignore:
  sha: []

Context

Our master is always shippable so every merge must have a new release version. The custom configuration automatically generates a new version according to the prefix of the merged branch.

Your Environment

Using the GitVersion.CommandLine package on Windows. Fails on both CI Build on TeamCity and locally.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
arturciccommented, Feb 8, 2021

Yes, working on it

2reactions
lankaapuracommented, Feb 8, 2021

We are also facing the same issue, and 5.6.4 seems to be working.

@sairamb87 you can update the pipeline step to use exact version until we have a fix.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

A pull request against master with specific source branch ...
Scenario 1: The pipeline was triggered when the pull request is created, but the stages/jobs/tasks with the condition you showed don't run. Then ......
Read more >
Build fails because of incorrect Build.SourceBranch ...
Issue Description. The variable Build.SourceBranch is documented to have this format for Git repositories: Git repo branch: refs/heads/master ...
Read more >
Chapter 4. Pipelines OpenShift Container Platform 4.10
Before this update, when a PipelineRun object could not be created, the error received from the Tekton controller was not reported to the...
Read more >
PHP
The mission of the CVE® Program is to identify, define, and catalog publicly disclosed cybersecurity vulnerabilities.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found