I have a puzzle. For a majority of our builds, we use network storage for our build workspaces, so all of our agents look in a network location: \nas-storage\qbdir\workspaces\servername\root\config\path. This way, multiple agents can share files via the workspace.
However, some operations are so big, it is faster to copy the source files to a local disk, do the build, and copy the results back. We accomplish this via the 'Fetch Input Files' and 'Send Output Files' options under Advanced settings. Our build scripts are clever enough to do the right thing once the files are there (using the local directory instead of the workspace) depending on a variable "flagUseLocalWinWorkspace".
My problem is that, I cannot programmatically choose whether or not to fetch/send the files. And, if I use fetch/send on a node that is using network storage, it will overwrite the files it is trying to copy, resulting in chaos. I would like to be able to have "Fetch if specified script evaluates to true" but that is not an option, it is just a check-box.
I get around this by having two identical steps, one which transfers files and one which does not, and run one or the other based on the "flagUseLocalWinWorkspace" variable. However, that means any time I change those steps I have to copy changes very carefully by hand.
Is this something which can be made better? Does anyone have a more clever way to work around it?