I am trying to get some values based on the logic to form the version number for my dot net application.
I am using Azure devops and created a Pipeline (YAML). In the pipeline, I have created few variables, which gets the values by using some calculation logic. Below is the code.
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
old_date: '20210601'
latest_date: '20210603'
PSI: ($(latest_date)-$(old_date))/56+1
totalsprints: '($(latest_date)-$(old_date))/14'
sprint: '$(totalsprints)%4+1'
majorversion: '2.'
dot: '.'
name: '$(majorversion)$(Year:yy)$(PSI)$(dot)$(sprint)$(dot)$(Date:MMdd)'
the above logic has a default date set in old_date and it is subtracted from latest_date and divided by 56 to get some value. the next value of the resultant is our PSI. the same way sprint is calculated. this is done in order to form the version number of our Dot Net application. something like this "2.212.2.0312"
The same type of logic works in groovy script in Jenkins. But here, it shows PSI = ($(latest_date)-$(old_date))/56+1 and doesnt evaluate anything.
Appreciate your response on the same.