question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Caching mechanism for Universal Packages

See original GitHub issue

Hello,

Universal Packages do not offer any caching mechanism AFAIK, so if you call the same command twice, it will download and then re-download the package (unlike NuGet for instance).

Is there anything on the roadmap to make this available? Because the packages are not zipped, and can contain multiple file in “root”, a built-in caching mechanism is probably quite hard to get right.

But maybe something simpler could work for now (might be also useful later): Create new lightweight API (preferably also in VSTS CLI) that returns checksum for the package (or some identifier), based on it’s name, version and feed.

Example

vsts package universal checksum`
    --instance "https://dev.azure.com/SomeOrg/" `
    --feed "SomeFeed" `
    --name "some-name" `
    --version "1.0.0"

Returns just: BE906A753CD532E5DDE5BC0BFFC144DA4E3C6AB30A0A7DE283C488F620511611, so it can be piped in scripts. Package users can then save this checksum into a file, and next time check the hash first before downloading, essentially having very simple caching.

We could add a switch to alternate between MD5 and SHA256 as well.

This would be very useful with wildcards supported in version switch, see here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zarennercommented, May 21, 2019
  1. The service can only return a JSON document, not a partial document or scalar just containing a specific property (although the CLI should support such filtering with --query as you mention).

  2. Support for wildcards universal package versions is most definitely on our internal roadmap - while I can’t give an exact date, I will say that in my opinion it’s probably the most important feature that Universal Packages is currently missing. In the meantime, you could either use the officially documented APIs at https://docs.microsoft.com/en-us/rest/api/azure/devops/artifacts/artifact details to get package versions (note this API will return packages of all package types, and uses GUID-form package IDs which can be cumbersome), or there’s an undocumented API at https://pkgs.dev.azure.com/{org}/_packaging/{feed}/upack/packages/{package}/versions to get just the versions of the UPack package.
    When wildcard support does arrive, my guess is it will likely be implemented mainly in the Universal Packages client / Azure CLI. That is, I would not likely expect to be able to do GET .../somepkg/versions/1.*.0 as you describe. As such, I would suggest using the Azure CLI whenever possible. If it doesn’t work well for your scenarios for some reason, we’d love to know why.

The Universal Packages APIs under .../_packaging/... (such as the one above, and the one I provided earlier) are not documented. As mentioned before, they are considered an implementation detail to support the Universal Packages client (azure CLI). While unlikely to change significantly, they do not have the same long-term compatibility guarantees that the official APIs under .../_apis/... do. Whenever possible, I suggest using the officially documented APIs, but to again to support your scenario you may need to use the unofficial APIs since we don’t have official equivalents today.

Hopefully that helps.

1reaction
zarennercommented, May 20, 2019

Hi @Eragra3,

While we are interested in adding caching to the Universal Packages client, it is not currently in our short-term plans. I unfortunately don’t have a good time estimate right now.

While it is an implementation detail, the existing Universal Packages API does actually emit a content hash already - e.g. a GET https://pkgs.dev.azure.com/{org}/_packaging/{feed}/upack/packages/{package}/versions/{version} will return a JSON object containing a property ‘SuperRootId’. This property is a (custom algorithm, not SHA256 or MD5) hash that represents the content and layout of the package. I believe the output of ‘vsts package universal…’ or ‘az artifacts package universal…’ will emit this ID as well.

Perhaps this addresses your requirements. I’ll leave this issue open until we know more specifics about a timeline for Universal Packages caching.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a simple memory cache for your Angular Universal ...
This article and guide on setting up a simple memory cache for an Angular Universal website or application is targeted to developers that ......
Read more >
Caching Dependencies - CircleCI
This document is a guide to caching dependencies in CircleCI pipelines. ... Caching is particularly useful with package dependency managers such as Yarn, ......
Read more >
Caching queries | Looker - Google Cloud
The recommended caching mechanism is to use a datagroup parameter at the model level. Datagroups let you synchronize a model's cache retention ...
Read more >
Cache in-memory in ASP.NET Core - Microsoft Learn
Caching makes a copy of data that can be returned much faster than from the source.
Read more >
RFC 7234 - Hypertext Transfer Protocol (HTTP/1.1): Caching
A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found