Skip to content
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

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

Closed
WesToleman opened this issue Feb 8, 2021 · 10 comments · Fixed by #2588
Closed

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

WesToleman opened this issue Feb 8, 2021 · 10 comments · Fixed by #2588
Assignees
Labels
Milestone

Comments

@WesToleman
Copy link

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.

@WesToleman WesToleman added the bug label Feb 8, 2021
@sairamb87
Copy link

sairamb87 commented Feb 8, 2021

We are facing similar error as reported by WesToleman, today we are unable to generate a build using Azure Devops, and its failing across different branches while calculating the newer version

Version: GitVersion.Tool 5.6.5 x64
Build Agent: Azure DevOps

ERROR [02/08/21 4:51:07:31] An unexpected error occurred:
GitVersion.Configuration.ConfigurationException: Branch configuration 'bugfix' 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) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigurationBuilder.cs
at GitVersion.Configuration.ConfigurationBuilder.Build() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigurationBuilder.cs
at GitVersion.Configuration.ConfigProvider.Provide(String workingDirectory, Config overrideConfig) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigProvider.cs
at GitVersion.Configuration.ConfigProvider.Provide(Config overrideConfig) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigProvider.cs
at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs:line 30
at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.b__3() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at System.Lazy1.get_Value()

ERROR [02/08/21 4:51:07:31] An unexpected error occurred:
GitVersion.Configuration.ConfigurationException: Branch configuration 'bugfix' 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) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigurationBuilder.cs
at GitVersion.Configuration.ConfigurationBuilder.Build() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigurationBuilder.cs
at GitVersion.Configuration.ConfigProvider.Provide(String workingDirectory, Config overrideConfig) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigProvider.cs
at GitVersion.Configuration.ConfigProvider.Provide(Config overrideConfig) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\ConfigProvider.cs
at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs
at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.b__3() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at System.Lazy1.get_Value()
at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs
at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs
at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs
at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs
at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs
at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 32
at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs
at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs
INFO [02/08/21 4:51:07:31] Attempting to show the current git graph (please include in issue):
INFO [02/08/21 4:51:07:31] Showing max of 100 commits

@lankaapura
Copy link

lankaapura commented 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

@sairamb87
Copy link

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

@lankaapura, Thank you 👍

Yes, 5.6.4 is working fine, and we have already updated our pipelines to use this version, until we get a fix for 5.6.5

@arturcic arturcic self-assigned this Feb 8, 2021
@asbjornu
Copy link
Member

asbjornu commented Feb 8, 2021

I assume this is related to #2573.

@arturcic
Copy link
Member

arturcic commented Feb 8, 2021

Yes, working on it

arturcic added a commit to arturcic/GitVersion that referenced this issue Feb 8, 2021
arturcic added a commit to arturcic/GitVersion that referenced this issue Feb 8, 2021
arturcic added a commit to arturcic/GitVersion that referenced this issue Feb 8, 2021
arturcic added a commit to arturcic/GitVersion that referenced this issue Feb 8, 2021
arturcic added a commit that referenced this issue Feb 8, 2021
@arturcic arturcic added this to the 5.6.6 milestone Feb 8, 2021
@lankaapura
Copy link

Thanks @arturcic for getting it fixed fast 👍 when can we expect the new release/patch?

@github-actions
Copy link

github-actions bot commented Feb 8, 2021

🎉 This issue has been resolved in version 5.6.6 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

@arturcic
Copy link
Member

arturcic commented Feb 8, 2021

Can you all confirm it is fixed?

@sairamb87
Copy link

Can you all confirm it is fixed?

@arturcic Thanks for resolving this issue, 5.6.6 version is working as expected 👍

@arturcic
Copy link
Member

arturcic commented Feb 8, 2021

@sairamb87 thanks for the confirmation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants