Azure / Azure/azure-cli

Support az artifacts universal list command

Open
#30,488 4 comments 8 reactions 0 assignees View on GitHub
act-observability-squad Artifacts Auto-Assign customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**
The current `az artifacts universal` group only supports the `download` and `publish` commands.
```
❯ az artifacts universal --help

Group
az artifacts universal : Manage Universal Packages.

Commands:
download : Download a package.
publish : Publish a package to a feed.
```

**Is your feature request related to a problem? Please describe.**

When using Azure Pipelines, we often want to know if a package version exists in Azure Artifacts, either before downloading it or before publishing a new package. Trying to download a non-existent package version fails, and trying to publish an existing package version also fails.

It is possible to handle download failure in scripts, which is okay, but if what we want to do is publish a version using the UniversalPackage@0 task, and it already then that task will fail.

We have to rely on handling publish failure, instead of testing whether the version exists before publishing the version. When trying to download a package version, we have to rely on handling download failure if a version does not exist.

**Describe the solution you'd like**

I suggest implementing a command called `az artifacts universal list` that will take a package name as a parameter, and will list zero or more versions. It could potentially use the same API as the web interface that lets us list package versions. The list command could also support a parameter that only returns the selected (latest) version, just like the web ui does.

**Describe alternatives you've considered**

When publishing a new package version using the UniversalPackage@0 task, we have a solution where we attempt to download the artifact in a script before publishing it, and if the download was successful, then we don't publish a new version, but if the download failed, then we publish a new version. This is method is wasteful of pipeline agent's runtime, compute resources and developers' waiting time.

**Additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.