Notification when flow cancelled in Central
We are automating deployment using HPOO. We have a DevOps flow running on Jenkins, which calls HPOO API to start a deployment flow once the code is validated and tested.
The integration works wonderful, we use a callback Url so HPOO can notify Jenkins back once the flow is completed (successfully or not).
But we have a catch to address: if someone cancels the flow execution through Central, I'm not able to callback Jenkins to let it know the flow was cancelled.
I'm wondering if there is a way (an event, a trigger, anything) to detect the flow was cancelled, so I can use the callback Url to notify Jenkins.
Today we have a customized notification component that sends out emails whenever the flow completes. We used this component to add the Jenkins notification, but it won't handle situations when the flow is cancelled.
Is there any standard component able to do that? Is there a global event or trigger I can "catch" on my flow so I know whenever it completes/aborts?
Thanks for your help
Sorry, i can't help you with your actual query. I was just wondering though if you'd be able to share your JEnkins operations. I'm new to the whole Jenkins Dev Ops and looking to learn about it. We have OO, and are testing some containerised apps etc. I'd like to look at automating the deployment of new container versions using Jenkins, then doing some other flows from OO against them. Any help appreciated.
Do you use OO Jenkins Plugin to monitor the flow exection? If yes, what is the job status you'll like to have for Canceled state: Unstable, Failed, Success?
As Lucian implied, the OO Jenkins Plugin could help here. Are you using it?
There is an old video talking about the plugin here: https://youtu.be/ZPn5CuVkDhw?t=8
The plugin is explained here too: https://wiki.jenkins.io/display/JENKINS/HP+Operations+Orchestration+Automation+Execution+Plugin
I would suggest a job for the validations/tests you mentioned that would trigger another job with the OO Jenkins plugin triggering the deployment. this second job will run till flow completion. If someone cancels the flow it will be captured in Jenkins so you could handle job status similar to how Lucian implied.
Hope it helps,
We considered using the Jenkins OO Plugin, but we could not make it. We have more than 600 Jenkins jobs, for around 200 systems, so we couldn't use the Freestyle project. We had to create Pipeline projects, and write a base customized pipeline file using Groovy. Basically, we run all our jobs using the same pipeline file, which implements a lot of the specific stuff we have in our company's policies. We also have basic templates for creating jobs, so we don't need to manually create new jobs using the Jenkins GUI.
Unfortunatelly, the Jenkins OO Plugin does not provide pipeline commands, and it can only be used as a build step. So we end up implementing the OO integration using raw API calls, for triggering the OO flows execution. Since our OO flows take some time to run (they do the whole deployment process), we couldn't use the pooling strategy (call the status API every 30 seconds or so, "asking" if the flow finished execution). That's when we came up with the callback Url, we use a plugin in Jenkins to generate an unique callback Url, and pass it to the HPOO flow as an input parameter. Jenkins then enters in "sleep mode", waiting for the callback to be called. Once HPOO is done, it simply use the callback Url to report the execution status (success/failure), and the details of what happened.
As I mentioned, the mechanism works pretty good, except for this small detail, when the flow is manually cancelled in HPOO. It would be a dream if we could have a "global catch" in HPOO, an event or something, just to know the execution is over, to take some action.
Thanks for your reply
I red somewhere about the two job approach in OO, one "monitoring" the other, but I couldn't quite figure out how to make it happen. We don't use the Jenkins OO plugin (find the details on my other answer), so is your approach possible without the plugin, using plain API calls to OO?
Thanks for your reply