• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • rundeck-plugin
    • Jenkins V2.138
      Rundeck V2.9.3-1
      Rundeck-plugin V3.6.4

      Hello,

      There is bug in the constructor of RundeckNotifier. 

      When we declare a scripted pipeline like below, we get this exception "Caused by: java.lang.ClassCastException: org.jenkinsci.plugins.rundeck.RundeckNotifier.tags expects class java.lang.String but received class java.util.ArrayList".

      stage('Deploy Release') { 
        steps { 
          script { 
            step([$class: "RundeckNotifier", 
                  includeRundeckLogs: true, 
                  jobId: "1", 
                  rundeckInstance: "rundeck", 
                  shouldFailTheBuild: true, 
                  shouldWaitForRundeckJob: true, 
                  tailLog: true]) 
            } 
          } 
        }
      }

       

      In RundeckNotifier class, the constructor annotated by "@DataBoundConstructor" contains a parameter called "tags". Jenkins Structs plugin get the name of fields that can be declared in the pipeline thanks to this constructor and after the plugin get the type of fields declared as attribute of class.

      Two attributes are declared in the RundeckNotifier class: String tag and String [] tags.

      The plugin get "tags" as parameter of contructor (declare as String in constructor) and get the type "String[]" from class attribute. So the mapping is in failure because the field "tags" is declared as String[] in class but it's declared as String in the constructor.

      On my own environment, I have fixed this issue by renaming the field from "tags" to "tag" in the annotated constructor and it works well.

       

          [JENKINS-54537] Scripted Pipeline does not work due to tags

          Donald Leckie added a comment -

          Attached patch which works for me inspired by csarre's comment above.[JENKINS-54537]_Scripted_Pipeline_does_not_work_due_to_tags.patch

          Donald Leckie added a comment - Attached patch which works for me inspired by csarre 's comment above. [JENKINS-54537]_Scripted_Pipeline_does_not_work_due_to_tags.patch

          Isabel G. added a comment -

          Hello,

          we have the same warnings. Do anyone know if will someone release a new plugin version soon?

          Infra:

          • Jenkins 2.204.6
          • Rundeck plugin 3.6.7
          • Rundeck instance: 2.11.3-1
          • Type of Job: multibranch pipeline

          We see a lot of warnings in the logs like: 

          Apr 07, 2020 1:51:50 PM WARNING org.jenkinsci.plugins.structs.describable.DescribableModel uninstantiate2
          Cannot create control version of class org.jenkinsci.plugins.rundeck.RundeckNotifier using

          {includeRundeckLogs=true, jobId=xxx, options= pipelineURL=https://... idTicket=999 estadoDespliegue="" rundeckURL="" , rundeckInstance=XXX, shouldFailTheBuild=true, shouldWaitForRundeckJob=true, tags=[], tailLog=false}

          java.lang.ClassCastException: org.jenkinsci.plugins.rundeck.RundeckNotifier.tags expects class java.lang.String but received class java.util.ArrayList

          Apr 07, 2020 1:51:50 PM WARNING org.jenkinsci.plugins.structs.describable.DescribableModel uninstantiate2
          Cannot create control version of class org.jenkinsci.plugins.workflow.steps.CoreStep using

          {delegate=$RundeckNotifier(includeRundeckLogs=true,jobId=xxx, options= pipelineURL=https://... idTicketOTRS=999 estadoDespliegue="" rundeckURL="" ,rundeckInstance=XXX,shouldFailTheBuild=true,shouldWaitForRundeckJob=true,tags=[],tailLog=false)}

          java.lang.ClassCastException: org.jenkinsci.plugins.rundeck.RundeckNotifier.tags expects class java.lang.String but received class java.util.ArrayList

           

          Isabel G. added a comment - Hello, we have the same warnings. Do anyone know if will someone release a new plugin version soon? Infra: Jenkins 2.204.6 Rundeck plugin 3.6.7 Rundeck instance: 2.11.3-1 Type of Job: multibranch pipeline We see a lot of warnings in the logs like:  Apr 07, 2020 1:51:50 PM WARNING org.jenkinsci.plugins.structs.describable.DescribableModel uninstantiate2 Cannot create control version of class org.jenkinsci.plugins.rundeck.RundeckNotifier using {includeRundeckLogs=true, jobId=xxx, options= pipelineURL=https://... idTicket=999 estadoDespliegue="" rundeckURL="" , rundeckInstance=XXX, shouldFailTheBuild=true, shouldWaitForRundeckJob=true, tags=[], tailLog=false} java.lang.ClassCastException: org.jenkinsci.plugins.rundeck.RundeckNotifier.tags expects class java.lang.String but received class java.util.ArrayList Apr 07, 2020 1:51:50 PM WARNING org.jenkinsci.plugins.structs.describable.DescribableModel uninstantiate2 Cannot create control version of class org.jenkinsci.plugins.workflow.steps.CoreStep using {delegate=$RundeckNotifier(includeRundeckLogs=true,jobId=xxx, options= pipelineURL=https://... idTicketOTRS=999 estadoDespliegue="" rundeckURL="" ,rundeckInstance=XXX,shouldFailTheBuild=true,shouldWaitForRundeckJob=true,tags=[],tailLog=false)} java.lang.ClassCastException: org.jenkinsci.plugins.rundeck.RundeckNotifier.tags expects class java.lang.String but received class java.util.ArrayList  

            vbehar Vincent Behar
            csarre Cédric SARRE
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: