What I'm trying to do is integrate with GitHib Checks API so I need to be 
able to post three types of events to GitHub.
1) When build started (which I did as a pipeline step plugin - 
gitHubCheckRunBegin())
2) When build was successful (which I did as a pipeline step plugin - 
gitHubCheckRunEnd())
3) When build fails. Here I would need to get the output of the stage the 
failed to be able to send that to GitHub.

For #3 I did as you suggested from @Ullrich link as a block scoped function 
which seems perfect.

Basically what I have now is 
https://gist.github.com/danechitoaie/bdde3c4735914e3b830e0e481211c4a9
Dos it make sense? Is it ok the way it was done?

And I'm planing to use this like:

node {
    def cfg = [
        'stuff': 'stuff',
        ...
    ]

    stage('Cleanup') {
        cleanWs()
    }

    stage('Git') {
        git(...)
    }

    stage('CheckRun_Begin') {
        gitHubCheckRunBegin(cfg)
    }

    stage('Yarn') {
        withGitHubCheckRun(cfg) {
            sh(...)
        }
    }

    stage('Build') {
        withGitHubCheckRun(cfg) {
            sh(...)
        }
    }

    stage('CheckRun_End') {
        gitHubCheckRunEnd(cfg)
    }
}

So at start gitHubCheckRunBegin makes call to GitHub api to start the 
check, gitHubCheckRunEnd will make call to GitHub api to end the check 
successfully (assuming the job gets there).
And if any step fails then the withGitHubCheckRun will catch that stage 
output and push it the GitHub API



On Monday, April 15, 2019 at 4:07:07 PM UTC+3, Jesse Glick wrote:
>
> On Sat, Apr 13, 2019 at 3:27 PM Daniel Anechitoaie 
> <[email protected] <javascript:>> wrote: 
> >     } catch (e) { 
> >         myPlugin() 
> >         throw e 
> >     } 
>
> Not really sure what you are trying to accomplish here, but this does 
> not smell like a good idea. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" 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/jenkinsci-dev/cad3e883-40f1-4235-b480-d2a38f6899ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to