0
votes

I'm attempting to run a "Windows Machine File Copy" task in a deploy step on VSTS via private Agent.

In reading the documentation at https://docs.microsoft.com/en-us/vsts/build-release/tasks/deploy/windows-machine-file-copy?view=vsts, the section for "Source" parameter says:

You can use pre-defined system variables such as $(Build.Repository.LocalPath) (the working folder on the agent computer), which makes it easy to specify the location of the build artifacts on the computer that hosts the automation agent.

When I attempt to use that exact variable (because I literally want to copy the most recent source files) as such:

Screenshot I get the following error when running the task:

[error]Source path 'C:\agent_work\r1\a\$(Build.Repository.LocalPath)' does not exist.

2018-04-18T05:52:09.2461155Z ==============================================================================
2018-04-18T05:52:09.2461984Z Task         : Windows Machine File Copy
2018-04-18T05:52:09.2462630Z Description  : Copy files to remote machine(s)
2018-04-18T05:52:09.2463336Z Version      : 2.0.4
2018-04-18T05:52:09.2463945Z Author       : Microsoft Corporation
2018-04-18T05:52:09.2464620Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=627415)
2018-04-18T05:52:09.2465332Z ==============================================================================
2018-04-18T05:52:13.1043515Z ##[error]Source path 'C:\agent\_work\r1\a\$(Build.Repository.LocalPath)' does not exist.
2018-04-18T05:52:13.1533941Z ##[section]Finishing: Copy files To Server
2018-04-18T05:52:13.1653576Z ##[section]Finishing: Release

Am I missing something?

For background, I want to do this Robocopy/WMFC because I'm deploying a static website that's around 40gigs total in source. I don't want to copy the entire Build Output to the artifacts directory first, because it will take too long. I need quicker deploys than copying 40 gigs of data. This is a legacy site and there isn't much I can do about the way it's structured.

Ultimately, I'm trying to pull the latest source (without clean, because pulling 40 gigs is too slow) and then do a RoboCopy /MIRror to copy only changed files to the destination IIS directory on another machine.

1

1 Answers

2
votes

I can see on your question that you are doing this on a release, based on C:\agent_work\r1\a\$(Build.Repository.LocalPath), where r1 is a release.

Based on the release variable documentation, the $(Build.Repository.LocalPath) is not available for a release.

You should use one of the release variables instead, like $(System.DefaultWorkingDirectory)\the artifact name