Reputation: 873
I have created a DevOps pipeline with multiple stages. The entire pipeline takes a lot of time to finish. So I want a quick way to monitor if the pipeline is stuck in some stage or not, and would like to add better monitoring on stage-level.
Is there an option to set a time limit on stage, beyond which I will get notified about the delay. It doesn't need to cancel the stage beyond the time limit, just notify me.
Upvotes: 3
Views: 1556
Reputation: 1957
It seems like you cannot set a timeout for a stage, however you can set timeouts for individual agent jobs. That means if your stage has exactly one agent job, then that's what you need. If your stage has more than one job, then you'll have to split your desired stage timeout into smaller job timeouts. See the screenshot, you can set it here.
As for the second part of your question, such a thing is not supported. But you can always cheat. There are a number of ways in which you can do this. The simplest option would probably be to have an additional agent job that is triggered in a way that it runs concurrently to your other/main job. In this job you could have a PS script running a loop for as long as your timeout is and if it exeeds the timeout it sends a delay notification.
Upvotes: 0
Reputation: 3438
You can set timeout for build step and also check "Continue on error". However timeout will cancel build step that takes too long, so they won't complete successfully. It depends on how the build step / script is implemented.
Then after every step add conditional build step for sending notification into mail/slack/teams/whatever.
An easy way to test this is create a command line build step and add "Sleep 120" as command. Then set timeout of that build step to 1 minute.
This is log of build step: 1. Echo "starting sleep" 2. sleep 120 3. echo "slept"
Notice that slept is also print out!
Upvotes: 1