I want to create a command step that will run only if the pipeline fails at any point. Think like a post-fail cleanup script. This seems like something you should be able to do, but I can’t seem to figure it out. I’ve found conditional steps on failure, but I think those only work if a specific step is reached and fails. I want a global command that will run if the pipeline fails at any point. Is this possible?
Welcome to the community!
We don’t have something like a global command that will be triggered only if the build fails at any point, but as you probably saw, with conditionals and getting the outcome of a step you can build something like that.
Another option could be using a post-command or pre-exithook, and in there, check the status of the step and do a pipeline upload of that particular post-fail cleanup step. The caveat of this is that it will run every time a step fails, but maybe you can set a variable that checks if a step already failed.