I want to be able to read the exit code of the build script, from my post-build script. Is there a way to do that in Jenkins configuration?
it will allow me to check for a matching string (in this case 'hella success rn') but it won't let me see the exit code of the build script?

You may use
#!/bin/shat the start of yourExecute shellblock as shown below:Using
#!/bin/shwithout the default options that Jenkins uses i.e.,#!/bin/sh -xewill prevent Jenkins from marking yourExecute shellas failure. Doing this will help you run the subsequent command of finding the return status of your script.Ref: http://linuxcommand.org/lc3_man_pages/seth.html
Based on the return status (
script_status=$?) of your script, print something that you can search later in your post-build step.Then, in the
Post-build Actions, search that printed text to decide your post-build action as shown below:Output: