Skip to content

[Bug]Failed to try and guess branch to use. Move one of the branches along a commit to remove warning #2927

@hyabean

Description

@hyabean

Describe the bug
when build a tag commit on a jenkins agent, it failed and report
"[2021-11-29 16:47:39] WARN [11/29/21 16:47:39:51] An error occurred:
[2021-11-29 16:47:39] Failed to try and guess branch to use. Move one of the branches along a commit to remove warning"

Expected Behavior

build success

Actual Behavior

build failed

Possible Fix

if current commit tagged, not throw a excpetion.

throw new WarningException("Failed to try and guess branch to use. " + moveBranchMsg);

Steps to Reproduce

  1. add a Environment Variable in Windows "JENKINS_URL" in Windows, act as a jenkins agent
  2. open a powershell and execute:
mkdir gitversionErrorTest
cd gitversionErrorTest
git init
git.exe config remote.origin.url https://github.com/hyabean/GitVersionBuildFail.git # timeout=10
git.exe fetch --tags --force --progress -- https://github.com/hyabean/GitVersionBuildFail.git +refs/heads/*:refs/remotes/origin/* +refs/merge/*:refs/remotes/origin/merge/*
git.exe rev-parse "b309af2d6845182e643eb60ee06ebe9aecf8425e^{commit}" # timeout=10
git.exe config core.sparsecheckout # timeout=10
git.exe checkout -f b309af2d6845182e643eb60ee06ebe9aecf8425e
dotnet-gitversion ".\src\TcWinApp" -output file -outputfile src\TcWinApp\obj\gitversion.json

Context

CI failed after tag

Your Environment

企业微信截图_16382739727145

  • Version Used:
  • GitVersion Version 5.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions