Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    4 Posts 2 Posters 11 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • atrippA Offline
      atripp inedo-engineer
      last edited by atripp

      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 ?

      1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • atrippA Offline
          atripp inedo-engineer
          last edited by

          @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 :)

          P 1 Reply Last reply Reply Quote 0
          • P Offline
            PhilippeC. @atripp
            last edited by

            @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

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post
            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation