Abstract type and groovy syntax

26 views
Skip to first unread message

Réda Housni Alaoui

unread,
Jan 8, 2022, 3:53:21 PM1/8/22
to Jenkins Developers
Hello,

I need to convert a build step configuration field from a concrete to an abstract type with 2 sub types.  I have 2 groovy related questions.

1- I want to make sure the pipeline syntax is as simple as possible. Is $class groovy attribute usage mandatory in such a case? If not, what would be a simpler syntax?

2- If the $class syntax is mandatory, how to make it backward compatible with existing scripts that expects a single concrete type without $class. Is there a way to designate a default implementation which would be used in the absence of $class?

Tim Jacomb

unread,
Jan 8, 2022, 4:24:51 PM1/8/22
to jenkin...@googlegroups.com
Best to send code examples if you can

 specifying a @Symbol(“stepName”) on the descriptor of the step will remove the need for the class syntax

--
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-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/d70fb6a46b6073b39d7afcc38ed84717de76b11c%40hey.com.

Réda Housni Alaoui

unread,
Jan 8, 2022, 4:37:00 PM1/8/22
to Jenkins Developers
 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/0vO5q_Cl414/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAH-3BifHX1g5%2B-Z4Gf-1BydLBxZwOVzvPN_dEmM0nBeyAeNw7Q%40mail.gmail.com.

Réda Housni Alaoui

unread,
Jan 9, 2022, 5:10:59 AM1/9/22
to Jenkins Developers
After reading https://www.jenkins.io/doc/developer/plugin-development/pipeline-integration/, your answer totally makes sense even for non root elements.

Now I need to find a way to keep supporting the map style. Perhaps with a setter accepting a Map?

Jesse Glick

unread,
Jan 10, 2022, 1:36:07 PM1/10/22
to jenkin...@googlegroups.com
On Sun, Jan 9, 2022 at 5:11 AM 'Réda Housni Alaoui' via Jenkins Developers <jenkin...@googlegroups.com> wrote:
Now I need to find a way to keep supporting the map style. Perhaps with a setter accepting a Map?

You mean the map style with `$class`? You need not do anything special, this will still be honored in legacy scripts (just never suggested in the snippet generator). 
Reply all
Reply to author
Forward
0 new messages