如何重置VSTS计数器?

问题描述 投票:0回答:2
我们需要重置VSTS计数器。我看不到通过UI做到这一点的任何方法。可以通过直接调用

reset buildcounterRESTAPI来做到这一点,但是为了做到这一点,您需要知道计数器ID,您应该能够通过调用weaction a defacity a Rest API来找到答案。不幸的是,无论我做什么确定定义呼叫都不返回构建定义counter.我想念什么?

Microsoft的Scott Dallamura写了this

线程:
azure-devops azure-pipelines
2个回答
2
投票

计数器功能是实验性的,并在三月的 今年。我不确定它是如何进入文档的,但是 我会确保清理它。 我也没有成功地在API呼叫中获取

counterId

在解决方法时,您可以重置构建号的修订版,如果更改构建定义名称,只需添加/删除字符。

试图重置计数器变量,您可以使用GUID前缀创建一个新变量。 this解决方案创建重复的计数器,这可能不是理想的,但这使您能够恢复为先前的计数器值,如有必要。

请参见以下YAML代码段

variables: ... #Change this Guid if you require a reset seed on the same value. resetCounterGuid: 'efa9f3f5-57fb-4254-8a7a-06d5bb365173' buildrevision: $[counter(format('{0}\\{1}',variables['resetCounterGuid'],variables['YOUR_DEFINED_VARIABLE']),0)] ...


1
投票
variables: major: 1 # define minor as a counter with the prefix as variable major, and seed as 100. minor: $[counter(variables['major'], 0)]

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.