带有$(GitVersion.NuGetVersion)的标签源使用变量名创建标签,而不是值 [英] Label Sources with $(GitVersion.NuGetVersion) creates Tag with variable name, not value
问题描述
在成功构建之后,将标签格式配置为 $(GitVersion.NuGetVersion)
,结果标记设置为 $(GitVersion。 NuGetVersion)
不是该变量的实际扩展值。
在构建输出日志中,有两个部分/计划:构建和最终构建。
据推测,一旦构建代理移动到第二部分/计划,所有可变上下文/状态都将丢失。
如果GitVersion变量的上下文在Finalize Build部分中丢失,那么我应该如何标记源代码和生成的GitVersion?
https://github.com/Microsoft/vsts-agent / issue / 716
实现我想要的结果的具体步骤:
- 设置VSTS Project / Repository / Build pre-reqs:
https://www.visualstudio.com/en-us/docs/build/scripts/git -commands#enable-scripts-to-run-git-commands - Git Docs用于标记(完整性):
https://git-scm.com/book/en/v2/Git-Basics-Tagging
我补充道2命令行任务(批处理任务将是一个更好的主意)与工具: git
:
- 参数:
标记-a $(GitVersion_NuGetVersion)-m通过构建自动标记v $(GitVersion_NuGetVersion) .BuildId))
- 参数:
push origin $(Build.BuildNumber)
After a successful build, having configured the Label Format as $(GitVersion.NuGetVersion)
, the resulting tag is set to $(GitVersion.NuGetVersion)
not the actual expanded value of that variable.
In the build output logging, there are 2 sections/plans: Build, and Finalize Build.
Presumably, all the variable context/state is being lost once the build agent moves to the second section/plan.
How am I supposed to tag the source with the resulting GitVersion if the context of the GitVersion variables are lost during the Finalize Build section?
https://github.com/Microsoft/vsts-agent/issues/716
Specific steps to achieve my desired result:
- Setup VSTS Project/Repository/Build pre-reqs:
https://www.visualstudio.com/en-us/docs/build/scripts/git-commands#enable-scripts-to-run-git-commands - Git Docs for tagging (for completeness):
https://git-scm.com/book/en/v2/Git-Basics-Tagging
I added 2 Command Line Tasks (a Batch Task would be a better idea) with Tool: git
:
- Arguments:
tag -a $(GitVersion_NuGetVersion) -m "Auto-Tagged v$(GitVersion_NuGetVersion) by Build ($(Build.BuildId))"
- Arguments:
push origin $(Build.BuildNumber)
这篇关于带有$(GitVersion.NuGetVersion)的标签源使用变量名创建标签,而不是值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!