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

jenkinsProject variable is not available in Multi-configuration project

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: active-choices-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 1.625.3
      Active Choices Plug-in 1.3
    • Similar Issues:

      Description

      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.

        Attachments

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

          Issue Links

            Activity

            Hide
            kinow Bruno P. Kinoshita added a comment -

            Right, so the issue for multi-configuration projects, is that let's say you create a job called "my job". And there you configured an axis, say, "country", with values "brazil argentina colombia".

            The moment you persist the job, by clicking apply or save, Jenkins stores the job configuration with the parameters. The active-choices parameters are persisted with the job name, i.e. "my job".

            When you click to execute the job with parameter in Jenkins, what the plug-in receives then, are values such as "country=brazil", "country=argentina", and "country=colombia". That's because of the way multi-configuration jobs are created in Jenkins.

            Show
            kinow Bruno P. Kinoshita added a comment - Right, so the issue for multi-configuration projects, is that let's say you create a job called "my job". And there you configured an axis, say, "country", with values "brazil argentina colombia". The moment you persist the job, by clicking apply or save, Jenkins stores the job configuration with the parameters. The active-choices parameters are persisted with the job name, i.e. "my job". When you click to execute the job with parameter in Jenkins, what the plug-in receives then, are values such as "country=brazil", "country=argentina", and "country=colombia". That's because of the way multi-configuration jobs are created in Jenkins.
            Hide
            totoroliu Rick Liu added a comment -

            so I assume

            return [ jenkinsProject.getName()]
            

            should return "my job"?

            Show
            totoroliu Rick Liu added a comment - so I assume return [ jenkinsProject.getName()] should return "my job"?
            Hide
            kinow Bruno P. Kinoshita added a comment -

            Except that when we scan Jenkins for projects, we are trying to match "my job" with one of the possible axes' names, like "country=colombia".

            As the values do not match, the jenkinsProject object is null.

            When the job is persisted, we store the project name. And when the screen to execute the job is called, we scan Jenkins trying to retrieve the object to inject into groovy.

            Perhaps we could try getting the project name, the moment the user loads the job execution screen.

            We can start the work now, but I'm not sure if I'll have time to finish the work before the next release. So it will be probably released around September, unless I get some funding to work on this issue from work (not very likely at the moment)

            But will start working in the next days hopefully with users responding so prompt like you it will be much easier to fix it.

            Show
            kinow Bruno P. Kinoshita added a comment - Except that when we scan Jenkins for projects, we are trying to match "my job" with one of the possible axes' names, like "country=colombia". As the values do not match, the jenkinsProject object is null. When the job is persisted, we store the project name. And when the screen to execute the job is called, we scan Jenkins trying to retrieve the object to inject into groovy. Perhaps we could try getting the project name, the moment the user loads the job execution screen. We can start the work now, but I'm not sure if I'll have time to finish the work before the next release. So it will be probably released around September, unless I get some funding to work on this issue from work (not very likely at the moment) But will start working in the next days hopefully with users responding so prompt like you it will be much easier to fix it.
            Hide
            samsun387 Kevin Yu added a comment -

            Hi Bruno P. Kinoshita Any update on this JIRA?

            Thanks.

            Show
            samsun387 Kevin Yu added a comment - Hi Bruno P. Kinoshita Any update on this JIRA? Thanks.
            Hide
            kinow Bruno P. Kinoshita added a comment -

            Hi Kevin Yu, triaged this issue for 1.5.4 release. Will spend some time looking into how to fix this issue, but cannot promise including it in the release. I remember it was a bit tricky due to the way we retrieve the project name.

            Show
            kinow Bruno P. Kinoshita added a comment - Hi Kevin Yu , triaged this issue for 1.5.4 release. Will spend some time looking into how to fix this issue, but cannot promise including it in the release. I remember it was a bit tricky due to the way we retrieve the project name.

              People

              Assignee:
              kinow Bruno P. Kinoshita
              Reporter:
              mkovarik Michal Kovarik
              Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated: