Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,551,873
Community Members
 
Community Events
184
Community Groups

Powershell Script from Bamboo output

Hi,

 

I am running a PowerShell script from Bamboo using the Script task. The script file is in the repo, so I'm running it using the "File" Script location:

 

* Interpreter: Windows PowerShell

* Script location: File

* Script file: .\build.ps1

 

I'm confident the file exists and is running. However, I don't get any of the output from the script. That is, when I run it locally on my machine, I gets detailed output in the terminal. But when I run on Bamboo, I get no output.

How can I get output when running on Bamboo?

In case, it helps, the commands in the PowerShell script are primarily calling other applications using "&"

2 answers

1 accepted

0 votes
Answer accepted
Karel Miranda
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 24, 2020

Hi,

I was able to reproduce this issue using Powershell 4, so please try to upgrade Powershell to version 5.

I tested using Powershell 5.1.14409.1005 and it works :D

Hope this helps. 

0 votes
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Aug 18, 2019

Hi @garretfick ,

Please try adding debugging at the top of script.

Set-PSDebug -Trace 2

Also what is writing output messages?

For example:

Write-Host "message"

I have added `Set-PSDebug -Trace 2`. When I run locally, I get output from each line, but when run via Bamboo, I see no output.

I have also added `Write-Host`, and it similarly gives no output.

In case it helps, the only message I do see is

Failing task since return code of [powershell -NonInteractive -ExecutionPolicy bypass -Command .\build.ps1] was -1 while expected 0 

I can also add that if I change the name from `build.ps1` to `build1.ps1` (so the script doesn'tt exist), I instead get the message 

File [XXXXXXX\build1.ps1] doesn't exist, trying to run [.\build1.ps1] anyway.
Unable to find executable at .\build1.ps1. Will try to run it anyway.

@garretfick Did you ever figure this out? I'm trying to do the same thing right now as well. `Set-PSDebug -Trace 2` didn't output anything to the Bamboo log files. I've tried messing around with powershell preferences but none of them seemed to help.

I can't remember if I ever got logging working (and don't have access to the system anymore to check), but I do remember why things were failing.

The bamboo user account PATH environment variable had been modified, and so Powershell wasn't on the path.

I suspect this isn't related, but might be worth looking at.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events