Ray Depew
Ray Depew

Reputation: 647

How to publish only selected NuGet packages from Azure Pipeline to Artifactory?

I am using the Azure DevOps task ArtifactoryNuGet@2 in an Azure Pipeline.

I need help deploying NuGet packages from an Azure Devops pipeline to Artifactory. (I don't know if it makes a difference, but this is a cloud instance of Artifactory, not an on-prem instance.)

I have read the documentation at these two sites:

In addition, I have reviewed the task parameters in https://github.com/jfrog/artifactory-azure-devops-extension/blob/master/tasks/ArtifactoryNuget/Ver2/task.json

I have successfully restored packages from Artifactory and pushed packages to Artifactory, using ArtifactoryNuGet. However, I want to fine-tune the push package path to exclude a certain directory. That is, I want to push all packages found in the directory myproject except for the packages found in subdirectory myproject/foo .

I have the task specified like this:

  - task: ArtifactoryNuGet@2
   enabled: false
   inputs:
    command: 'push'
    artifactoryService: 'AzureToArtifactory'
    targetDeployRepo: 'acm-nuget-release-local'
    targetDeployPath: 'Azure_CI_Build/xyzzy/packages'
    pathToNupkg: 'myproject\**\*.nupkg;!myproject\foo\**\*.nupkg'

While ArtifactoryNuget recognizes the double-wildcard '**', it doesn't recognize the exclusionary character '!' , and I don't know if it recognizes the semicolon ';' .

If I only use the path myproject\**\*.nupkg, ArtifactoryNuGet finds 15 packages, 11 of them in foo and 4 of them in other subdirectories. I only want the 4 found elsewhere.

If I use the path with the exclusions as in the example above, ArtifactoryNuGet does not find any packages. I expected it to find the 4 packages.

How can I define pathToNupkg to exclude certain subdirectories, as shown?

Upvotes: 0

Views: 1342

Answers (2)

Eyal Ben Moshe
Eyal Ben Moshe

Reputation: 2435

In addition to using the JFrog CLI task as suggested by another here, you also have the option of using the Artifactory Generic Upload task, right after the Artifactory NuGet task generates the artifacts. Just like the JFrog CLI task, it supports exclusions as well as many other options, but allows defining everything through file specs.

Upvotes: 1

Leo Liu
Leo Liu

Reputation: 76996

How to publish only selected NuGet packages from Azure Pipeline to Artifactory?

You could try to use the JFrog CLI task to publish package with option --exclusions

CLI for JFrog Artifactory-Uploading Files

enter image description here

jfrog rt u "myproject\**\*.nupkg" my-local-repo --exclusions="myproject\foo\**\*.nupkg*"

enter image description here

Upvotes: 3

Related Questions