Missed Team ’24? Catch up on announcements here.

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

Bamboo: Return -1 instead of 0

HenryWhite
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2015
Hi,

I've been struggling with this error message for some time, so I've resorted to drastic measures. 

I created an inline script as follows:

exit /B 0

Now I'm not overly familiar with batch files, but I believe that should return 0. (I also tried exit 0, without the /B) However, it's failing as the return is apparently -1. 

 
Failing task since return code of [C:\Users\itbuild\AppData\Local\Temp\CRED-TPCWS2-JOB1-66-ScriptBuildTask-1682133412152287413.bat] was -1 while expected 0
simple	29-Jan-2015 16:23:41	Finished task 'Test return 0' with result: Failed

 

Can anyone explain to me what is going on?

 

Edit: I removed the failing job from the build stage and it runs, but I noticed that putting my "exit /B 0" script as a job in a later test stage worked fine. I can't figure out what's special about the build stage...

 

edit edit: I've spotted the difference, in the failing script job I had specified a working directory as ${bamboo.working.directory}. Perhaps this doesn't exist until after the source code is checked out, but not specifying a directory made the script pass again. Weird. I'll leave the question open in case anyone can explain to me why specifying a directory made it fail in such a vague way.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
HenryWhite
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 2, 2015

That was a typo in my question, I'm using ${bamboo.build.working.directory} in the working sub-directory. Perhaps the fact that it's supposed to be a subdirectory is the problem...

Thanks for your reply.

0 votes
Gretchen
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.
February 2, 2015

Typically when this occurs there is a legitimate error relating to the command you've given.

Bamboo creates a temporary batch file from whatever your command was to use.  If you look either above or below (I forget which) the specific command should also be listed.

The current working directory variable is supposed to be ${bamboo.build.working.directory} which will put you in the root of the repo.  If you specified a variable that did not exist, I can see why it would fail. It will always exist. 

See https://confluence.atlassian.com/display/Cloud/Bamboo+variables for the list of system provided variables.

If you're creating a custom variable you'll need to set that value.

 

shubham patni January 30, 2017

In my case it's keep on giving me  following error overtime. I'm following guideline from here: http://craigthomas.ca/blog/2014/10/14/continuous-integration-with-android-and-bamboo/#comment-3962. Any suggestion. 

31-Jan-2017 02:16:53 FAILURE: Build failed with an exception.
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 * What went wrong:
31-Jan-2017 02:16:53 A problem occurred configuring project ':app'.
31-Jan-2017 02:16:53 > java.lang.NullPointerException (no error message)
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 * Try:
31-Jan-2017 02:16:53 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 BUILD FAILED
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 Total time: 1 mins 2.42 secs
31-Jan-2017 02:16:53 Failing task since return code of [/bin/sh /var/folders/m9/03dpsmkd009gfygtdzx86m800000gn/T/AA-DB-JOB1-7-ScriptBuildTask-2390776201064983710.sh ANDROID_HOME=/Users/shubham/Library/Android/sdk] was 1 while expected 0
31-Jan-2017 02:16:53 Finished task 'Droid Build Script' with result: Failed
31-Jan-2017 02:16:53 Running post build plugin 'Docker Container Cleanup'
31-Jan-2017 02:16:53 Running post build plugin 'NCover Results Collector'
31-Jan-2017 02:16:53 Running post build plugin 'Clover Results Collector'
31-Jan-2017 02:16:53 Running post build plugin 'npm Cache Cleanup'
31-Jan-2017 02:16:53 Running post build plugin 'Artifact Copier'
31-Jan-2017 02:16:53 Finalising the build...
31-Jan-2017 02:16:53 Stopping timer.

 

TAGS
AUG Leaders

Atlassian Community Events