When I run this ‘step’ inside Octopus nothing happens; all i get is the xcopy commands echod out… IThe script finds the file correctly and invokes it but something is amiss.
If i run it via the tentacle command line (octo.ps1 is the guid renamed before octopus deletes it) it works fine, the files are all copied correctly.
*note I am logged on as admin when i invoke this command*
C:\Documents and Settings\Default User\Local Settings\Application Data\Tentacle\Temp>Tentacle.exe run-script -f octo.ps1
I see output like this
C:\Documents and Settings\Default User\Local Settings\Application Data\Tentacl
Octopus Deploy: Tentacle version 2.6.5.1010
Script: C:\Documents and Settings\Default User\Local Settings\Application Data
Working dir: C:\Documents and Settings\Default User\Local Settings\Application
Variables:
Running script...
Calling 1.PrepForDeployment.bat
C:\MyPath\Folder>xcopy ".\APath\Path1" ".\bin\Path1" /E /H /R /Y
C:\MyPath\Folder>xcopy ".\APath\Path1" ".
.\bin\Path1\File1.txt
.\bin\Path1\File2.txt
Can anybody shed any light as to why the tentacle command line works but the octopus build step does not?
May I ask why are you not using straight powershell for this, instead of doing an extra hop using a batch with xcopy(which is most likely generating the issue)?
I tried every combination and in the end replaced the xcopy with robocopy and things worked as expected.
Did you run the script in octopus or just in Tentacle. Mine worked as expected from tentacle.exe - however the instant the step runs inside octopus the xcopy just did nothing.
Reason i am using batch files is because they already exist and work and we still need to maintain the option of being able to deploy simply from outside octopus. For now the plan is to have octopus invoke the required scripts on various machines. (incrementally we will be replacing with powershell)
I ran it in Octopus as part of a deployment (see attached screenshot). It must be an environmental thing then. The Robocopy workaround sounds fair enough though (until you can go all-Powershell).
Notice that neither powershell nor cmd.exe have trouble finding xcopy.exe, but neither of the invocations of xcopy /? produce help text, either.
This is consistent behavior for me across all of my environments under Octopus, and it has resulted in many hours of trying to figure out why file copying doesn’t always work. Turns out we have to use robocopy and plain ol’ copy under Octopus because xcopy is a complete no-op.