Our DB migrations started failing with a 255 even when the scripts are run successfully.
I have a screenshot of the script and a screenshot of part of the output. This used to run successfully. Even though the migrations are successful, the deployment fails now.
Other jobs and migrations (different project) are also successful so the tentacle does not seem to have any connectivity issues.
Thanks for getting in touch! I think to start, I should note that Octopus reads the last exit code value from the script console session to identify when a script has failed or errored. If a command has succeeded, but passed a non-zero value as the exit code, then Octopus will consider the deployment as failed. We have a section in our documentation on handling this scenario.
If you’re confident that exit code 225 does not represent a failed execution of the script, then you can manually set the exit code back to 0 at the end of the script. It may be worth placing that in a try/catch to confirm that it’s not some other unexpected exit code that you actually do want Octopus to fail on.
If you would prefer that we dig into the root cause of this error in the first place, we would need to see a full copy of your raw deployment logs where you experience this error. Here’s a secure link where you can upload them (authorised for your email). I should note that this error appears to be output from your target itself, and not an Octopus specific error, so it could be worth first running this script directly on the target machine as the use configured to run the Octopus service to compare the outputs.
Let me know how you go.
I think I will start with the asking them devs to run this on the target machine.
I have already confirmed with the DBAs that this migration did succeed and the scripts are passing.
I ran the scripts directly on the target Linux server and it all works fine.
The server logs are now uploaded.
Is there a way to just force Octopus to return true?
We are placing
return 0 at the end of the bash script but Octopus continues to fail with 255 even when the script is force true (although it has not been truly failing).
Octopus only checks the value of the exit, which is being set to 255, it doesn’t care whether a true value is returned or not. You should be able to use
exit 0 in bash to exit the script and force the state as successful in Octopus. The following page has some details on Exit and Exit Status in bash.
Let me know if this helps you get your script succeeding in Octopus.
We have tried those methods with no success.
But I think we may have found the underlying issue. There is a Warning from Docker, but Octopus interprets it as an Error.
I think we are done here. Thanks