You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract sending logic from task and make it available as a utility method on the extension. In this way people can attach it to a build listener instead of executing a task.
The text was updated successfully, but these errors were encountered:
Most of the code in SlackTask.groovy can be a separate utility class. In that way it can then be used by other Gradle entities except for the specific task type.
For instance what if I always want to send a notification irrespective of the build failed or passed? Then I could something like
buildFinished { BuildResult br ->
if(br.failure) {
notifySlack( 'The build has failed' )
br.rethrowFailure()
} else {
notifySlack( 'The build has passed' )
}
}
notifySlack would be some function you provide which will do all of the configuration. I just used it as a simplified example.
Extract sending logic from task and make it available as a utility method on the extension. In this way people can attach it to a build listener instead of executing a task.
The text was updated successfully, but these errors were encountered: