Thanks to Przemek I was able to find the task config data in the JobCompletedEvent.
However the listener for the JobCompletedEvent doesn't seem to be able to get the notificationRules (I get the net.sf.hibernate.LazyInitializationException: Exception initializing proxy - the owning Session was closed error message when calling NotificationManager#getNotificationRules()) even with Brydie's fix using a transactionTemplate wrapper for the call I get that exception.
Listening for a StageCompletedEvent however I have no trouble pulling out the notification rules for the plan, however I get an empty list of tasks in the config (presumably because tasks belong to parallel jobs, not stages).
So I need some way to access both notification rules and task config in one listener, I'm hoping for one of the following solutions :)
Any suggestions would be really appreciated :)
Thanks,
Matt
Community moderators have prevented the ability to post new answers.
Cracked it... Found the task config I was interested in from the stage completed event with the following:
for (StageExecution stage: stageCompletedEvent.getChainExecution().getStages()) { for ( BuildExecution build : chainStage.getBuilds()) { TaskDefinition task = build.getBuildContext().getBuildDefinition().getTaskDefinitions().get(0); requiredString = task.getConfiguration().get(REQUIRED_KEY); } }
Alternatively, can the StageCompletedEvent listener read the logs from the tasks? If so I could just log out the value I'm interested in from the task and parse it in the listener to send out the notification...
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.