I'm using Gitlab CI, and so have been working on a fairly complex .gitlab-ci.yml
file. The file has an after_script
section which runs when the main task is complete, or the main task has failed somehow. Problem: I need to do different cleanup based on whether the main task succeeded or failed, but I can't find any Gitlab CI variable that indicates the result of the main task.
How can I tell, inside the after_script
section, whether the main task has succeeded or failed?
after_script
or you are referring to result of the main task. You can consider storing the result into a variable. docs.gitlab.com/ee/ci/variables/README.htmlsucceeded
to0
, and then set it to1
at the very end of the main script; I'd then test it in theafter_script
to see if the process completed.)