[英]How can I control my build number with Azure DevOps?
I get so many frustrations with Azure DevOps.我对 Azure DevOps 感到非常沮丧。 In my Build number format I would like to have both在我的内部版本号格式中,我想同时拥有
I'm not using YAML format.我没有使用 YAML 格式。 I use the classic interfaces with the option page to set my build format.我使用带有选项页面的经典界面来设置我的构建格式。 At this moment I have this:此刻我有这个:
It work except each month the r number restart at 0. I want it to continue.它可以工作,除了每个月 r 编号从 0 重新开始。我希望它继续。
EDIT编辑
I still didn't decided my final format.我还没有决定我的最终格式。 I would like to understand all the possibilities.我想了解所有的可能性。 Now I discovered the $(BuildID)
property I have another question.现在我发现了$(BuildID)
属性,我还有一个问题。 Is it possible to have something similar to $(Rev:r)
variable but that only check the left part of my build number.是否有可能有类似于$(Rev:r)
变量的东西,但只检查我的内部版本号的左侧部分。
Example:例子:
4.16.$(SequenceFor[4.16]).$(BuildID)
In fact I would like to manually set the Major and Minor version and let the system update one by one the Build and use the Revision for the global $(BuildID)
.事实上,我想手动设置 Major 和 Minor 版本,让系统一一更新 Build 并使用全局$(BuildID)
的 Revision。
The $(rev:r)
is restarted when the build number changes in any character, so this is the reason why it's restarted whenever the major/minor or the sate changed. $(rev:r)
在任何字符的内部版本号更改时都会重新启动,因此这就是每当主要/次要或状态更改时它都会重新启动的原因。
So if you want to use an incremental unique number you can't use the $(rev:r)
because then it will be restarted each build.因此,如果您想使用增量唯一编号,则不能使用$(rev:r)
,因为每次构建都会重新启动它。
If you want a number that depends on the major and the minor numbers you need to use the counter
expression :如果您想要一个取决于主要和次要数字的数字,您需要使用counter
表达式:
Create 2 variables:创建 2 个变量:
major-minor
= 4.16
major-minor
= 4.16
And a variable that depends on his value and also is a counter:还有一个取决于他的值的变量,也是一个计数器:
revision
= $[ counter(variables['major-minor'],0) ]
revision
= $[ counter(variables['major-minor'],0) ]
The build number will be:内部版本号将是:
$(major-minor).$(revision).$(Build.BuildId)
Now, if you will change the major-minor
(to 4.17
or 5.16
) the revision
will be again 0
.现在,如果您将更改major-minor
(更改为4.17
或5.16
),则revision
将再次0
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.