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

Transitive parameter references broken since version 2.8.4

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • active-choices-plugin
    • None
    • Jenkins 2.462.3, 2.494

      I had a perfectly working job (with AC version 2.8.3) that started acting up with:

      groovy.lang.MissingPropertyException: No such property: BuildType for class: Script1

      after upgrading AC to 2.8.4, and the issue still persists in 2.8.6. There seems to be some problem with transitive relations in the new version. My parameter references:

      • 'ApplicationSelection'=>'ProjectSelection'=>'BuildType'

      The exception is thrown at 'ApplicationSelection' as AC fails to transitively reference 'BuildType' which is properly defined and was working fine in the previous version.

      'BuildType' is a top-level selector: a radio button intended to refresh two drop-down selection boxes: 'ProjectSelection' and 'ApplicationSelection':

      • 'ProjectSelection' referenced parameter is 'BuildType'
      • 'ApplicationSelection' referenced parameter is 'ProjectSelection'

      The exception is thrown when opening the job in Jenkins web page (clicking 'Build with parameters', screenshot). Subsequent interaction with 'ProjectSelection' correctly updates 'ApplicationSelection', and interaction with top-level 'BuildType' correctly updates 'ProjectSelection' but not 'ApplicationSelection'. If I interact with 'BuildType', 'ApplicationSelection' seems to update according to the previous (stale) value of 'ProjectSelection', not the current (fresh) one. Adding 'BuildType' to 'ApplicationSelection' referenced parameters makes no difference,

      Note: my Groovy scripts for AC parameters put exception text in the parameter value, that's why it can be seen on the screenshot.

        1. ApplicationSelection.groovy
          2 kB
        2. config_AC-transitive-params.xml
          9 kB
        3. config.xml
          4 kB
        4. JenkinsAC.png
          JenkinsAC.png
          26 kB
        5. ProjectSelection.groovy
          2 kB

          [JENKINS-75194] Transitive parameter references broken since version 2.8.4

          Is the parameter a simple Groovy script, or are you using Scriptler?

          Bruno P. Kinoshita added a comment - Is the parameter a simple Groovy script, or are you using Scriptler?

          Nenad added a comment -

          Parameters use Groovy scripts, both attached.
          ApplicationSelection.groovy
          ProjectSelection.groovy

          Nenad added a comment - Parameters use Groovy scripts, both attached. ApplicationSelection.groovy ProjectSelection.groovy

          Peter Wolf added a comment -

          Same Problem with Groovy script. 
          Log-Message:

          Fallback to default script... groovy.lang.MissingPropertyException: No such property: PROJECT for class: Script1 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:310) at Script1.run(Script1.groovy:4) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:574) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:612) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:583) at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:378) at PluginClassLoader for uno-choice//org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:180) at PluginClassLoader for uno-choice//org.biouno.unochoice.util.ScriptCallback.call(ScriptCallback.java:96) at PluginClassLoader for uno-choice//org.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:276) at PluginClassLoader for uno-choice//org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:237) at PluginClassLoader for uno-choice//org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:225)

          Peter Wolf added a comment - Same Problem with Groovy script.  Log-Message: Fallback to default script... groovy.lang.MissingPropertyException: No such property: PROJECT for class: Script1 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:310) at Script1.run(Script1.groovy:4) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:574) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:612) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:583) at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:378) at PluginClassLoader for uno-choice//org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:180) at PluginClassLoader for uno-choice//org.biouno.unochoice.util.ScriptCallback.call(ScriptCallback.java:96) at PluginClassLoader for uno-choice//org.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:276) at PluginClassLoader for uno-choice//org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:237) at PluginClassLoader for uno-choice//org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:225)

          Hi tolstiakov , I asked if it was a Scriptler script as there were some issues reported due to an update in that plug-in, and I wanted to rule that out. I saw another issue where a user also pointed they had issues going from 2.8.3 to 2.8.4, but that issue didn't include enough information to reproduce the issue.

          I started creating a freestyle job to reproduce your issue, using both of your scripts, but I couldn't recreate it just looking at the screenshots and text. I can't tell what type of parameter you used in each parameter (e.g. the build type could be a normal parameter or provided by another plugin, or one of AC parameters).

          Could you provide detailed steps to reproduce (imagine I have a blank Jenkins, running in my IDE with the debugger, and I need to create something to give me the same bug in my env). Alternatively, you can create this sample job and share your config.xml here (just make sure it doesn't have any sensitive information and that's OK to share it if you are doing it within a company with some security/IP policy).

          Thanks

          Bruno P. Kinoshita added a comment - Hi tolstiakov , I asked if it was a Scriptler script as there were some issues reported due to an update in that plug-in, and I wanted to rule that out. I saw another issue where a user also pointed they had issues going from 2.8.3 to 2.8.4, but that issue didn't include enough information to reproduce the issue. I started creating a freestyle job to reproduce your issue, using both of your scripts, but I couldn't recreate it just looking at the screenshots and text. I can't tell what type of parameter you used in each parameter (e.g. the build type could be a normal parameter or provided by another plugin, or one of AC parameters). Could you provide detailed steps to reproduce (imagine I have a blank Jenkins, running in my IDE with the debugger, and I need to create something to give me the same bug in my env). Alternatively, you can create this sample job and share your config.xml here (just make sure it doesn't have any sensitive information and that's OK to share it if you are doing it within a company with some security/IP policy). Thanks

          Barel added a comment - - edited

          I have the same issue with scriptler scripts (AC version 2.8.6):

          Active Choices Parameter (AWS_REGION) Stuck Loading Until ENVIRONMENT Re-selection
          **

          Description:{}

          I am encountering an issue with the Active Choices parameters in our Jenkins job. When I select a value for the regular choice parameter ENVIRONMENT, the dependent (cascade) parameter AWS_REGION gets stuck in a “loading” (spinner) state. Only after I manually reselect the ENVIRONMENT parameter does AWS_REGION finish loading. This behavior is reproducible with a simplified job configuration and accompanying scripts.

          Steps to Reproduce:{}

          1.Create a Jenkins job with the attached configuration.

          2.Define a regular choice parameter ENVIRONMENT (e.g., options like DEV and PRODUCTION).

          3.Define a cascade (active choices) parameter AWS_REGION whose choices depend on ENVIRONMENT via a Groovy script.

          4.Select an ENVIRONMENT value and observe that the AWS_REGION parameter never loads (spinner remains active).

          5.Reselect the ENVIRONMENT parameter manually, and the AWS_REGION parameter finally loads.

          6.Expected Behavior: The AWS_REGION parameter should load automatically as soon as an ENVIRONMENT value is selected.

          config.xml

          Simplified Scriptler Scripts:

          1. get_deployment_regions.groovy{}

          This script now simply returns a static mapping of environments to regions.

          // Simplified: Return a static mapping for deployment regions
          def regions = [
              DEV: ["us-east-1", "us-west-1"],
              PRODUCTION: ["eu-central-1", "eu-west-1"]
          ]
          // Return the regions based on the ENVIRONMENT parameter (or an empty list if not defined)
          return (ENVIRONMENT && regions.containsKey(ENVIRONMENT)) ? regions[ENVIRONMENT] : [] 

           

          2. aws_ecr_images_tags.groovy{}

          (If needed, you can also simplify this script similarly. For this reproduction, it is not directly involved in the issue.)

           

          // Simplified: Return a static list of image tags
          return ["v1.0.0", "v1.1.0", "v2.0.0"] 

          Additional Notes: • The simplified job configuration and scripts are intended solely for reproducing the loading issue. • The bug appears to require a manual re-trigger of the dependent parameter update (by reselecting ENVIRONMENT). • Let me know if any additional information, logs, or further reproduction steps are needed.

          Barel added a comment - - edited I have the same issue with scriptler scripts (AC version 2.8.6): Active Choices Parameter (AWS_REGION) Stuck Loading Until ENVIRONMENT Re-selection ** Description: { } I am encountering an issue with the Active Choices parameters in our Jenkins job. When I select a value for the regular choice parameter ENVIRONMENT, the dependent (cascade) parameter AWS_REGION gets stuck in a “loading” (spinner) state. Only after I manually reselect the ENVIRONMENT parameter does AWS_REGION finish loading. This behavior is reproducible with a simplified job configuration and accompanying scripts. Steps to Reproduce: { } 1.Create a Jenkins job with the attached configuration. 2.Define a regular choice parameter ENVIRONMENT (e.g., options like DEV and PRODUCTION). 3.Define a cascade (active choices) parameter AWS_REGION whose choices depend on ENVIRONMENT via a Groovy script. 4.Select an ENVIRONMENT value and observe that the AWS_REGION parameter never loads (spinner remains active). 5.Reselect the ENVIRONMENT parameter manually, and the AWS_REGION parameter finally loads. 6. Expected Behavior: The AWS_REGION parameter should load automatically as soon as an ENVIRONMENT value is selected. config.xml Simplified Scriptler Scripts: 1. get_deployment_regions.groovy { } This script now simply returns a static mapping of environments to regions. // Simplified: Return a static mapping for deployment regions def regions = [     DEV: [ "us-east-1" , "us-west-1" ],     PRODUCTION: [ "eu-central-1" , "eu-west-1" ] ] // Return the regions based on the ENVIRONMENT parameter (or an empty list if not defined) return (ENVIRONMENT && regions.containsKey(ENVIRONMENT)) ? regions[ENVIRONMENT] : []   2. aws_ecr_images_tags.groovy { } (If needed, you can also simplify this script similarly. For this reproduction, it is not directly involved in the issue.)   // Simplified: Return a static list of image tags return [ "v1.0.0" , "v1.1.0" , "v2.0.0" ] Additional Notes: • The simplified job configuration and scripts are intended solely for reproducing the loading issue. • The bug appears to require a manual re-trigger of the dependent parameter update (by reselecting ENVIRONMENT). • Let me know if any additional information, logs, or further reproduction steps are needed.

          Nenad added a comment -

          kinow Sorry for my late answer, the original job used to load values for AC parameters from the filesystem which is rather difficult to simulate. I attached a simplified job with dummy values.

          One additional notice related to my exception handling: I mentioned already that Groovy scripts for my parameters return eventual exception text as parameter value (implemented that way so if something goes wrong I can easily see it on the web page, e.g. in the initially attached screenshot). In AC 2.8.3 where this job works correctly: as soon as I open the job web page, I can see both ProjectSelection and ApplicationSelection parameters quickly flash with exception message similar to No such property: BuildType for class: Script1, but this goes away very quickly and parameters refresh with correct values. With 2.8.4 and above the exception remains in ApplicationSelection, and subsequent activation of ProjectSelection and/or BuildType results in stale value being displayed in ApplicationSelection.

          HTH and BR, Nenadconfig_AC-transitive-params.xml

          Nenad added a comment - kinow Sorry for my late answer, the original job used to load values for AC parameters from the filesystem which is rather difficult to simulate. I attached a simplified job with dummy values. One additional notice related to my exception handling: I mentioned already that Groovy scripts for my parameters return eventual exception text as parameter value (implemented that way so if something goes wrong I can easily see it on the web page, e.g. in the initially attached screenshot). In AC 2.8.3 where this job works correctly: as soon as I open the job web page, I can see both ProjectSelection and ApplicationSelection parameters quickly flash with exception message similar to No such property: BuildType for class: Script1 , but this goes away very quickly and parameters refresh with correct values. With 2.8.4 and above the exception remains in ApplicationSelection, and subsequent activation of ProjectSelection and/or BuildType results in stale value being displayed in ApplicationSelection. HTH and BR, Nenad config_AC-transitive-params.xml

            kinow Bruno P. Kinoshita
            tolstiakov Nenad
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: