Редактиране

Споделяне чрез


Promote packages and manage feed views

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Feed views allow users to control package visibility by sharing some packages while keeping others private. Each view filters the feed to display a subset of packages based on specific criteria defined for that view.

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

Note

Azure Artifacts only supports publishing and restoring packages from the default view - @Local. You cannot publish directly to the @Prerelease or @Release views.

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.

    A screenshot displaying how to promote a package to a view in an Azure Artifacts feed.

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

    A screenshot showing the list of available views.

Important

Package demotion is not supported. Once a package has been promoted, it cannot be reverted to a previous view.

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 formatted as a JSON Patch document that appends the view to the end of the views array. See the Get started with the REST API and the REST API samples for more details.

  • Organization scoped feed:

    PATCH https://pkgs.dev.azure.com/{organization}/_apis/packaging/feeds/{feedId}/nuget/packages/{packageName}/versions/{packageVersion}?api-version=7.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
    

Use JsonPatchOperation to construct the body of your request. See NuGet - 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" \
-h 'Content-Type: application/json' \
-u ':${PAT}' \
-d $'{
  "views": {
    "op": "add",
    "path": "/views/-",
    "value": "{viewName}"
  }
}'

Note

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

Manage views

Azure Artifacts offers three default views: @Local, @Prerelease, and @Release. You can also create new views and manage existing ones by renaming or deleting them directly from your feed's settings.

  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 gear icon on the far right to access your feed's settings.

    Screenshot showing how to access the feed's settings.

  4. Select Views, select a view, and then select Edit to edit your view. If you want to add a new view, select Add view.

  5. Select Save when you're done.

    A screenshot showing how to add, edit, or delete feed views.

Important

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