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

this.binding.jenkinsProject not returning project of current build

XMLWordPrintable

      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.

       

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

              Created:
              Updated:
              Resolved: