3

Within my YML file I am using a patch variable with a counter to have separate patch numbers based on pull request build and not-PR

patch: $[counter(format('{0}-{1}', ne(variables['Build.Reason'], 'PullRequest'), variables['minor']), 0)] # True for CI/Manual. False for PR.

Now this is somewhat confusing as my PR/not-PR build numbers will overlap and PR numbers will eventually race ahead

How can I say set my major version to 0 if the Build Reason is PR? I will need to do this on the variable declaration rather than in a script so the visible build number is 0.1.x

Something like this maybe??

  major: $[if (ne(variables['Build.Reason'], 'PullRequest')), '1', '0']

The documentation appears somewhat limited, but I assume there is a way?

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#functions

enter image description here

bla9x
  • 469
  • 7
  • 17
  • An update from OP. I decided to give up on this realising that once we move our release to AZDO from Octopus our selection of builds to choose from is going to be a massive mess. Have now split out all of the logic into a template that is referred to by PR and CI definitions. The CI builds pass through a truthy variable in order to push artifacts – bla9x Jun 04 '19 at 21:07

0 Answers0