Add programmatically prebuildStep in my buildWrapper

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Add programmatically prebuildStep in my buildWrapper

Jean Charles Jabouille
Hi,

my plugin class extends hudson.tasks.BuildWrapper. When I activate my plugin in an job, I d'like to add programmatically a prestep(and maybe a recorder).

Maybe the good place to do it is in the method ?

   @Override
   public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener)
         throws IOException, InterruptedException {
     
       // HERE I HAVE TO ADD A PRESTEP

      return super.setUp(build, launcher, listener);
   }

Someone can help me please ?


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/917df398-015f-4f34-8b13-fc6cd51ba9ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add programmatically prebuildStep in my buildWrapper

Oleg Nenashev
Hello,

Note that this method runs after the SCM checkout, which probably does not comply with your expectations. You could use preCheckout() instead.

Generally I would recommend to avoid the BuildWrapper extension point, because it is not Pipeline-compatible by default. In your case you may want to implement SimpleBuildWrapper. Things like Run Listener offer Pipeline-compatible methods, but it's hard to say if they are applicable in your use-case

Hopefully it helps,
Oleg

среда, 12 июля 2017 г., 10:44:15 UTC+2 пользователь Jean Charles Jabouille написал:
Hi,

my plugin class extends hudson.tasks.BuildWrapper. When I activate my plugin in an job, I d'like to add programmatically a prestep(and maybe a recorder).

Maybe the good place to do it is in the method ?

   @Override
   public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener)
         throws IOException, InterruptedException {
     
       // HERE I HAVE TO ADD A PRESTEP

      return super.setUp(build, launcher, listener);
   }

Someone can help me please ?


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/85950e55-80be-4acf-9f2d-0dd03616d7e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...