New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build number partially controlled by repository file contents #1802
Comments
Pinging @ericsciple , who can double-check my work here. 😊 This might be easiest with YAML. You could have your first phase use powershell to read the repository file for your major.minor version. Then, export that value for use in another phase. Your second phase can import that variable, and use a counter expression with that variable as the variable name. |
Ah thanks @moswald that makes sense, I think using two phases was the bit I was missing. Out of interest is this possible without YAML? Is it possible to define a variable that uses a counter expression at phase level in the UI? |
We have created a new repository for all YAML related issues, please move the current issue to there. |
closing since answered. if anything left to answer, see the point above about moving to azure-pipelines-yaml |
Is this a YAML issue because the UI will never support this scenario? The original question did not mention YAML at all, it was only brought up as a possible solution. @simonness followup question also should be an indication that this is not a YAML only issue:
I am also interested in a non-YAML solution. As it currently stands, YAML does not support enough of the features we currently use, so we have decided to not start using it yet. Based on this response and #1547, it looks like there is no existing way in the UI to do this... the counter must be in the variables, and variables are evaluated at the start of the build. UI does not support output of task to be input of counter. |
This is correct. Designer build variables are evaluated at the start of the build, while YAML variables can be evaluated at the start of the phase. |
+1 @ahaleiii. I'd like to be able to set a build's build number in the way described without using yaml. If this is only possible with a counter expression at phase level, I'd like to raise a feature request to make it possible to define these using the UI. |
Please create a thread here on the Developer Community forums. We use the popularity ranking there to help drive future work. |
PD-41: Initial stab at versioning. This allows us to have services versioned major.minor.patch, with the major.minor portion controlled by a repo file (version.txt, so we can change it on branches etc) and the patch an automatic counter in Azure DevOps. Some history of me trying to do this before (without yaml) on the last project: microsoft/azure-pipelines-agent#1802 This is achieved with two jobs in the pipeline: - one to read the file, exporting the majorMinor version as a variable - the next job uses the majorMinor variable within a counter expression (so if the major minor version changes, the counter starts from zero again). This job then has a step to set the build number.
Looking for some help implementing the following versioning strategy in VSTS. We'd like to set a build's build number (in the form Major.Minor.Revision) in the following way:
@jessehouwing raised the a similar requirement in the comments of pull request #1489.
Our aim is to have a single build that supports this versioning strategy across several long lived branches in a repository.
There are a couple of ways to get close to implementing this:
$(MajorMinorVersion).$(Rev:r)
. The drawback of this is remembering to set the variable correctly when manually triggering builds on long lived branches.Write-Host "##vso[build.updatebuildnumber]build number"
. However we don't have the concept of$(Rev:r)
available to us here, so the best we can do is use the unique build id as the revision number. The drawback of this is the revision number does not increment from zero for new Major.Minor versions.@moswald I've taken a look at the new counter expressions, but not sure the strategy above is yet possible. Any guidance on any other ways to do this would be much appreciated :)
The text was updated successfully, but these errors were encountered: