[Bitbuckt Pipeline]
The after-scripts not executed when pipeline timeout
What should we do if we want to send a failed message when the pipeline timeout?
Hi @Weihan Li and welcome to the community!
The after-script is part of a step, so if the step times out before it gets to the after-script then the after-script won't get executed. I'm afraid that there is no way to work around this behavior.
If you have manually set the max-time for a step or all steps, you can try increasing it so that the step has more time to complete and the after-script gets executed. If you have not set a max-time and the step takes more than 120 minutes, then there is no way to execute anything after 120 minutes.
We have feature requests for the ability to extend Pipelines execution time for Cloud and self-hosted runners that you can vote for (if you'd be interested in that feature):
Kind regards,
Theodora
To handle timeouts in Bitbucket Pipelines, add an `after-script` section in your `bitbucket-pipelines.yml` file. Use conditional statements to check for timeouts (commonly exit code 143) and execute actions accordingly. For example, you can send a failed message using a tool like `curl` to a notification service. Adjust the script based on your specific needs and timeout exit code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.