• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • pipeline-model-api:2.2247.va_423189a_7dff
      pipeline-model-definition:2.2247.va_423189a_7dff
      pipeline-model-extensions:2.2247.va_423189a_7dff
      pipeline-stage-tags-metadata:2.2247.va_423189a_7dff
      workflow-cps:4046.v90b_1b_9edec67

      This is very similar to https://issues.jenkins.io/browse/JENKINS-75447; it requires the same fix but is not the full solution.

       

      In recent versions of this plugin, there is at least one option (overrideIndexTriggers) that triggers an exception when selected:

      2025-03-21 22:13:24.517+0000 [id=121] WARNING h.ExpressionFactory2$JexlExpression#evaluate: Caught exception evaluating: descriptor.isOwnerMultibranch(it) in /$stapler/bound/ce48bba7-6b46-4b5a-a16d-87c6dd18dfdf/render. Reason: java.lang.NullPointerException: Cannot invoke "hudson.model.Item.getParent()" because "item" is null
      java.lang.NullPointerException: Cannot invoke "hudson.model.Item.getParent()" because "item" is null
      at PluginClassLoader for branch-api//jenkins.branch.OverrideIndexTriggersJobProperty$DescriptorImpl.isOwnerMultibranch(OverrideIndexTriggersJobProperty.java:67)
      <snip>
      

      This results in the widget itself (with the help and title), but not the actual configuration options (checkboxes). Additionally, an attempt to generate the snippet produces no output and results in a separate exception:

      2025-03-21 22:16:35.120+0000 [id=113] WARNING o.e.j.e.n.ContextHandler$APIContext#log: Error while serving [http://localhost:8080/directive-generator/generateDirective]
      java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "o" is null
      at PluginClassLoader for structs//org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2_(DescribableModel.java:771)
      at PluginClassLoader for structs//org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable.from(UninstantiatedDescribable.java:213)
      at PluginClassLoader for pipeline-model-definition//org.jenkinsci.plugins.pipeline.modeldefinition.generator.OptionsDirective$DescriptorImpl.toGroovy(OptionsDirective.java:144)
      at PluginClassLoader for pipeline-model-definition//org.jenkinsci.plugins.pipeline.modeldefinition.generator.OptionsDirective$DescriptorImpl.toGroovy(OptionsDirective.java:70)
      at PluginClassLoader for pipeline-model-definition//org.jenkinsci.plugins.pipeline.modeldefinition.generator.DirectiveDescriptor.toIndentedGroovy(DirectiveDescriptor.java:63)
      at PluginClassLoader for pipeline-model-definition//org.jenkinsci.plugins.pipeline.modeldefinition.generator.DirectiveGenerator.doGenerateDirective(DirectiveGenerator.java:94)
      at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source)
      at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:484)
      <snip>
      

      To reproduce:

      FROM jenkins/jenkins:2.487 AS base
      RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state
      
      FROM base
      RUN jenkins-plugin-cli --latest=false --verbose -p \
      pipeline-model-api:2.2247.va_423189a_7dff \
      pipeline-model-definition:2.2247.va_423189a_7dff \
      pipeline-model-extensions:2.2247.va_423189a_7dff \
      pipeline-stage-tags-metadata:2.2247.va_423189a_7dff \
      workflow-cps:4046.v90b_1b_9edec67
      

      Create a regular pipeline job (does not need any configuration or definition) and click the "Pipeline Syntax" link. Go to the declarative generator, select "options" from the dropdown, and then "Add" an "overrideIndexTriggers" option. That generates the first NPE above, and clicking "Generate Declarative Directive" results in the second.

      The first exception (during page rendering) goes away after applying the fix from https://issues.jenkins.io/browse/JENKINS-75447 but the second (actual snippet generation) remains.  While they are technically separate issues, it makes sense to treat them as one issue, but separately from the other ticket due to the wider scope.  I'll submit a proposed solution shortly.

      Note: the first issue is known to be related to the EE9 migration, but the second issue predates that initiative.  Most of the code involved has not changed for a long time; I have not tried tried identifying why/when it actually broke.

            rrjjvv Roberto Villarreal
            rrjjvv Roberto Villarreal
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: