Can you read the properties of an artifact without downloading it?

243 views Asked by At

I'm developing a release pipeline where I would like to do some analysis on a given artifact. I will not use the artifact itself for anything later, I'm only interested in reading certain properties such as version number. I, therefore, think that it is unnecessary to download an artifact that I won't do any changes to or to publish. From my point of view, the most time and resource-efficient way would be to not have to download the artifact, but I'm not sure if this is possible. Or are there workarounds, where you can download a "lite" version of the artifact? I'm planning on using a task for this.

1

There are 1 answers

2
Krzysztof Madej On BEST ANSWER

If you want to get metadata for your build/pipeline artifact, you can't do this as there is no such thing. You can call this endpoint:

https://dev.azure.com/{{organization}}/{{project}}/_apis/build/builds/6179/artifacts?api-version=6.1-preview.5

but you will only get something like this:

{
    "count": 1,
    "value": [
        {
            "id": 1095,
            "name": "drop",
            "source": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
            "resource": {
                "type": "Container",
                "data": "#/6799617/drop",
                "properties": {
                    "localpath": "D:\\a\\1\\a",
                    "artifactsize": "1330651"
                },
                "url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/6179/artifacts?artifactName=drop&api-version=6.1-preview.5",
                "downloadUrl": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/6179/artifacts?artifactName=drop&api-version=6.1-preview.5&%24format=zip"
            }
        }
    ]
}

If you want to get details of you package in Azure Artifact, which is a feed, you have some option in REST API. For instance: Artifact Details - Get Package Version