Search code examples
jenkinsjenkins-plugins

Jenkins: Execute shell script at end of job regardless of result


I’m wanting to run an HTTP POST request at the end of a Jenkins job regardless of whether it failed or was aborted early. I planned to do this using a simple Curl command.

I know this is possible with the Post build task plugin. However, I believe, it saves the whole console to RAM for text comparisons, which not only do I not need, but will most likely cause OOM exceptions on our master.

Also, I don’t see any documentation for the plubin to try test this using a Jenkins script only in the UI. Does anyone have any alternatives or a way to call postbuild-task within a Jenkins file?


Solution

  • I ended up doing this with a simple try finally block since my original code didnt use jenkins pipelines