Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71724

cascaded active choice Radio Boxes does not auto update

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • active-choices-plugin
    • None
    • Jenkins LTS 2.401.3
      active-choice plugin 2.7
    • 2.7.2

      Hello,

      I have a quite complex freestyle project which have 9 active choices element on it. With the previous plugin version: 2.6.5 everything was worked as expected. Here is the controls / variable description:

      1) Active Choices Reactive Parameter #1 (Groovy Script)
      INPUT: VARIABLE1 (Choice Parameter), VARIABLE2 (Choice Parameter)
      OUTPUT: VARIABLE3 (Radio Buttons)

      2) Active Choices Reactive Parameter #2 (Groovy Script)
      INPUT: VARIABLE1 (Choice Parameter), VARIABLE2 (Choice Parameter), VARIABLE3 (Active Choices Reactive Parameter #1)
      OUTPUT: VARIABLE4 (Single Select)

      3) Active Choices Reactive Reference Parameter #3 (Groovy Script)
      INPUT: VARIABLE1 (Choice Parameter)
      OUTPUT: VARIABLE5 (Single Select)

      4) Active Choices Reactive Reference Parameter #4 (Groovy Script)
      INPUT: VARIABLE1 (Choice Parameter), VARIABLE2 (Choice Parameter), VARIABLE4 (Single Select)
      OUTPUT: VARIABLE6 (Formatted HTML: <input name=\"value\" value=\"${dynRefParam}\" class=\"setting-input\" type=\"text\">)

      5) Active Choices Reactive Parameter #5 (Groovy Script)
      INPUT: VARIABLE7 (Boolean Parameter)
      OUTPUT: VARIABLE8 (Multi Select)

      6) Active Choices Reactive Parameter #6 (Groovy Script)
      INPUT: VARIABLE1 (Choice Parameter), VARIABLE2 (Choice Parameter), VARIABLE3 (Radio Buttons), VARIABLE4 (Single Select)
      OUTPUT: VARIABLE9 (Check Boxes)

      7) Active Choices Reactive Parameter #7 (Groovy Script)
      INPUT: VARIABLE9 (Check Boxes)
      OUTPUT: VARIABLE10 (Radio Buttons)

      8) Active Choices Reactive Parameter #8 (Groovy Script)
      INPUT: VARIABLE1 (Choice Parameter), VARIABLE2 (Choice Parameter), VARIABLE4 (Single Select), VARIABLE7 (Boolean Parameter), VARIABLE10 (Radio Buttons)
      OUTPUT: VARIABLE11 (Radio Buttons)

      9) Active Choices Reactive Parameter #9 (Groovy Script)
      INPUT: VARIABLE2 (Choice Parameter)
      OUTPUT: VARIABLE12 (Check Boxes)

       

       

      where the #7 active choice does not get automatically updated with the correct input parameters. The input parameter: VARIABLE9 contains just 1 element for the specific faulty case

      Not all the active choices elements are involved in the decision of the returned value of the #7 element, I just mentioned it to have a complete picture for the task configuration.

       

      Let me known if any more description is required or if I can make some further investigations.

       

          [JENKINS-71724] cascaded active choice Radio Boxes does not auto update

          Rahul Somasunderam added a comment - - edited

          I was able to reproduce this. Many thanks for the pipeline example.
          The problem seems to be that `filterable` is `Boolean` and shows up as `null` so it doesn't get passed down. Is it possible to set it to `false` explicitly?

                  [$class: 'CascadeChoiceParameter',
                      name: 'LEASE_TIME',
                      choiceType: 'PT_SINGLE_SELECT',
                      referencedParameters: 'MACHINE_TYPE',
                      filterable: false,
                      script:
                          [$class: 'GroovyScript',
                              fallbackScript: [classpath: [], sandbox: false, script: ''],
                              script: [classpath: [], sandbox: false, script: get_choices()]
                          ]
                  ],
          

          Rahul Somasunderam added a comment - - edited I was able to reproduce this. Many thanks for the pipeline example. The problem seems to be that `filterable` is `Boolean` and shows up as `null` so it doesn't get passed down. Is it possible to set it to `false` explicitly? [$class: 'CascadeChoiceParameter' , name: 'LEASE_TIME' , choiceType: 'PT_SINGLE_SELECT' , referencedParameters: 'MACHINE_TYPE' , filterable: false , script: [$class: 'GroovyScript' , fallbackScript: [classpath: [], sandbox: false , script: ''], script: [classpath: [], sandbox: false , script: get_choices()] ] ],

          efo plo added a comment - - edited

          In my case yes, and it looks like it really resolves the problem.
          However there's got to be another solution for when the script cannot be updated, or people just don't know what to update.

          Maybe you also know who's responsible for changing how the first dropdown looks in 2.401.3? I'm not a fan, and they have introduced a bug anyway.

          efo plo added a comment - - edited In my case yes, and it looks like it really resolves the problem. However there's got to be another solution for when the script cannot be updated, or people just don't know what to update. Maybe you also know who's responsible for changing how the first dropdown looks in 2.401.3? I'm not a fan, and they have introduced a bug anyway.

          Jozsef added a comment -

          For the original problem reported:

          kinow I don't have any error in the console log, however the execution order is wrong and because of this when the wrongly behaving choice element gets updated the input parameter is not yet set by the "previous" active choice element, hence the wrong output.

           

          Jozsef added a comment - For the original problem reported: kinow I don't have any error in the console log, however the execution order is wrong and because of this when the wrongly behaving choice element gets updated the input parameter is not yet set by the "previous" active choice element, hence the wrong output.  

          Jason added a comment -

          My pipeline config is also missing the explicit `filterable: false` declaration, and I see now that when pressing Save from the UI Configuration, it inserts this, then after the first build it is updated from the pipeline source again and takes it away.  I think the previous run where I only saw randomName entities updated was from a third run.  So probably adding filterable: false will be a workaround, but it would be nice if that parameter defaulted to false properly like in earlier versions, as it clutters the pipeline to have to explicitly set every option.

          Jason added a comment - My pipeline config is also missing the explicit `filterable: false` declaration, and I see now that when pressing Save from the UI Configuration, it inserts this, then after the first build it is updated from the pipeline source again and takes it away.  I think the previous run where I only saw randomName entities updated was from a third run.  So probably adding filterable: false will be a workaround, but it would be nice if that parameter defaulted to false properly like in earlier versions, as it clutters the pipeline to have to explicitly set every option.

          Avneet added a comment -

          yes, please if the parameter could be set to false by default as it would require a lot of changes in numerous pipelines to put in an extra attribute.

          Thanks

          Avneet added a comment - yes, please if the parameter could be set to false by default as it would require a lot of changes in numerous pipelines to put in an extra attribute. Thanks

          Some plugins contribute steps to the pipeline explicitly. In those cases, we can consider the custom step a public API.

          This plugin does not do that, and many pipelines rely on doing this.
          $class: 'CascadeChoiceParameter'
           

          It feels a bit like relying on a private API.

           

          kinow: Do you think the plugin should handle just that edge case? 

          Rahul Somasunderam added a comment - Some plugins contribute steps to the pipeline explicitly. In those cases, we can consider the custom step a public API. This plugin does not do that, and many pipelines rely on doing this. $class: 'CascadeChoiceParameter'   It feels a bit like relying on a private API.   kinow : Do you think the plugin should handle just that edge case? 

          kinow : I've got a PR here - https://github.com/jenkinsci/active-choices-plugin/pull/85

          I'll leave it to you to decide whether this is the behavior you want.

          Rahul Somasunderam added a comment - kinow : I've got a PR here - https://github.com/jenkinsci/active-choices-plugin/pull/85 I'll leave it to you to decide whether this is the behavior you want.

          Basil Crow added a comment -

          Basil Crow added a comment - Fixed in jenkinsci/active-choices-plugin#85 . Released in 2.7.2 .

          Jozsef added a comment - - edited

          Unfortunately , my initially reported problem is still not solved in 2.7.2, (because the results are returned in wrong order, not all the active choices elements gets updated  with the correct values).

          I had to revert to 2.6.5

          Jozsef added a comment - - edited Unfortunately , my initially reported problem is still not solved in 2.7.2, (because the results are returned in wrong order, not all the active choices elements gets updated  with the correct values). I had to revert to 2.6.5

          Basil Crow added a comment -

          szjozsef I am closing this ticket. Please file a separate ticket for any additional issues with steps to reproduce from scratch on a clean Jenkins installation.

          Basil Crow added a comment - szjozsef I am closing this ticket. Please file a separate ticket for any additional issues with steps to reproduce from scratch on a clean Jenkins installation.

            rahulsom Rahul Somasunderam
            szjozsef Jozsef
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: