SuperJMN
SuperJMN

Reputation: 13992

Azure Pipelines Wildcard advice

I would like to copy all the .nupkg files recursively, but only from directories which their name start with "Zafiro.".

I've created this task in the azure-pipelines.yml

    - task: CopyFiles@2
      inputs:
        SourceFolder: '$(Agent.BuildDirectory)'
        Contents: '**\Zafiro.*\*.nupkg'
        TargetFolder: '$(build.artifactstagingdirectory)'
        flattenFolders: true

But it copies 0 files. It seems the wildcard ('**\Zafiro.**.nupkg') isn't working as expected.

How do I get what I want?

Upvotes: 0

Views: 2613

Answers (1)

Leo Liu
Leo Liu

Reputation: 76910

Azure Pipelines Wildcard advice

The pattern Zafiro.* should be work. I test it with a sample in my side, and it works fine.

As test, I upload some nuget packages in different folder include the test folder Zafiro.Test in the repo directly instead of create the nuget packages:

enter image description here

Now, I use the same YAML file to test it and in order to see the result more intuitively, I replace the TargetFolder to my local folder:

pool:
  name: MyPrivateAgent

steps:
- task: CopyFiles@2
  inputs:
    SourceFolder: '$(Agent.BuildDirectory)'
    Contents: '**\Zafiro*\*.nupkg'
    TargetFolder: 'D:\PublishFolder'
    flattenFolders: true

Then the result:

enter image description here

So, the pattern Zafiro.* should be work.

To resolve this issue, first, we need to make sure we have the nuget package in the Zafiro.* in the Agent.BuildDirectory folder. We could change the Contents '**\Zafiro*\*.nupkg' to '**\*.nupkg' to check if we have nuget package in the Agent.BuildDirectory folder first.

Second, just like Shayki Abramczyk said, we could try to remove . in the Zafiro.*.

If above still not resolve your question, please share the debug log for this copy task.

Upvotes: 1

Related Questions