My question would be: When do you send a "pipeline-status" *notification*? Let's assume three stages, with the third stage being manual. Do you send one as soon as the second stage completes, because the third is manual? Do you then send another one for the *same pipeline instance* when the third stage is allowed to go through and completes? Two pipeline-status notifications for the same run?
Maybe what is missing in the stage-status notification is the status of the pipeline in every stage-status notification message? Is that what you're saying? If so, I can see how it can be useful. I see it, though, as slightly more than just a string (success/scheduled, etc). I think what is missing is the context of the stage within the pipeline. So, taking the example from the documentation <https://plugin-api.gocd.org/current/notifications/#stage-completion-notifications>, maybe what is missing in the part in bold? { "pipeline": { "name": "pipeline-name", "counter": "1", "label": "pipeline-label", "group": "pipeline-group", "build-cause": [ { "material": { "git-configuration": { "shallow-clone": false, "branch": "branch", "url": "http://user:******@gitrepo.com" }, "type": "git" }, "changed": true, "modifications": [ { "revision": "1", "modified-time": "2016-04-06T12:50:03.317Z", "data": {} } ] } ], * "stage_statuses": [ {* * "name": "stage1",* * "state": "Passed"* * }, { "name": "stage-name", "state": "Passed" },* * { "name": "stage3", "state": "Scheduled" (or most probably "Unknown") }, ],* "stage": { "name": "stage-name", "counter": "1", "approval-type": "success", "approved-by": "changes", "state": "Passed", "result": "Passed", "create-time": "2011-07-13T19:43:37.100Z", "last-transition-time": "2011-07-13T19:43:39.100Z", "jobs": [ { "name": "job-name", "schedule-time": "2011-07-13T19:43:37.100Z", "assign-time": "2011-07-13T19:43:38.100Z", "complete-time": "2011-07-13T19:43:39.100Z", "state": "Completed", "result": "Passed", "agent-uuid": "uuid" } ] } } } Even with this, you might never get a stage-status notification for the third stage, if it is manual. Also, at the time of the second stage's notification is sent, the third stage will not be scheduled. Cheers, Aravind On Mon, Jun 19, 2017 at 2:59 AM, Krzysztof Szatan <[email protected]> wrote: > Hi! > > On 19 June 2017 at 03:02, 'Ashwanth Kumar' via go-cd < > [email protected]> wrote: > >> On the pipeline-status notification. I guess it's not straight forward >> because if a job fails the entire stage fails but an operator can choose to >> ignore that stage and move the pipeline to the next stage to make it run to >> a completion. So I wouldn't know how exactly to mark a pipeline as complete >> successfully or a failure. >> > > The problem with stage-status notification is that even if choose the last > stage in the pipeline to be the one that decides whether pipeline is > sucessful or not, I still can't do it, because I would have to configure > notification plugin for each pipeline I'm interested in. That would require > specyfing the last stage of each pipeline > I think you're making an error thinking that pipeline notification has to > have "success/failure" status. What I'm actually interested in is > "scheduled/finished" states and then I can send the result back, along with > all stages' statuses and let a user decide whether it's a success or > failure. > > >> >> - I guess that's the reason why in GoCD when you depend on a pipeline >> -> stage, it just depends on that particular stage running to a completion >> without expecting the status of the previous stages in the pipeline. >> >> I think this is good from the pipeline dependency view, but not really > relevant for notifications. > >> >> - Another case to consider is, a pipeline would be paused or stopped >> at a manual stage awaiting an operator input. When that happens the next >> run of the pipeline could get triggered either manually or via timer. >> >> >> > I don't see a problem with this. It's an another legitimate status of a > pipeline, which could be called "stopped" or "awaiting" or anything more > appropriate. > > >> Bottom line, IMHO there's no universal way to determine the status of a >> pipeline run without making some assumptions. I guess the best way would be >> to depend on a pipeline's stage and may be verify if that completed >> successfully to trigger a corresponding notification, which is why the >> notification endpoint currently supports only stage based notification. >> >> > There's no universal way to define pipeline "success/failure" status, I > agree. But "pipeline-status" notification also gives you a possibility to > check the result of all passed stages and give a user an option (in plugin > configuration) to decide what it means for a pipeline to succeed or fail > (although still not per pipeline, at least not with complex configuration). > This means there's no one definition of successful pipeline that can be > right for some people and wrong for others. > > Thanks, > Krzysztof Szatan > > >> >> On Mon, Jun 19, 2017 at 1:10 AM, Krzysztof Szatan <[email protected]> >> wrote: >> >>> I looked around in the code and it seems what I need is >>> "pipeline-status" notification as mentioned in >>> https://github.com/gocd/gocd/issues/1798. Is anyone working on this? >>> >>> Thanks, >>> Krzysztof Szatan >>> >>> W dniu niedziela, 18 czerwca 2017 12:31:46 UTC+2 użytkownik Krzysztof >>> Szatan napisał: >>>> >>>> Hi, >>>> >>>> I can see that pipeline config request >>>> <https://api.gocd.org/current/#get-pipeline-config> has *params* and >>>> *enviromental_variables* fields but pipeline instance request >>>> <https://api.gocd.org/current/#get-pipeline-instance> does not. Is >>>> this on purpose? Nevertheless, those requests are still inaccessible from a >>>> plugin. Is there a plan to extend GoApplicationAccessor >>>> <https://developer.gocd.org/17.5.0/writing_go_plugins/go_application_accessor/go_application_accessor.html> >>>> functionality to include querying pipeline instances? >>>> >>>> Thanks, >>>> Krzysztof Szatan >>>> >>>> W dniu sobota, 17 czerwca 2017 23:51:44 UTC+2 użytkownik Krzysztof >>>> Szatan napisał: >>>>> >>>>> Hi! >>>>> >>>>> I'm trying to write a notification plugin for Phabricator and I'm >>>>> stuck on passing a parameter to a pipeline and then getting it from the >>>>> plugin. Is it possible to schedule a pipeline with a parameter using an >>>>> API >>>>> call? Is there a way to enquire GoCD about these parameters for a >>>>> particular pipeline instance from a plugin? What's the best way to do it? >>>>> From what I read so far, I can only set an environment variable for a >>>>> scheduled pipeline and then somehow try to get it from the plugin. >>>>> >>>>> Thanks, >>>>> Krzysztof Szatan >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "go-cd-dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> Ashwanth Kumar / ashwanthkumar.in >> >> -- >> 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]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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]. > For more options, visit https://groups.google.com/d/optout. > -- 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]. For more options, visit https://groups.google.com/d/optout.
