无法在本地或远程找到“开发”或“主”分支 - 语义gitversion

问题描述

我有一个 azure 仓库,它有认分支“main”。

另外,我在 yml 文件中有一个用于语义版本控制的任务。

- task: gittools.gitversion.gitversion-task.GitVersion@5
  displayName: Get Semantic Git Version 

我遇到了以下错误

没有找到分支personal/release1的分支配置,下降 回到认配置 system.invalidOperationException: 可以 在本地或远程都找不到 'develop' 或 'master' 分支。

所以,我刚刚创建了一个开发分支并触发了构建,然后语义版本就成功了。

我们不想按照指南维护开发或主分支。

如何在不维护 master 和 develop 分支的情况下克服错误

谢谢

纳瑞什·埃德

解决方法

看起来 GitTools\GitVersion 尚不支持此功能,仍在等待解决方案。

但是为了克服这个你可以提供 GitVersion.yml 文件

mode: ContinuousDelivery
branches:
  master:
    regex: main
    mode: ContinuousDelivery
    tag:
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
  feature:
    regex: feature(s)?[/-]
    mode: ContinuousDeployment
  develop:
    regex: dev(elop)?(ment)?$
    mode: ContinuousDeployment
    tag: alpha
  hotfix:
    regex: hotfix(es)?[/-]
    mode: ContinuousDeployment
    tag: beta
  release:
    regex: release(s)?[/-]
    mode: ContinuousDeployment
    tag: rc
ignore:
  sha: []

然后像这样使用

steps:
- task: GitVersion@5
  inputs:
    runtime: 'core'
    configFilePath: 'GitVersion.yml'
    updateAssemblyInfo: true
,

GitVersion 任务已弃用。它使用旧版本(5.0.1)的 GitVersion,导致上述错误。建议改用 GitTools bundle extension。你可以在你的项目中安装 GitTools 扩展。见下面的例子;

- task: gitversion/setup@0
  displayName: Install GitVersion
  inputs:
    versionSpec: '5.x'
 
- task: gitversion/execute@0
  

请查看 document 以了解更多用法。

您也可以使用 UseGitVersion 任务。并通过指定 versionSpec 使用最新的 5 版本。

- task: UseGitVersion@5
  displayName: gitversion
  inputs: 
   versionSpec: 5.x
  enabled: true

或者您可以使用 Krzysztof Madej 提到的 GitVersion.yml 配置文件将主分支映射到主分支。

mode: ContinuousDelivery
branches:
  master:
    regex: main
    mode: ContinuousDelivery

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...