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

Active choices does not work correctly with same name jobs under different folders

XMLWordPrintable

      Let's say we have the following jobs structure:
      TEST_FOLDER/test_folder1/test_job
      TEST_FOLDER/test_folder2/test_job
      So two folders with different names that have a job with the same name.

      If we add any type of active choices parameter with the following code

      return [jenkinsProject.getFullName()]

      to both jobs, then pressing Build with parameters will list the same value for the parameter for both jobs: either TEST_FOLDER/test_folder1/test_job or TEST_FOLDER/test_folder2/test_job.

      I suspect the code here https://github.com/jenkinsci/active-choices-plugin/blob/master/src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java#L135 is not doing its job right of getting the actual project where that parameter was added and projectFullName is not set correctly. Then, when binding the jenkinsProject variable, the code will iterate through all the jobs and set the first job that has the same name as projectName, https://github.com/jenkinsci/active-choices-plugin/blob/master/src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java#L184.

      Thus, different jobs with the same name will have the same project bound to the script parameter.

       

      Also, this problem seems to manifest also when renaming the jobs. It's like the plugin doesn't care that the job has changed its name.

       

            kinow Bruno P. Kinoshita
            ace Adrian Vlad
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: