拉取请求的 GitVersion StackOverflow

GitVersion StackOverflow on Pull Requests

我 运行 遇到了本地 TFS2017 构建的问题。我们有一个带有 GitVersion 任务的项目,在使用拉取请求时找不到版本。我可以毫无问题地自行构建分支,但拉取请求一直持续到 GitVersion.exe 退出并出现 Whosebugexception。

我试过使用 "commits-before:" 忽略提交和 Pull Requests 的各种分支配置更改都无济于事。

日志中反复出现以下内容,直到出现异常...

Starting task: GitVersion  
Set workingFolder to default: D:\xxx\tasks\GitVersion.6.5   
Executing the powershell script: D:\xxx\tasks\GitVersion.6.5\GitVersion.ps1  
Current Directory:  D:\xxx\tasks\GitVersion.6.5 D:\xxx\_work\s  
Invoking GitVersion with D:\xxx\_work\s /output buildserver /nofetch /updateassemblyinfo true  
D:\xxx\tasks\GitVersion.6.5\GitVersion.exe D:\xxx\_work\s /output buildserver /nofetch /updateassemblyinfo true  
INFO [02/13/17 15:43:21:08] Working directory: D:\xxx\_work\s  
INFO [02/13/17 15:43:21:09] IsDynamicGitRepository: False  
INFO [02/13/17 15:43:21:11] Returning Project Root from DotGitDirectory: D:\xxx\_work\s\.git - D:\xxx\_work\s  
[02/13/17 15:43:21:11] Running on Windows.  
INFO [02/13/17 15:43:21:11] Applicable build agent found: VsoAgent.  
INFO [02/13/17 15:43:21:11] Branch from build environment: refs/pull/2336/merge  
INFO [02/13/17 15:43:40:31] IsDynamicGitRepository: False  
INFO [02/13/17 15:43:40:31] Returning Project Root from DotGitDirectory: D:\xxx\_work\s\.git - D:\xxx\_work\s  
INFO [02/13/17 15:43:40:31] Project root is: D:\xxx\_work\s  
INFO [02/13/17 15:43:40:31] DotGit directory is: D:\xxx\_work\s\.git  
INFO [02/13/17 15:43:40:36] IsDynamicGitRepository: False  
INFO [02/13/17 15:43:40:36] Returning Project Root from DotGitDirectory: D:\xxx\_work\s\.git - D:\xxx\_work\s  
INFO [02/13/17 15:43:40:36] Begin: Loading version variables from disk cache  
INFO [02/13/17 15:43:40:36] Cache file D:\xxx\_work\s\.git\gitversion_cacheBD4.yml not found.  
INFO [02/13/17 15:43:40:36] End: Loading version variables from disk cache (Took: 0.00ms)  
INFO [02/13/17 15:43:40:36] IsDynamicGitRepository: False  
INFO [02/13/17 15:43:40:36] Returning Project Root from DotGitDirectory: D:\xxx\_work\s\.git - D:\xxx\_work\s  
INFO [02/13/17 15:43:40:52] Using latest commit on specified branch  
INFO [02/13/17 15:43:40:52] Begin: Attempting to inherit branch configuration from parent branch  
INFO [02/13/17 15:43:40:58] HEAD is merge commit, this is likely a pull request using devops/gitver-testingv5 as base  
INFO [02/13/17 15:43:40:66] Begin: Finding branch source  
INFO [02/13/17 15:43:40:70] Begin: Found merge base of ded0 against hotfix/white-42630-customerrors-fix  
INFO [02/13/17 15:43:40:72] End: Found merge base of ded03 against hotfix/white-42630-customerrors-fix (Took: 15.63ms)  
INFO [02/13/17 15:43:40:72] Begin: Found merge base of ad42 against master  
INFO [02/13/17 15:43:40:72] Merge base was due to a forward merge, moving to next merge base  
INFO [02/13/17 15:43:40:72] End: Found merge base of ad42 against master (Took: 0.00ms)  
INFO [02/13/17 15:43:40:73] Begin: Found merge base of 665d against Release/1.47.0  
INFO [02/13/17 15:43:40:73] Merge base was due to a forward merge, moving to next merge base  
INFO [02/13/17 15:43:40:73] End: Found merge base of 665d against Release/1.47.0 (Took: 0.00ms)  
INFO [02/13/17 15:43:40:73] Begin: Found merge base of 05651 against Release/1.47.3  
INFO [02/13/17 15:43:40:73] End: Found merge base of 0565 against Release/1.47.3 (Took: 0.00ms)  
INFO [02/13/17 15:43:40:73] Begin: Found merge base of ab58 against Release/1.47.4  
INFO [02/13/17 15:43:40:73] End: Found merge base of ab58 against Release/1.47.4 (Took: 0.00ms)  
INFO [02/13/17 15:43:40:73] Begin: Found merge base of 4984 against Release/1.48.0  
INFO [02/13/17 15:43:40:73] Merge base was due to a forward merge, moving to next merge base  
INFO [02/13/17 15:43:40:73] End: Found merge base of 4984 against Release/1.48.0 (Took: 0.00ms)  
INFO [02/13/17 15:43:40:73] Begin: Found merge base of ad42 against Release/1.49.0  
INFO [02/13/17 15:43:40:73] Merge base was due to a forward merge, moving to next merge base  
INFO [02/13/17 15:43:40:75] End: Found merge base of ad42 against Release/1.49.0 (Took: 15.62ms)  
INFO [02/13/17 15:43:40:80] Begin: Found merge base of d782 against Release/2016-07-21_Release  
INFO [02/13/17 15:43:40:80] End: Found merge base of d782 against Release/2016-07-21_Release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:80] Begin: Found merge base of 6286 against Release/2016-08-04_Release  
INFO [02/13/17 15:43:40:80] End: Found merge base of 6281 against Release/2016-08-04_Release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:81] Begin: Found merge base of bfb7 against Release/2016-08-18_Release  
INFO [02/13/17 15:43:40:81] Merge base was due to a forward merge, moving to next merge base  
INFO [02/13/17 15:43:40:81] Merge base was due to a forward merge, moving to next merge base  
INFO [02/13/17 15:43:40:81] End: Found merge base of bfb7 against Release/2016-08-18_Release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:81] Begin: Found merge base of d7a5 against Release/2016-09-01_Release  
INFO [02/13/17 15:43:40:81] Merge base was due to a forward merge, moving to next merge base  
INFO [02/13/17 15:43:40:83] End: Found merge base of d7a against Release/2016-09-01_Release (Took: 15.63ms)  
INFO [02/13/17 15:43:40:83] Begin: Found merge base of 425c against Release/2016-09-15_Release  
INFO [02/13/17 15:43:40:83] End: Found merge base of 425c against Release/2016-09-15_Release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:83] Begin: Found merge base of f9df against Release/2016-09-29_release  
INFO [02/13/17 15:43:40:83] End: Found merge base of f9df against Release/2016-09-29_release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:84] Begin: Found merge base of 8b07 against Release/2016-10-07_Release  
INFO [02/13/17 15:43:40:84] End: Found merge base of 8b07 against Release/2016-10-07_Release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:84] Begin: Found merge base of 9be6 against Release/2016-10-13_release  
INFO [02/13/17 15:43:40:84] End: Found merge base of 9be6 against Release/2016-10-13_release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:84] Begin: Found merge base of 1e90 against Release/2016-10-27_release  
INFO [02/13/17 15:43:40:84] End: Found merge base of 1e90 against Release/2016-10-27_release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:84] Begin: Found merge base of 64f4 against Release/2016-11-10_Release  
INFO [02/13/17 15:43:40:84] End: Found merge base of 64f4 against Release/2016-11-10_Release (Took: 0.00ms)  
INFO [02/13/17 15:43:40:86] End: Finding branch source (Took: 203.13ms)  
INFO [02/13/17 15:43:40:86] Begin: Getting branches containing the commit ad42.  
INFO [02/13/17 15:43:40:86] Trying to find direct branches.  
INFO [02/13/17 15:43:40:86] No direct branches found, searching through tracked branches.  
INFO [02/13/17 15:43:40:87] End: Getting branches containing the commit ad42. (Took: 15.63ms)  
INFO [02/13/17 15:43:40:87] Found possible parent branches:   
WARN [02/13/17 15:43:40:91] Failed to inherit Increment branch configuration, no branches found.  
Falling back to feature/merge-rc-to-master branch config

如果我理解正确,您正在使用 GitVersion extension 并启用 "Automatically build pull requests" 分支策略,如下图所示:

我已经使用 GitVersion 任务创建了一个构建定义,当创建一个新的拉取请求时,该构建可以毫无问题地排队。您可以将我的设置与您的设置进行比较并尝试新的构建。

如有误解,请提供重现问题的详细步骤。

因此,基于 github 上的 comment,我将全局配置中的拉取请求的 Inheritance 更改为 None。这并没有解决问题,但它确实让我意识到版本控制尝试的每次迭代都会回到这个分支 feature/merge-rc-to-master 及其配置。

在尝试对该分支进行拉取请求并看到相同问题后,我们删除了该分支(PR 已被放弃,代码之前已添加到 master)。所有的 PR 现在都恢复正常了。

如有帮助

我有类似的问题,但在 AZ Devops git 存储库中。

gitVersion.yml 下的 master 分支部分我更新了 increment: Inheritincrement: Patch