Groovy dsl to configure Jenkins plugin

31 views
Skip to first unread message

Quint van der Linden

unread,
Jun 22, 2016, 10:17:30 AM6/22/16
to job-dsl-plugin
Hi,

For a project I am busy with, I need to create a groovy script to configure Jenkins jobs. In our Jenkins job we use a lot of publisher plugins. 
If I take a look at the config.xml of the job I see the following piece of xml:

<targets>
<hudson.plugins.cppncss.CppNCSSHealthTarget>
<metric class="hudson.plugins.cppncss.CppNCSSHealthMetrics">NUMBER_OF_CCN_VIOLATED_FUNCTION</metric>

I didn't manage to get the metric line converted to groovy script. Can Someone help me?

This is what I already have: 

metric(class: "hudson.plugins.cppncss.CppNCSSHealthMetrics") 

I don't know how to add the "NUMBER_OF_CCN_VIOLATED_FUNCTION" (I think its an enum value) to the metric attribute.

Kind Regards,
Quint

Daniel Spilker

unread,
Jun 22, 2016, 10:26:34 AM6/22/16
to job-dsl...@googlegroups.com
If you want to create a text node, you have to pass the value as an unnamed method parameter:

metric(class: "hudson.plugins.cppncss.CppNCSSHealthMetrics", "NUMBER_OF_CCN_VIOLATED_FUNCTION")

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/ef8494aa-1a7e-49f8-bc49-db70a77f979b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Quint van der Linden

unread,
Jun 23, 2016, 2:14:45 AM6/23/16
to job-dsl-plugin
Thanks Daniel, It works for me :)

Kind Regards,
Quint

Op woensdag 22 juni 2016 16:26:34 UTC+2 schreef Daniel Spilker:
Reply all
Reply to author
Forward
0 new messages