Search code examples
azure-devopsazure-pipelines

Is there still no way to reset the counter in the Azure pipeline?


I use the old Azure Pipeline (with UI, no yaml) with a self-hosted agent. In order to version my project I did the following: I declared two variables on the tab "Variables" named Major and Minor. Then I declared the variable Revision with the following value: $[counter(format('{0}.{1}', variables['Major'], variables['Minor']),11)] (you may ask why the revision starts with 11. That is simply the prerequisite for my project, I cannot change it). Finally, I declared the variable named Version with the value $(Major).$(Minor).$(Revision).0.

Summarized (the values ​​for major and minor were chosen at random):

Major = 1
Minor = 2
Revision = $[counter(format('{0}.{1}', variables['Major'], variables['Minor']),11)]
Version = $(Major).$(Minor).$(Revision).0

The code above means that the version is incremented starting with the number 11 for the Revision:

1.2.11.0 // first run
1.2.12.0 // second run
1.2.13.0 // third run
and so on

The question is: How can I force the pipeline to reset the value that was saved for the counter? I already tried to delete Revision and Version (and thus also the counter), tried to delete the .json file with the settings for the current pipeline, but it seems to have nothing to do with the counter value. The only thing that helped me was the cloned version of the pipeline. For this cloned version the counter is set to 11 again.

Of course, I have seen How to reset VSTS counter?. Unfortunately, I cannot use the proposed solution. In addition, the mentioned question is relatively old and I thought someone might have found another solution.


Solution

  • Unfortunately, there is no default way to reset the counter yet. You may submit a suggestion at website below:

    https://developercommunity.visualstudio.com/content/idea/post.html?space=21