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

jenkinsProject variable is not available in Multi-configuration project

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • active-choices-plugin
    • None
    • Jenkins ver. 1.625.3
      Active Choices Plug-in 1.3

      Matrix (multi-configuration) projects don't have access to jenkinsProject variable in Groovy script.

      Easy test:
      return [jenkinsProject]

      This is working on Freestyle project but not on Matrix.

        1. Selection_003.png
          Selection_003.png
          48 kB
        2. Selection_002.png
          Selection_002.png
          47 kB
        3. Selection_001.png
          Selection_001.png
          50 kB

          [JENKINS-32461] jenkinsProject variable is not available in Multi-configuration project

          Michal Kovarik created issue -

          Workaround: def jenkinsProject = hudson.model.Hudson.instance.getItem("PROJECT_NAME")

          Michal Kovarik added a comment - Workaround: def jenkinsProject = hudson.model.Hudson.instance.getItem("PROJECT_NAME")
          Bruno P. Kinoshita made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Bruno P. Kinoshita made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java
          http://jenkins-ci.org/commit/active-choices-plugin/aa4f3bfbade87bad3f451a76fea54b412ab364c2
          Log:
          [FIXED JENKINS-32461] Look for parent with class = AbstractItem rather than Project. This way we include the MatrixProject, which derives from AbstractProject, and other classes too (the getName() method is in the AbstractItem class)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java http://jenkins-ci.org/commit/active-choices-plugin/aa4f3bfbade87bad3f451a76fea54b412ab364c2 Log: [FIXED JENKINS-32461] Look for parent with class = AbstractItem rather than Project. This way we include the MatrixProject, which derives from AbstractProject, and other classes too (the getName() method is in the AbstractItem class)
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Bruno P. Kinoshita made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

          Rick Liu added a comment -

          While testing JENKINS-36590,
          I found out this bug still exists.

          My environment:
          Ubuntu 14.04 x86_64
          Jenkins 2.13
          Open JDK 1.7
          Active Choices Plug-in 1.4

          I created a multi-configuration job (matrix) on the top level (outside of Cloudsbee folder)
          with 2 intput parameters:
          Name1: Active choices parameter
          Name2: Active choices reactive parameter

          Both have Groovy script:
          return [ jenkinsProject.getName()]

          This Groovy script so far works only for freestyle jobs,
          but would fail for multi-configuration jobs or multibranch-multiconfiguration job
          or for jobs within a folder (eg. freestyle job would fail if it's under a folder).

          Rick Liu added a comment - While testing JENKINS-36590 , I found out this bug still exists. My environment: Ubuntu 14.04 x86_64 Jenkins 2.13 Open JDK 1.7 Active Choices Plug-in 1.4 I created a multi-configuration job (matrix) on the top level (outside of Cloudsbee folder) with 2 intput parameters: Name1: Active choices parameter Name2: Active choices reactive parameter Both have Groovy script: return [ jenkinsProject.getName()] This Groovy script so far works only for freestyle jobs, but would fail for multi-configuration jobs or multibranch-multiconfiguration job or for jobs within a folder (eg. freestyle job would fail if it's under a folder).

          Rick Liu added a comment -

          While testing JENKINS-36590,
          I found out this bug still exists.

          My environment:
          Ubuntu 14.04 x86_64
          Jenkins 2.13
          Open JDK 1.7
          Active Choices Plug-in 1.4

          I created a multi-configuration job (matrix) on the top level (outside of Cloudsbee folder)
          with 2 intput parameters:
          Name1: Active choices parameter
          Name2: Active choices reactive parameter

          Both have Groovy script:
          return [ jenkinsProject.getName()]

          This Groovy script so far works only for freestyle jobs,
          but would fail for multi-configuration jobs or multibranch-multiconfiguration job
          or for jobs within a folder (eg. freestyle job would fail if it's under a folder).

          Rick Liu added a comment - While testing JENKINS-36590 , I found out this bug still exists. My environment: Ubuntu 14.04 x86_64 Jenkins 2.13 Open JDK 1.7 Active Choices Plug-in 1.4 I created a multi-configuration job (matrix) on the top level (outside of Cloudsbee folder) with 2 intput parameters: Name1: Active choices parameter Name2: Active choices reactive parameter Both have Groovy script: return [ jenkinsProject.getName()] This Groovy script so far works only for freestyle jobs, but would fail for multi-configuration jobs or multibranch-multiconfiguration job or for jobs within a folder (eg. freestyle job would fail if it's under a folder).
          Rick Liu made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]

            kinow Bruno P. Kinoshita
            mkovarik Michal Kovarik
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: