节点:如何在TFS上将package.json版本用作“Build Number Format” [英] Node: How to use package.json version as 'Build Number Format' on TFS

查看:121
本文介绍了节点:如何在TFS上将package.json版本用作“Build Number Format”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家好,

TFS制作用于构建web / javascript项目的工具。我的项目同时使用npm和gulp。作为节点项目的典型,我的项目版本存储在package.json中。

TFS prodives tools to build web/javascript projects. My project uses both npm and gulp. As typical for a node project my project version is stored in package.json.

如何将此数字用作内部版本号格式?

How can I use this number as a build number format?

我的gulp.js版本已生成一个version.txt文件和一个evnironment变量 包含版本。如何将其用作内部版本号格式?

My gulp.js build already produces a version.txt file and an evnironment variable containing the version. How can I use this as a build number format?

在Jenkins中,我能够从版本文件格式化我的内部版本号,如下所示: #$ {BUILD_NUMBER} $ {FILE, path =" build / version.txt"}($ {GIT_BRANCH})

In Jenkins I was able to format my build number from the version file like this: #${BUILD_NUMBER} ${FILE,path="build/version.txt"} (${GIT_BRANCH})

TFS中有类似的东西吗?

Anything similar possible in TFS?

我试过'#$ (Build.BuildNumber)$(GIT_TAG)($(Build.SourceBranchName))'生成'#$(Build.BuildNumber)$(GIT_TAG)(主)'?

I tried '#$(Build.BuildNumber) $(GIT_TAG) ($(Build.SourceBranchName))' which produces '#$(Build.BuildNumber) $(GIT_TAG) (master)'?!

BR

Chris

推荐答案

你好
节点。来自package.json的TFS内部版本号格式

Hi Node. TFS Build Number Format from package.json,

感谢您在此发帖。

我认为您在TFS中使用了Vnext Build。在
内部版本号格式列中,我们只能使用
代币
由TFS提供。您还可以使用一些
预定义变量
,例如:Build.DefinitionName, Build.DefinitionVersion,Build.QueuedBy,Build.QueuedById,Build.SourceBranchName ...

I think you used Vnext Build in TFS. In the Build number format column, we could only use the Tokens which provided by TFS. You could also use some Predefined Variables, like: Build.DefinitionName, Build.DefinitionVersion, Build.QueuedBy, Build.QueuedById,Build.SourceBranchName…

但我们无法使用大部分内容它们的构建数字格式如下:
Build.BuildNumber。变量表示已完成构建的名称,它等于构建号本身的值。此变量的典型用法是使其成为您在存储库选项卡上指定的标签格式的一部分。

But we could not use most part of them in Build number format like: Build.BuildNumber. The variable represent the name of completed build, it equals the value of Build number itself. A typical use of this variable is to make it part of the label format, which you specify on the repository tab.

您无法使用该版本存储在package.json中。如果您未在
变量标签中指定变量,则无法直接使用

You could not use the version is stored in package.json. And there is no


(GIT_TAG)变量。所以你会得到结果
(GIT_TAG) variable can be used directly if you do not specify the variable in Variables tab. So you will get the result #


(Build.BuildNumber)
(Build.BuildNumber)


这篇关于节点:如何在TFS上将package.json版本用作“Build Number Format”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆