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

DynamicReferenceParameters do not work properly after 'Active Choices Plug-in' update at Jenkins Pipeline Jobs

      Hello,

      We have recently updated "Active Choices Plug-in" from 2.8.3 to 2.8.6 in our Jenkins. After downloading update we have restarted the whole virtual machine the Jenkins is running at.

      This update action caused issues at most of our Jenkins Pipeline jobs that were using DynamicReferenceParameter and CascadeChoiceParameter ** (using 'referencedParameters' attribute) classes at pipeline parameters.
       
      We are uploading an attachment 'example_Jenkinsfile' containing source code fragments of the job we have been studying the most due to occuring problems. All of our jobs have the same fallback script and the sub-scripts are builded similarly.
       

       
      On the image above there are two parameters that were affected by the bug. In our job page, when we clicked into "Build with parameters" the dynamic reference parameters instantly returned list containing 'ERROR' string from our fallback script. The code behind these parameters is builded similarly to the example code we provided. Almost the same result is returned here and there (choice type attribute is different).

      We have managed to temporarily solve this issue for a single job by:
      1. Going to "Configure" page of the job

      2. Clicking "Save" without any visible changes from web browser.

      3. This solved the problem for the single job until the first build execution.

       
      4. Our jobs are downloading the Jenkinsfiles from Git before each build execution (Pipeline SCM). Even if the source code was not changed, the parameters seemed to be "overwritten" by the build. After the build was executed the parameters stopped working - the same way as previously. We can "re-save" configuration again and the parameters page would work properly until next build execution.
       


       
      Since at this point we did not know yet what was causing issue, we attempted to fix this issue in source code of jobs. 

       We were working with the code we provided as the example. Simplyfing the code did not appear to change anything.

      The parameters state from the example code as provided:

      • InfoField1 was OK
      • PROJEKT and SERWER was OK
      • InfoField2 was returning value from the fall back script
      • Other dynamic reference parameters using the references (not provided, nothing changed after removal of them) were showing the same thing as InfoField2

      We have removed other parameters and changed the order of the main parameters (in the code) that we are talking about. The parameter order for the test was like this: InfoField2, PROJEKT, SERWER, InfoField1. 
      Unintuitively the error "stayed" at the last position:

      • InfoField2 was OK
      • PROJEKT and SERWER were OK
      • InfoField1 was returning value from the fall back script

       


       
      After the code changes did not seemed to help, we decided to downgrade plugin version from recent update to 2.8.3 (previous we were using). We have restarted the whole machine from the OS.
       
      We find out the dynamic reference parameters were working again after downgrade. To make sure we repeated the process by updating the plugin again to the newest possible (same bug) and downgrading again (worked fine) including OS rebooting. 

      All of the code we are talking about here is working perfectly fine at version 2.8.3. There were no update-compability issues since last 2 years.

      Could you provide us a solution to fix this bug at the newest version of the plugin if this is somehow our fault (maybe some source code / configuration changes)? We want to stick to our policies of keeping systems updated to the newest versions.
       
      Thanks.
       

          [JENKINS-75434] DynamicReferenceParameters do not work properly after 'Active Choices Plug-in' update at Jenkins Pipeline Jobs

          Hi dawid_kaj_veolia , I do not think it is your fault. There were changes in the plug-in code to accommodate upstream changes in Jenkins, submitted via PRs. One of these changes seems to have caused a cascade of issues, similar to yours.

          I *think* this issue is duplicated of another one, but your issue is very detailed, so let's keep this open as it might be helpful when fixing these issues, to have more of these so I can go through and validate each issue as solved.

          p.s.: I work on the plug-in as volunteer, and my $job is not using the plug-in. I have limited time to work on the plug-in, so I cannot give you a schedule on when this will be fixed.

          Bruno P. Kinoshita added a comment - Hi dawid_kaj_veolia , I do not think it is your fault. There were changes in the plug-in code to accommodate upstream changes in Jenkins, submitted via PRs. One of these changes seems to have caused a cascade of issues, similar to yours. I * think * this issue is duplicated of another one, but your issue is very detailed, so let's keep this open as it might be helpful when fixing these issues, to have more of these so I can go through and validate each issue as solved. p.s.: I work on the plug-in as volunteer, and my $job is not using the plug-in. I have limited time to work on the plug-in, so I cannot give you a schedule on when this will be fixed.

          Dawid added a comment -

          kinow 
          Understood. We are waiting patiently for new issue updates while sticking to the older version of plug-in. 

          Dawid added a comment - kinow   Understood. We are waiting patiently for new issue updates while sticking to the older version of plug-in. 

          dawid_kaj_veolia , would you be able to simplify the example and provide a complete working example? I downloaded the version of Jenkins & active-choices you reported, but I just had a look at this issue but I think importing the pipeline directly won't work as I don't have those JSON files (not sure if that's all that I'd need).

          I have short breaks to work on the plug-in (after dinner, before going to bed, early morning, lunch break), which normally resume to 15-60 minutes (most times ~15 minutes is all I have, so I try to at least triage issues).

          With that it should be a lot easier for me to reproduce, confirm, and hopefully fix the bug. Thanks!

          Bruno P. Kinoshita added a comment - dawid_kaj_veolia , would you be able to simplify the example and provide a complete working example? I downloaded the version of Jenkins & active-choices you reported, but I just had a look at this issue but I think importing the pipeline directly won't work as I don't have those JSON files (not sure if that's all that I'd need). I have short breaks to work on the plug-in (after dinner, before going to bed, early morning, lunch break), which normally resume to 15-60 minutes (most times ~15 minutes is all I have, so I try to at least triage issues). With that it should be a lot easier for me to reproduce, confirm, and hopefully fix the bug. Thanks!

          Dawid added a comment - - edited

          kinow, I provide you the example_Jenkinsfile_with_JSON_files.zipcontaining the complete working Jenkinsfile with JSON files you have mentioned. Probably this is all you need to run the code properly.

          I have tested this code in the environment we are currently running at (with the older version of plugin). The parameters choice is working properly there as shown in example_Jenkinsfile_working_properly.mp4. Unfortunatelly,  right now we can not test this code at the newest "Active Choices Plug-in" version since the existing bug may affect our users.

          Edit: I forgot to mension that you have to manually place JSON files (file_A, file_B, file_C) at your master Jenkins server in the directory "/tmp/". If you have to use another directory, then remember to change the files locations in the Jenkinsfile code.

          Thank you for your time. 

          Dawid added a comment - - edited kinow , I provide you the example_Jenkinsfile_with_JSON_files.zip containing the complete working Jenkinsfile with JSON files you have mentioned. Probably this is all you need to run the code properly. I have tested this code in the environment we are currently running at (with the older version of plugin). The parameters choice is working properly there as shown in example_Jenkinsfile_working_properly.mp4 . Unfortunatelly,  right now we can not test this code at the newest "Active Choices Plug-in" version since the existing bug may affect our users. Edit : I forgot to mension that you have to manually place JSON files (file_A, file_B, file_C) at your master Jenkins server in the directory "/tmp/". If you have to use another directory, then remember to change the files locations in the Jenkinsfile code. Thank you for your time. 

          Bruno P. Kinoshita added a comment -

          Hi dawid_kaj_veolia , thanks a lot for the complete example, and for the video!

          I was able to import it, copy the files to `/tmp`, and replay the same steps from the video with the latest development version.

          I believe this might have been fixed by JENKINS-75194, JENKINS-72826 (will mark as duplicate of those, and the CHANGELOG file also mentions both).

          If you'd like to test it, I've attached the hpi with the latest code that I used.

          I've also attached the screenrecord output.mp4 . There's a NPE, but I don't think that was the issue you had. Take a look at that video and feel free to re-open it if you think there's still an issue in how the plug-in is rendering the parameters.

          Cheers

          Bruno P. Kinoshita added a comment - Hi dawid_kaj_veolia , thanks a lot for the complete example, and for the video! I was able to import it, copy the files to `/tmp`, and replay the same steps from the video with the latest development version. I believe this might have been fixed by JENKINS-75194 , JENKINS-72826 (will mark as duplicate of those, and the CHANGELOG file also mentions both). If you'd like to test it, I've attached the hpi with the latest code that I used. I've also attached the screenrecord output.mp4 . There's a NPE, but I don't think that was the issue you had. Take a look at that video and feel free to re-open it if you think there's still an issue in how the plug-in is rendering the parameters. Cheers

          Bruno P. Kinoshita added a comment -

          To be included in 2.8.7, released once 75194, 73922, 71015, 71137, and 70043 are fixed too.

          Bruno P. Kinoshita added a comment - To be included in 2.8.7, released once 75194, 73922, 71015, 71137, and 70043 are fixed too.

            kinow Bruno P. Kinoshita
            dawid_kaj_veolia Dawid
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: