So I managed to make the plugin, and it works great.. when all of the tasks succeed. :) As far as I am aware, GoCD cannot schedule a stage after previous job failed. Just a long shot - is there a stage that will always be triggered no matter the previous outcomes?
If not, can you direct me to piece of code in the source where I could implement such stage? I was thinking the stage would have "Finally" checkmark and if enabled, it will always be triggered. On Monday, April 17, 2023 at 11:36:53 AM UTC+2 Jurica wrote: > Thanks for the info. > > I would like a task plugin because it is more flexible in configuration. I > can setup the config so every task has different webhook. As far as I know, > notification plugins have "global" config and cannot be tweaked per > pipeline. > > I guess I'll query web API to get all the information. > On Friday, April 14, 2023 at 3:47:07 PM UTC+2 Chad Wilson wrote: > >> Plugins only receive certain data defined by the plugin APIs >> <https://plugin-api.gocd.org/current/> and relevant to that type of >> plugin. Conceptually you could query the web APIs >> <https://api.gocd.org/current/> from within any type of plugin, but that >> would probably make more sense from a *notification* plugin (runs on the >> server) rather than a *task *plugin (runs on an agent)?. >> >> Notification plugins operate at stage level, not pipeline level and >> inform the server which pipelines they are interested in. Task plugins need >> to be added to individual pipelines/stages/jobs as steps so the config >> would live "inside" the pipeline. >> - https://github.com/ashwanthkumar/gocd-slack-build-notifier uses the >> "hybrid notification plugin+calls back to web API for additional info" >> approach for Slack and Teams. You could fork it and/or add Discord >> integration if it looks close to what you want to achieve. >> - https://plugin-api.gocd.org/current/notifications/#stage-status-changed >> - https://github.com/gocd-contrib/notification-skeleton-plugin (for a >> barebones skeleton notification plugin) >> >> Don't think any plugin-based approaches will give you out-of-the-box >> information about previous stages in one message - you'd just send one >> notification per stage completion, generally. >> >> -Chad >> >> On Fri, Apr 14, 2023 at 8:13 PM Jurica (SuperJura) <[email protected]> >> wrote: >> >>> Hello, >>> I am trying to create a Discord plugin as a task plugin. It should send >>> a message to discord webhook with data about all previous stages and >>> Material changes that triggered the pipeline. >>> >>> I have 90% of it done, but I am missing how can I get the previous >>> stages info from plugin. I tried to query requestBody, but it has only >>> environment variables and config for Discord webhook. I uploaded the body >>> contents I am getting. >>> >>> Basically, I need this Json. Any idea how to get it? >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> *{ "PipelineChange": [ { "Index": 111, "Author": "John", >>> "Changed_Files":[ "Assets/Code/Test.cs", >>> "Assets/Code/Foo.cs" ] }, { "Index": 112, "Author": >>> "Jane", "Changed_Files":[ "Assets/Code/Bar.cs" ] } ], >>> "Previous_Stages":[ { "Name": "Build Windows", "State": >>> "Passed" }, { "Name": "Build Mac", "State": "Failed" } >>> ]}* >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "go-cd" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/go-cd/9cdce37c-de8f-472b-a6a6-5568226f55f5n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/go-cd/9cdce37c-de8f-472b-a6a6-5568226f55f5n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "go-cd" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/a2a18951-00c7-4217-9d00-3eb6306a3e72n%40googlegroups.com.
