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

this.binding.jenkinsProject not returning project of current build

    Details

    • Similar Issues:

      Description

      In a possible regression of [JENKINS-34988|https:/issues.jenkins-ci.org/browse/JENKINS-34988], the this.binding.jenkinsProject appears to contain context from the most recently saved project. 

      This was found in a 'folders' based project after replicating a freestyle job from one folder to another. The job in the later folder was then referenced in builds of the first. It was not discovered how to get the first job to revert to its correct context, resaving it did not appear to change things.

      To reproduce,

      create folder-a/job-a.

      Add Active Choices Parameter p1 with script:
      import jenkins.*
      import jenkins.model.*
      import hudson.model.*def list = []
      def parent = this.binding.jenkinsProject.getParent()
      list.push( parent.name.toString())
      def children = parent.getItems()
      children.each{ child -> list.push(child.name.toString()) }}}{{return list

      Save and run, should see folder-a and job-a listed as options for p1.

      Create folder-b/job-b, as above.

      Run job-a and will see folder-b and job-b listed as options for p1.

       

        Attachments

          Activity

          Hide
          sebcworks Sébastien COLLIN added a comment -

          Same problem for me, it seems that only the task name is took into account to select current Project...

          To solve this, the code must take either fullpath or UUID (which is actually looked at if it is unable to find project name).

          Quick workaround is to rename the project to have different names across folders...

          Show
          sebcworks Sébastien COLLIN added a comment - Same problem for me, it seems that only the task name is took into account to select current Project... To solve this, the code must take either fullpath or UUID (which is actually looked at if it is unable to find project name). Quick workaround is to rename the project to have different names across folders...
          Hide
          sebcworks Sébastien COLLIN added a comment -

          Just made a pull request to solve this issue : https://github.com/jenkinsci/active-choices-plugin/pull/19

          Wasn't hard to solve (biggest part was the test...)

          Show
          sebcworks Sébastien COLLIN added a comment - Just made a pull request to solve this issue : https://github.com/jenkinsci/active-choices-plugin/pull/19 Wasn't hard to solve (biggest part was the test...)
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Fixed in pull request. Thanks!

          Show
          kinow Bruno P. Kinoshita added a comment - Fixed in pull request. Thanks!

            People

            • Assignee:
              kinow Bruno P. Kinoshita
              Reporter:
              davidgumbrell David Gumbrell
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: