Unable to Create Release In a Deployment Step

Hi Octopus Team:

I have a script that runs perfectly fine using script console, but failed when run the script within a deployment step.
Below is the script:
$octopusURI = “octopus server url”
$apiKey = ‘API key’
$octoExePath = “C:\Program Files\Octopus Deploy\Tentacle\Octo.exe”
& $octoExePath create-release --project ‘Reports 3.0.0’ --server $octopusURI --apiKey $apiKey

Got error: & : The term ‘C:\Program Files\Octopus Deploy\Tentacle\Octo.exe’ is not recognized as the name of a cmdlet, function

if I change the last two lines to:
cd $octoExePath
./Octo.exe create-release --project ‘Reports 3.0.0’ --server $octopusURI --apiKey $apiKey

Got error: cd : Cannot find path ‘C:\Program Files\Octopus Deploy\Tentacle’ because it does not exist

Both of those two scenarios works fine in script console, this is really weird behavior.

Please help, thanks in advance.

Jian

Hello Jian,

Thanks for getting in touch. The first two things to check would be the existence of ocot.exe on that tentacle, as it doesn’t get set up with the Tentacle.

The next is to ensure that the script console is running where you expect it to run, in that case could you please send through the raw logs of the deployment that failed with that error and the logs of the script console task where it did work.

Here’s a handy page with screen shots on where the raw logs button is, if downloading them is not a regular thing you do: https://octopus.com/docs/how-to/get-the-raw-output-from-a-task

Regards,
Nick

Hi Nick,

I have found the root cause of the issue, I accidentally deploy the step on the Octopus Server instead of Deployment targets. Thanks for the help.

Jian