Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NullPointer Exception with Nested AGENT config #330

Open
quincy-codametrix opened this issue Oct 18, 2023 · 0 comments
Open

[Bug]: NullPointer Exception with Nested AGENT config #330

quincy-codametrix opened this issue Oct 18, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@quincy-codametrix
Copy link

Jenkins Version

2.414.1

JTE Version

2.5.3

Bug Description

There is a NullPointerException thrown when trying to load a pipeline config with a nested AGENT keyword. The workaround we're using is just renaming the AGENT keyword at the lowest level, I know there are some differences between groovy and how the template engine loads variables, but if nested values of the same key aren't supported I would have expected a pipeline configuration error thrown by the plugin instead of a null pointer?

We only noticed this when using nested pipeline configs.
We load our configs and libraries using the SCM option.

Relevant log output

java.lang.NullPointerException
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:281)
	at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:901)
	at org.codehaus.groovy.runtime.InvokerHelper$getMetaClass.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
	at org.codehaus.groovy.runtime.InvokerHelper$getMetaClass.call(Unknown Source)
	at org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationObject$_clear_prop_closure6.doCall(PipelineConfigurationObject.groovy:130)
	at jdk.internal.reflect.GeneratedMethodAccessor711795.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
	at groovy.lang.Closure.call(Closure.java:420)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.inject(DefaultGroovyMethods.java:5518)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.inject(DefaultGroovyMethods.java:5459)
	at org.codehaus.groovy.runtime.dgm$339.invoke(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
	at org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationObject.clear_prop(PipelineConfigurationObject.groovy:129)
	at jdk.internal.reflect.GeneratedMethodAccessor712491.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:352)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:68)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
	at org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationObject$_plus_closure1.doCall(PipelineConfigurationObject.groovy:77)
	at jdk.internal.reflect.GeneratedMethodAccessor710841.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
	at groovy.lang.Closure.call(Closure.java:420)
	at groovy.lang.Closure.call(Closure.java:436)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2125)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2110)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2163)
	at org.codehaus.groovy.runtime.dgm$165.invoke(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
	at org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationObject.plus(PipelineConfigurationObject.groovy:75)
	at org.boozallen.plugins.jte.init.governance.config.dsl.PipelineConfigurationObject$plus.call(Unknown Source)
	at org.boozallen.plugins.jte.init.PipelineConfigurationAggregator$_aggregate_closure1.doCall(PipelineConfigurationAggregator.groovy:51)
	at jdk.internal.reflect.GeneratedMethodAccessor711794.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
	at groovy.lang.Closure.call(Closure.java:420)
	at groovy.lang.Closure.call(Closure.java:436)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2125)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2110)
	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2151)
	at org.codehaus.groovy.runtime.dgm$163.invoke(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
	at org.boozallen.plugins.jte.init.PipelineConfigurationAggregator.aggregate(PipelineConfigurationAggregator.groovy:48)
	at org.boozallen.plugins.jte.init.PipelineConfigurationAggregator$aggregate$0.call(Unknown Source)
	at org.boozallen.plugins.jte.job.TemplateFlowDefinition.create(TemplateFlowDefinition.groovy:77)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)

Steps to Reproduce

Setup a pipeline config on the main branch of a jenkins templates repository:

...
@merge keywords {
  AGENT {
    RESOURCES {
      @override AGENT = '4GB'
      @override BUILD = '8GB'
    }
  }
}
...

Setup a "testing" pipeline config on another branch:

...
@merge keywords {
  AGENT {
    RESOURCES {
      @override AGENT = '4GB'
      @override BUILD = '8GB'
    }
  }
}
...

Configure Jenkins to globally load the main pipeline config.
Configure your job to load the testing pipeline config.
After starting the job the error should appear when trying to load the test branch pipeline config file.

@quincy-codametrix quincy-codametrix added the bug Something isn't working label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant