Chris C
Chris C

Reputation: 53

Azure DevOps Server 2020 - Publish Artifact ignoring File Copy Options

We have a build pipeline that's been working for a year or two. This builds and creates a few artifacts - ASP.Net web application, windows services, etc. The issue here is with the ASP.Net web application.

We've added some REACT components to the build. There are now an enormous \React\node_modules\ folder with tens of thousands of files. I want to exclude the \React\node_modules folder from the "Publish Artifact" step. I've edited this step, by adding this under the File copy options setting: /XD react/node_modules Publish Artifact task with /XD react/node_modules set as the File Copy Options

I have a "Publish Artifact" task that has "/XD react/node_modules" set as the File Copy options. However, when I run the build pipeline, it still copies everything in the react/node_modules folder.

When I view the raw logs, I do not see that being passed as an argument in the Robocopy command. I only see this in the logfile for the Publish Artifact step:

2022-04-13T00:24:47.8605686Z ##[command]robocopy.exe /E /COPY:DA /NP /R:3 /MT:8 "C:\agent_agentwork\1\s\Website" "c:\builds\HF\HF_3.8.1.75\Website" "*"

Any idea why it's not working here?

Upvotes: 1

Views: 639

Answers (1)

David Urting
David Urting

Reputation: 403

This is a bug in the Publish artifact task. A github issue has been logged for this in 2019 (https://github.com/microsoft/azure-pipelines-tasks/issues/11451). Sadly, it is not fixed yet.

Awaiting a fix, you could work around it by putting a build step that explicitly calls robocopy to copy the build output to a temporary location (with the /XD switch). And then put the 'Publish artifact' step that copies from that temporary location.

Upvotes: 2

Related Questions