passing parameters/arguments to a groovy script outside of pipeline stages
I am trying to create an Active Choice input that will dynamically change its values based on another combo box. The code is below...when i run this, it the 'select_tag' input is not populated. I see one warning in the jenkins console output: ``` WARNING: Unknown parameter(s) found for class type 'org.biouno.unochoice.model.GroovyScript': parameters``` But nothing else. Anyone know how to do this properly? How do we debug these kind of scripts that are run on initialization of the page? where are the exceptions outputs logged to? ``` def proj_tag_map = ['proj1': ['1.0.0', '1.0.1'], 'proj2': ['2.0.0', '2.0.1'] ] def projects = proj_tag_map.keySet() as ArrayList build_tag_input(proj_tag_map) pipeline { agent any parameters{ choice(name: 'project', choices: projects) } ... ... } def build_tag_input(proj_tag_map){ properties([ parameters([ [$class: 'CascadeChoiceParameter', choiceType: 'PT_SINGLE_SELECT', name: 'select_tag', referencedParameters: 'project', script: [ $class: 'GroovyScript', parameters: [[name:'proj_tag_map', value: proj_tag_map]], script: [ sandbox: true, script: """ return proj_tag_map[project] """.stripIndent() ] ] ] ]) ]) } -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f5baaa52-420f-4edb-aeed-82127b08a51bn%40googlegroups.com.
email-extension: using extended email template in a pipeline job by template name
Hi, I asked this question on StackOverflow – but seems there is a lack of engagement regarding Jenkins there..so I am asking here as well: I've created a template named 'default_email_template' by going to Manage Jenkins -> Editable Email Notification Templates -> Add New Template. I've also provided the content for default Recipients, Subject and Body. I now would simply like to have my multiple pipeline job use that template as is. the following does not work: *Code:* def sendEmail() { emailext( '${SCRIPT, template="default_email_template"}', subject: "'Job ${env.JOB_NAME} [${env.BUILD_NUMBER}]'", ) } *Exception:* java.lang.IllegalArgumentException: Expected named arguments but got [{subject='Job testJob [12]'}, ${SCRIPT, template="default_email_template"}] at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:712) at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:644) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:237) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:196) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:124) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:47) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20) at WorkflowScript.sendEmail(WorkflowScript:160) at WorkflowScript.run(WorkflowScript:122) What is the proper way to reference a template created by using this extension? Any help would be appreciated. Thanks much -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e1de2635-211f-48d7-aab4-7a4b4f2cff62n%40googlegroups.com.