Skip to content

Latest commit

 

History

History
195 lines (128 loc) · 8.68 KB

File metadata and controls

195 lines (128 loc) · 8.68 KB
title description ms.assetid ms.service ms.topic ms.date monikerRange
Promote packages in Azure Artifacts
How to promote a package to a view in Azure Artifacts
EB40D23E-1053-4EBF-9D1D-19CF1BBAF1C6
azure-devops-artifacts
conceptual
08/25/2022
<= azure-devops

Promote packages and manage feed views in Azure Artifacts

[!INCLUDE version-lt-eq-azure-devops]

Feed views are a way to enable users to share some packages while keeping other packages private. Views filter the feed to a subset of packages that meet a set of criteria defined by that view.

By default, Azure Artifacts comes with three views: @Local, @Prerelease, and @Release. @local is the default view that contains all the published packages and all the packages saved from upstream sources. All views support NuGet, npm, Maven, Python, and Universal packages.

Note

Azure Artifacts only supports publishing and restoring packages from and to the default view - @Local.

Promote packages

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select the package you wish to promote, and then select Promote.

    :::image type="content" source="media/promote-package.png" alt-text="A screenshot showing how to promote a package to a view.":::

  4. Select a view from the dropdown menu, and then select Promote.

    :::image type="content" source="media/promote-package-views.png" alt-text="A screenshot showing the available feed views.":::

Note

Package demotion is not supported. If you want this feature to be added to a future release, please feel free to Suggest a feature on Azure DevOps Developer Community.

Promote packages using the REST API

In addition to using the Azure Artifacts user interface, you can also promote packages using the REST API.

The request body should be a JSON Patch document that adds the view to the end of the views array. For more details on how to interact with the Azure DevOps REST API, see the Get started with the REST API and the REST API samples.

  • Organization scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/_apis/packaging/feeds/{feedId}/nuget/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1
  • Project scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feedId}/nuget/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1

    Use JsonPatchOperation to construct the body of your request. See NuGet - update package version for more details.

  • Organization scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/_apis/packaging/feeds/{feedId}/npm/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1
  • Project scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feedId}/npm/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1

    Use JsonPatchOperation to construct the body of your request. See npm - update package version for more details.

  • Organization scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/_apis/packaging/feeds/{feedId}/pypi/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1
  • Project scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feedId}/pypi/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1

    Use JsonPatchOperation to construct the body of your request. See Python - update package version for more details.

  • Organization scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/_apis/packaging/feeds/{feed}/maven/groups/{groupId}/artifacts/{artifactId}/versions/{version}?api-version=7.1-preview.1
  • Project scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feed}/maven/groups/{groupId}/artifacts/{artifactId}/versions/{version}?api-version=7.1-preview.1

    Use JsonPatchOperation to construct the body of your request. See Maven - update package version for more details.

  • Organization scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/_apis/packaging/feeds/{feedId}/upack/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1
  • Project scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feedId}/upack/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1

    Use JsonPatchOperation to construct the body of your request. See Universal packages - update package version for more details.


Examples

$ curl -X "PATCH" "https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feedId}/nuget/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1" \
-h 'Content-Type: application/json' \
-u ':${PAT}' \
-d $'{
  "views": {
    "op": "add",
    "path": "/views/-",
    "value": "{viewName}"
  }
}'
$uri = "https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feedId}/nuget/packages/{packageName}/versions/{packageVersion}?api-version=7.1-preview.1"
$headers = @{
    "Content-Type" = "application/json"
    Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$env:PAT"))
}
$body = @{
    views = @{
        op    = "add"
        path  = "/views/-"
        value = "{viewName}"
    }
} | ConvertTo-Json

Invoke-RestMethod -Uri $uri -Method Patch -Headers $headers -Body $body

Manage views

You can create your own views or rename and delete existing ones from your feed's settings.

Note

All feed views in a public project are accessible to everyone on the internet.

  1. Select Artifacts.

  2. Select your feed from the dropdown menu.

  3. Select the gear icon :::image type="icon" source="../../media/icons/blue-gear.png" border="false"::: to access your feed's settings.

    :::image type="content" source="../media/feed-settings.png" alt-text="Screenshot showing how to access the feed's settings.":::

  4. Select Views.

    :::image type="content" source="./media/views-settings.png" alt-text="A screenshot showing how to navigate to views.":::

  5. Select a view, and then select Edit to edit your view or select Add view if you want to add a new view.

  6. Select Save when you're done.

Important

For public feeds, if you change the access permissions of a certain view to Specific people your view will not be available as an upstream source.

Related articles