Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Manage error code for SHExec in Buildmaster
-
Hello
Howto raise an error in Buildmaster for a failed SHEXEC ?I have an ansible playbook which failed (RC=2) but the Pipeline step is OK while it should be in error
I can't figure out how to manage this.
Here is the log:
... INFO : 2020-05-03 13:46:43Z - fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Source template/site.conf.j2 not found"} INFO : 2020-05-03 13:46:43Z - to retry, use: --limit @/tmp/bm/extranet-monespace/ansible/main.retry INFO : 2020-05-03 13:46:43Z - PLAY RECAP ********************************************************************* INFO : 2020-05-03 13:46:43Z - 127.0.0.1 : ok=4 changed=2 unreachable=0 failed=1 INFO : 2020-05-03 13:46:43Z - Exit code is: 2 DEBUG: 2020-05-03 13:46:43Z - Script completed. DEBUG: 2020-05-03 13:46:43Z - Deleting temporary script file (/tmp/otter/scripts/d2f7283d77c94cfb89151ca2e3004212)... DEBUG: 2020-05-03 13:46:43Z - Temporary file deleted. DEBUG: 2020-05-03 13:46:43Z - Cleaning up... DEBUG: 2020-05-03 13:46:43Z - Deleting /tmp/otter/_E174799 on VM111021... DEBUG: 2020-05-03 13:46:43Z - /tmp/otter/_E174799 on VM111021 deleted. DEBUG: 2020-05-03 13:46:43Z - Cleanup complete.
Any ideas ?
-
The SHExec operation does not consider the error code for success; it appears to be relatively easy to change the code to do so (
SHUtil::ExecuteScriptAsync
returns an error code), but I think (I could be wrong) exit codes from shell scripts aren't so consistent?In any case, it appears if a script writes to the error log (stream=2) then it will fail.
-
@philippe-camelio_3885 I responded to this before realizing it was deleted; so I restored the post and moved it to my username. hope that's ok :)
-
@atripp
Hello
You are right
I have seen just after the post when rc = 1 shexec exit with an error.
I have to handle the rc inside the script.
So I remove the post because it was not necessayr anymore
Thanks for the reply