2

I have a powershell script in my octopus process to run a powershell script on a server. When I run the script on the server itself it runs fine. When I try to incorporate the script in the octopus deploy process it just hangs and does not run. It gets as far as line 8 and just hangs.

Is there something on line 8 that I am not seeing. The line that starts with $process

Write-Host "Executing Protractor cmdline: & "$TestProtractorPathAndName" 
$TestProtractorArgs "
if (test-path $TestProtractorResultPath) {Remove-Item –path 
"$TestProtractorResultPath" –recurse}
New-Item -ItemType "directory" -path "$TestProtractorResultPath"
$args = "$TestProtractorArgs" 
Write-Host "Run Protractor scripts"
Write-Host $TestProtractorResultFile
Write-Host $TestProtractorResultFileLabel
$process = Start-Process "$TestProtractorPathAndName" $args -Wait - 
PassThru
Write-Host 'Exit code = $($process.ExitCode)'
New-OctopusArtifact -Path "$TestProtractorResultFile" -Name 
"$TestProtractorResultFileLabel"
if ($process.ExitCode -eq 0){
  Write-Host "Protractor cmdline complete"
} else {
  Write-Error "Protractor cmdline failed"
}
3
  • 7
    The code you posted is broken due to incorrectly wrapped lines. Please create a minimal reproducible example, test-run that code to make sure it still exposes the problem you're trying to analyze, then edit your question and copy/paste that code. Include all errors you're getting from that code. We cannot help you when the code you're showing us has additional problems that are not present in your original code. Commented Nov 12, 2019 at 14:24
  • It is hard to guess what the problem is. Might be the permissions/access level for the user under which tentacle is running. Would need more details. By the way, have you looked into a verbose output from Octopus run? Might give some hints. Commented Nov 15, 2019 at 10:11
  • @hankey39 Check the user account used by Tentacle service, In most cases that's the issue. Commented Jan 8, 2020 at 5:41

1 Answer 1

3

The problem is potentially a permissions issue - a difference in permissions between the interactive account that can run the script in person on the machine, and the tentacle that is installed and running as a service on the machine.

The best way to iron out these issues is to simulate running your script as a tentacle. This can easily be achieved in Octopus Deploy using the Script Console feature.

enter image description here

Here you can write your PowerShell script and execute it on a tentacle, rather than running it using an interactive session on the deployment target - it will give you a much clearer picture when trying to troubleshoot issues like this.

enter image description here

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.