azure-devopsazcopyazure-pipelines-release-task

Ignore files/folders in AzureBlob File Copy task


I am using the AzureBlob File Copy task in a release pipeline. I want to ignore certain files and folders from my source artifact (e.g. .gitignore, all .md files, the .git folder).

The Optional Arguments for the tasks does not seem to accept the AzCopy flag --exlude. I have not used AzCopy, but it does specify that

The general format of the commands is: 'azcopy [command] [arguments] --[flag-name]=[flag-value]'.

I tried using /Y /SetContentType /Z /V /S --exclude=*.md but I get the error

The syntax of the command is incorrect. The option "--exclude=*.md" is not recognized.

when the release is deployed. I also tried different variations of the --exclude flag, but all have resulted in the same error message.

  1. Am I simply using the incorrect syntax for the command, or does the Optional Arguments strictly only take arguments and not flags?
  2. Is there a way to ignore certain files and folders within this task?

Solution

  • Here I will answer your two questions in conjunction with my previous comment.

    1.Am I simply using the incorrect syntax for the command, or does the Optional Arguments strictly only take arguments and not flags?

    For this issue, it seems that the exclude flag is not supported. Supported additional arguments for copy to blob are /BlobType:, /Pattern:, /L, /Z, /XN, /A, /IA:, /XA:, /NC:, /DestType: and /SetContentType. The flags cannot be used in Optional Arguments. For details, please refer to the README.md on GitHub.

    2.Is there a way to ignore certain files and folders within this task?

    For this issue, I think it is currently not support in AzureBlob File Copy task. This issue had been reported on the GitHub, please refer to Cannot exclude specific files. You can leave your product feedback on the link given in the comment.