I am trying to run a zip command to package up some artifacts as part of a stage and the tool run from CMD returns 1. Bamboo marks the job as failed because it says it was expecting 0 but valid return codes from the zip tool are 1 for success and negative for failures.
I'm not sure you can configure Bamboo that way, but what you COULD do is wrap the invocation of that tool in a script (shell, batch file, etc. depending on your OS) and have the script exit with 0 if the tool exits with 1 (and simply exit with the same exit code as the tool otherwise). Have your build execute that script rather than the tool directly. It's a little bit of work (and I DO think Bamboo should let you define what "Success" and "Failure" exit codes are - I have a couple of problem tools that I've had to do this for myself), but it will get around this problem.
That seems to work, calling 'dir' or 'echo' after the command I want feels a bit silly, but the build passes now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
'exit /b 0' should work too
something like (warning: untested from the top of my head)
REM Do ZIP command IF %ERRORLEVEL% EQU 1 (EXIT /B 0) ELSE (EXIT /B %ERRORLEVEL%)
http://ss64.com/nt/exit.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Patrick's example above shows the link where you can see a more elaborate example of converting multiple return codes but above it looks like part of the code and so I missed it the first time through. http://ss64.com/nt/exit.html. Also see http://ss64.com/nt/robocopy-exit.html has the myriad of exit codes for Robocopy sorted out into success and failure return codes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just started using Bamboo and this is already causing me headaches, so I've raise the following JIRA issue : -
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For some reason it wasn't good enough to just "exit /b/ 0". It would still flag the step failed. So I had to actually set the %errorlevel% = 0.
"C:\Program Files\PSTools\psexec.exe" \\servername -s -i -d -accepteula C:\path\to\app.exe if %errorlevel% GTR 2000 ( ECHO Process started successfully on PID: %errorlevel% SET %errorlevel% = 0 ) exit /b %errorlevel%
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Change
SET %errorlevel% = 0
To
SET ERRORLEVEL=0
To get this solution to work :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I agree with Patrick Aikens' answer and just wanted to add another example that I've used extensively. See the robocopy return code problem here: http://ss64.com/nt/robocopy-exit.html There is an elaborate example of exit codes (codes 0-7 are good copies but different variations, Codes 8-16 include failures). And how to convert them to 0 for a valid (successful) return code 0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.