Making a plugin with the same hudson.task.Builder and hudson.task.Publisher implementation

33 views
Skip to first unread message

Dan Alvizu

unread,
Dec 12, 2016, 11:18:36 AM12/12/16
to Jenkins Developers
Hi,

I'm working on the jira-ext plugin, which updates JIRA tickets as a hudson.task.Builder, which means it shows up in the drop-down of build steps. I would also like to have it show up in the list of post-build steps, which I understand means I must extend a hudson.task.Publisher.

I can just copy-pasta this into another class and have that one extend hudson.task.Publisher, but that seems wrong. The implementation is essentially the same. Is there a smarter way of doing this?

Thanks!

Kanstantsin Shautsou

unread,
Dec 12, 2016, 2:36:43 PM12/12/16
to Jenkins Developers
Unfortunately freestyle build is not freestyle. I guess because of workflow nobody interested in merging/enhancing other job types. 
There is a workaround by using any-build-step/flexible publisher plugins that expose types vice versa. 

Dan Alvizu

unread,
Dec 13, 2016, 11:16:24 AM12/13/16
to Jenkins Developers
Okay, I was hoping there was some BuilderPublisher class I could just extend :)

I'll go copy-pasta route. Thanks!

Robert Sandell

unread,
Dec 14, 2016, 6:12:58 AM12/14/16
to jenkin...@googlegroups.com
There are other plugins that already does this that you can take inspiration from; env-inject and parameterized trigger plugin comes to mind.
Basically put all common builder code in a separate class and have your builder and publisher as small facades that mostly just provides the extension hook and first level data binding.

/B

--
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 jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/2224ceb4-3998-4acb-ae0e-8a0a777cb907%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

Ullrich Hafner

unread,
Dec 14, 2016, 8:41:12 AM12/14/16
to Jenkins Developers
This is quite similar to the approach when you are supporting Freestyle projects and Maven projects: there still is a *lot* of duplication of the boilerplate code :-( 
 
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS3zX0rYNrDHq1DQNgyY_7pOcT5KepgR5R1XRJLTus5hqA%40mail.gmail.com.

Dan Alvizu

unread,
Dec 14, 2016, 11:22:03 AM12/14/16
to jenkin...@googlegroups.com

On Wed, Dec 14, 2016 at 6:41 AM, Ullrich Hafner <ullrich...@gmail.com> wrote:
This is quite similar to the approach when you are supporting Freestyle projects and Maven projects: there still is a *lot* of duplication of the boilerplate code :-( 
Am 14.12.2016 um 12:12 schrieb Robert Sandell <rsan...@cloudbees.com>:

There are other plugins that already does this that you can take inspiration from; env-inject and parameterized trigger plugin comes to mind.
Basically put all common builder code in a separate class and have your builder and publisher as small facades that mostly just provides the extension hook and first level data binding.

/B

On Tue, Dec 13, 2016 at 5:16 PM, 'Dan Alvizu' via Jenkins Developers <jenkinsci-dev@googlegroups.com> wrote:
Okay, I was hoping there was some BuilderPublisher class I could just extend :)

I'll go copy-pasta route. Thanks!


On Monday, December 12, 2016 at 12:36:43 PM UTC-7, Kanstantsin Shautsou wrote:
Unfortunately freestyle build is not freestyle. I guess because of workflow nobody interested in merging/enhancing other job types. 
There is a workaround by using any-build-step/flexible publisher plugins that expose types vice versa. 

On Monday, December 12, 2016 at 7:18:36 PM UTC+3, Dan Alvizu wrote:
Hi,

I'm working on the jira-ext plugin, which updates JIRA tickets as a hudson.task.Builder, which means it shows up in the drop-down of build steps. I would also like to have it show up in the list of post-build steps, which I understand means I must extend a hudson.task.Publisher.

I can just copy-pasta this into another class and have that one extend hudson.task.Publisher, but that seems wrong. The implementation is essentially the same. Is there a smarter way of doing this?

Thanks!

--
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 jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/2224ceb4-3998-4acb-ae0e-8a0a777cb907%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

--
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 jenkinsci-dev+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/zwbofcvtBAU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/BE7ED4A3-D0D2-457B-9CB0-14302B37FAAE%40gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Ping Identity
Dan Alvizu
Principal Engineer
dal...@pingidentity.com
w: +1 720.317.2060
c: +1 720.938.6640
Connect with us: Glassdoor logo LinkedIn logo twitter logo facebook logo youtube logo Google+ logo Blog logo
Reply all
Reply to author
Forward
0 new messages