Tracking build failure in the custom pipeline wrapper step

11 views
Skip to first unread message

artyom....@aurea.com

unread,
Jul 20, 2017, 8:55:21 AM7/20/17
to Jenkins Developers
Hello. I am trying to create my own pipeline step plugin. What i want to achieve is:
node {
    mystep 
(var: ...) {
        
...
        sh 
"gradle clean build"
        
...
    
}
}

The key point here: i need to track the status of the inner steps (gradle build in this case) and execute some code based on the result (i.e. track if gradle build failed) . Currently i extended SimpleBuildWrapper and set Disposer:
context.setDisposer(new Disposer() {
        
@Override
        
public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener)
                
throws IOException, InterruptedException {
            
...
        
}
    
});

But the issue here: i have no idea how to track inner steps result here. When disposer code executed build status is still 'RUNNING', even though gradle build finished with exception. 

Is there any way to track inner step's result at the end of my wrapper step? 

Jesse Glick

unread,
Jul 20, 2017, 10:07:56 AM7/20/17
to Jenkins Dev
On Thu, Jul 20, 2017 at 3:08 AM, <artyom....@aurea.com> wrote:
> Is there any way to track inner step's result at the end of my wrapper step?

Not using `SimpleBuildWrapper`. If you make a first-class `Step` you
have more flexibility.
Reply all
Reply to author
Forward
0 new messages