How to avoid using prebuild() in a pipeline plugin?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to avoid using prebuild() in a pipeline plugin?

steadyonabix

Hi

 

I’m completely new to plugin development for Jenkins, so please forgive my ignorance while I get up to speed.

 

I’m trying to refactor the OWASPZAP Jenkins plugin to support the “pipeline” or “workflow” syntax.

This plugin currently uses the prebuild() method to configure and start a standalone Java application, the OWASPZAP scanner.

 

I watched the Youtube video on refactoring for pipeline and it highlighted the need to avoid using prebuild() as it presupposes a specific run order.

 

My question is, if I don’t use prebuild() to configure and kick off this application, how do I do it?

Is the convention to create a separate stage in the pipeline or something?

 

Thanks in advance

 

steady

--
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/776490db-2ca4-4a9d-b8a6-451df8dbf0c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid using prebuild() in a pipeline plugin?

Jesse Glick-4
On Tue, Sep 11, 2018 at 9:01 AM steadyonabix <[hidden email]> wrote:
> This plugin currently uses the prebuild() method to configure and start a standalone Java application, the OWASPZAP scanner.

Probably this should simply be folded into your `SimpleBuildStep.perform`.

(If you really need to have something that runs before and after the
build as a whole for some reason, you can create a
`[Simple]BuildWrapper`. But I cannot see how that would be the case
here.)

> I watched the Youtube video on refactoring for pipeline and it highlighted the need to avoid using prebuild() as it presupposes a specific run order.

Noted in: https://javadoc.jenkins.io/jenkins/tasks/SimpleBuildStep.html

--
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/CANfRfr0UCtu8_Qa0ujTxnrQv3_j-fLMuQjSrz%2Bsg2es1k5dVPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid using prebuild() in a pipeline plugin?

steadyonabix
Thanks Jesse,

With hindsight, an obvious solution. :)

I think the simple build step wouldn't help, as I would then have to ensure that it was run first, thereby reintroducing the specific run order.

Thanks again

On Tuesday, 11 September 2018 16:44:12 UTC+1, Jesse Glick wrote:
On Tue, Sep 11, 2018 at 9:01 AM steadyonabix <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="kQWXCd6hAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bradley...@...> wrote:
> This plugin currently uses the prebuild() method to configure and start a standalone Java application, the OWASPZAP scanner.

Probably this should simply be folded into your `SimpleBuildStep.perform`.

(If you really need to have something that runs before and after the
build as a whole for some reason, you can create a
`[Simple]BuildWrapper`. But I cannot see how that would be the case
here.)

> I watched the Youtube video on refactoring for pipeline and it highlighted the need to avoid using prebuild() as it presupposes a specific run order.

Noted in: <a href="https://javadoc.jenkins.io/jenkins/tasks/SimpleBuildStep.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjavadoc.jenkins.io%2Fjenkins%2Ftasks%2FSimpleBuildStep.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE_LAag907ixQGHFa6-mbtTtZI13g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjavadoc.jenkins.io%2Fjenkins%2Ftasks%2FSimpleBuildStep.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE_LAag907ixQGHFa6-mbtTtZI13g&#39;;return true;">https://javadoc.jenkins.io/jenkins/tasks/SimpleBuildStep.html

--
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/fff4bab4-967a-438c-b097-956e0e26148e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid using prebuild() in a pipeline plugin?

Jesse Glick-4
On Wed, Sep 12, 2018 at 4:18 AM steadyonabix <[hidden email]> wrote:
> I think the simple build step wouldn't help, as I would then have to ensure that it was run first, thereby reintroducing the specific run order.

You cannot have a step which configures and starts the scanner, runs
it on whatever, and then shuts it down? Why does this need to be
complicated?

--
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/CANfRfr37bB187qQcr4p5POX8dTMKCkkcy6yVuh05as3jy9QqpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid using prebuild() in a pipeline plugin?

steadyonabix
Sorry, I thought that was what I was saying. I should have been clearer.

On Wednesday, 12 September 2018 19:39:35 UTC+1, Jesse Glick wrote:
On Wed, Sep 12, 2018 at 4:18 AM steadyonabix <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="wn98H70IBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bradley...@...> wrote:
> I think the simple build step wouldn't help, as I would then have to ensure that it was run first, thereby reintroducing the specific run order.

You cannot have a step which configures and starts the scanner, runs
it on whatever, and then shuts it down? Why does this need to be
complicated?

--
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/26e7b0c2-ec7a-4da1-881f-51fa92cbc7b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.