Azure-devops-docs: How can I get only the last version. And/or get the last version released number?

Created on 15 Feb 2019  Â·  18Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

How can I get only the last version. And/or get the last version released number?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 devops-cictech devopprod product-feedback

Most helpful comment

Universal Packages now supports wildcards such as *, 1.*, 1.2.*, etc as the version when downloading a package. Please see https://docs.microsoft.com/azure/devops/artifacts/quickstarts/universal-packages?view=azure-devops#downloading-the-latest-version for details.

All 18 comments

This would be a nice feature. Also, if you publish a universal package using the "Universal Publish" task during a release pipeline, you can set an output variable that gets populated with the package name and version in a single variable. For example,"package_name 1.0.0"

Is there a way to get these values in distinct variables? If you try to use this variable in a subsequent stage or action, the Universal Download task requires the name of the package and the version as separate, distinct fields.

I am trying to use universal packages to share state in between stages (maybe that is a wrong approach), but noticed this limitation of the output variable.

yes @remarkpk this feature would be great to share a state between stages. It is one of the reasons that I'm requesting it. :)

+1 - i'm having to email 100 users of the package for every new update, even when they are backward compatible non-breaking changes.

It's a bit hard to believe that it is not possible to have the task download the latest version of a universal package. Is this perhaps supported but the documentation is not showing how?

This will be supported in Release Management when you're using the Azure Artifacts artifact type in 1-2 weeks - the deployment is going out now. We'll also be adding the ability to get the latest version from the CLI sometime in Q2.

@alexmullans -- when you say "azure artifacts" artifact type, do you mean the "pipeline artifacts (preview)" feature?

@alexmullans - any news on when we will be able to select latest?

ping

@alexmullans @elbatk ^^^

@infix8 -- aka The Artist Formerly Known As @alexmullans (or something) -- is this a thing now, or what?

I'm assuming all of these pings are for getting latest from the CLI. That feature is "On Deck" for our dev team - meaning it's ready to be picked up whenever we get some bandwidth. We have a couple of other things we're prioritizing now but it should get picked up in the next spring or two and be done in this quarter. I'm writing a note to remind this thread when the work gets started.

Hey @elbatk and team,
It will be really helpful if you could make this UniversalPackage download task accept vstsPackageVersion: latest like it exists in other download tasks. Eagerly waiting for this feature!

Like you said it's on your deck, are you referring to this latest option or something else (azure CLI related)?

I really needed this feature now, but in the meantime I've found a quick hack:

If you need the latest version for an azure pipeline, use this tool.
It creates a variable with that package's version.

For times when I need it elsewhere, I created a VersionControl project on devops.
All that project has in it is an xml file called versions where I stored the latest version of all of my projects. If I need to access it I git clone https://[organization]/VersionControl/_git/VersionControl

In order to get it to update automatically, I used Crying Out Cloud's task to get the new version once I built and uploaded in the pipeline. Then I cloned VersionControl with a CmdLine@2 task:

git clone https://dev.azure.com/[organization]/VersionControl/_git/VersionControl master

modified the xml with the Update XML File task from this guy,

And finished it off with another CmdLine@2 task:

git config --local user.name "[project_name] Pipeline"
git config --local user.email [email]
git commit versions.xml -m "Updated [project_name] version."
git push https://[personal access token]:[email protected]/[organization]/VersionControl/_git/VersionControl master

I guess that might be a lot of work for something that's going to be obsolete in a couple of months, but I really needed it.

I actually found the solution as well - use Azure REST API to get the latest version.

You can authorize your builds to access the API by using in-built System.AccessToken. The implementation of this method by a pwsh script can be found in this SO answer.

Nice! That looks like it works a lot smoother and faster than my hackjob. Guess I'll upgrade!

Edit:
My method actually works better for me, because not all users have the ability to run a pwsh script.

Universal Packages now supports wildcards such as *, 1.*, 1.2.*, etc as the version when downloading a package. Please see https://docs.microsoft.com/azure/devops/artifacts/quickstarts/universal-packages?view=azure-devops#downloading-the-latest-version for details.

Nice!

I'll be closing this issue. Thank you all for the feedback, If you would like to make feature requests or product issues, feel free to reach out to the Developer Community. Thank you all again!

Was this page helpful?
0 / 5 - 0 ratings