Powershell does not work bamboo task because -ExecutionPolicy bypass -Command returns code 134 instead of 0

I have a powershell script that will run in Bamboo that will update the build status of Bamboo. This is called on Github, and then the status will update any assembly that calls the script. It currently works fine on a Windows computer, but now there are assemblies that are needed on a Mac.

Firstly, the script returned error code -1 because I did not have PowerShell installed on Mac. Now that I have installed powershell, I get the following error:

Failing task since return code of [powershell -ExecutionPolicy bypass -Command /bin/sh /var/folders/c6/T/MAC-CUSAPP-JOB1-14-ScriptBuildTask.ps1] was 134 while expected 0 

The code itself is suitable for windows, since all other assemblies using the windows agent on bamboo will successfully create the task.

 & "${bamboo.build.working.directory}\scripts\publish-status.ps1" ` -repoName MyRepo ` -status pending ` -revision ${bamboo.repository.revision.number} ` -buildUrl ${bamboo.buildResultsUrl} ` -description "Bamboo has started a build" ` -context "bamboo-build" 

Is there a way to do it right so that it works for Mac. I have currently checked that the Windows machine is running Powershell version 5.0.0+ and the Mac is Powershell 6.0.0 Alpha, is this the reason that it does not create and does not give error code 134?

When I even tried to do this:

 if (2 -lt 3) { Write-Host this is lower } else { Write-Host this is higher } 

It will give the same answer, even if I did Write-Host hi, it would respond with a return code of 134.

Even using a simple powershell script that says return 0 will still give a return code error message of 134. I also checked ExecutionPolicy for the machine, and it is not limited to everything.

Also, the problem is not powershell on Mac, since it successfully runs powershell script perfectly, but that is how bamboo uses powershell script on Mac. Do you need to do something different when using the powershell script on bamboo while you are using a Mac?

Here is an image of how I run Bamboo, this is a script task that is required for windows, but this does not work on Mac. enter image description here Update

I added powershell as an executable and then used a command task to call powershell, but this still doesn’t work, any idea if this is due to the fact that Bamboo does not support powershell on mac, since powershell works using visual studio code and the terminal on the poppy. I did this in two ways:

 -ExecutionPolicy Bypass -File /Users/dev/Documents/PowreshellScripts/hello.ps1 

and also like this:

 -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File /Users/dev/Documents/PowreshellScripts/hello.ps1 
+8
windows powershell macos bamboo
source share
1 answer

I had a quick Google question, and it looks like this is actually a bug with PowerShell for Linux (and MacOS by proxy), at least according to PowerShell for Mac GitHub, the problem I managed to find . The user reporting the issue with PowerShell seems to have a very similar problem with the -ExecutionPolicy parameter when calling the PowerShell script from the Linux distribution (Ubuntu?), And I would suggest that this extrapolates to MacOS due to the UNIX architecture.

From the views of the added comments, this seems to have been fixed in Alpha Build 18. If this does not work on MacOS with the latest version of PowerShell, I can suggest that you report this to PowerShell GitHub as this user did :)

+1
source share

All Articles