Closed psig-bah closed 2 years ago
2.303.3
2.3
Using step aliasing on a library step with an optional/default parameter fails with the exception from this check: https://github.com/jenkinsci/templating-engine-plugin/blob/release/2.3/src/main/groovy/org/boozallen/plugins/jte/init/primitives/injectors/LibraryStepInjector.groovy#L207-L220
[JTE] Loading Library npm [JTE] There can only be one @StepAlias annotation per step. Found 2 in npm library's npm_invoke.groovy [JTE] java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [JTE] java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [JTE] java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [JTE] java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) [JTE] org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) [JTE] org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77) [JTE] org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84) [JTE] org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247) [JTE] org.boozallen.plugins.jte.init.primitives.injectors.LibraryStepInjector.getStepAlias(LibraryStepInjector.groovy:218) [JTE] jdk.internal.reflect.GeneratedMethodAccessor444.invoke(Unknown Source) [JTE] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [JTE] java.base/java.lang.reflect.Method.invoke(Method.java:566) [JTE] org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [JTE] org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384) [JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) [JTE] org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69) [JTE] org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166) [JTE] org.boozallen.plugins.jte.init.primitives.injectors.LibraryStepInjector$_injectPrimitives_closure3$_closure11.doCall(LibraryStepInjector.groovy:115) [JTE] jdk.internal.reflect.GeneratedMethodAccessor3913.invoke(Unknown Source) [JTE] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [JTE] java.base/java.lang.reflect.Method.invoke(Method.java:566) [JTE] org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [JTE] org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) [JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) [JTE] groovy.lang.Closure.call(Closure.java:414) [JTE] groovy.lang.Closure.call(Closure.java:430) [JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040) [JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1895) [JTE] org.codehaus.groovy.runtime.dgm$160.invoke(Unknown Source) [JTE] org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274) [JTE] org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) [JTE] org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [JTE] org.boozallen.plugins.jte.init.primitives.injectors.LibraryStepInjector$_injectPrimitives_closure3.doCall(LibraryStepInjector.groovy:113) [JTE] jdk.internal.reflect.GeneratedMethodAccessor4115.invoke(Unknown Source) [JTE] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [JTE] java.base/java.lang.reflect.Method.invoke(Method.java:566) [JTE] org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [JTE] org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) [JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) [JTE] groovy.lang.Closure.call(Closure.java:414) [JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForMapEntry(DefaultGroovyMethods.java:5276) [JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2117) [JTE] org.codehaus.groovy.runtime.dgm$164.invoke(Unknown Source) [JTE] org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:251) [JTE] org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71) [JTE] org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [JTE] org.boozallen.plugins.jte.init.primitives.injectors.LibraryStepInjector.injectPrimitives(LibraryStepInjector.groovy:109) [JTE] jdk.internal.reflect.GeneratedMethodAccessor2694.invoke(Unknown Source) [JTE] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [JTE] java.base/java.lang.reflect.Method.invoke(Method.java:566) [JTE] org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213) [JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) [JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:810) [JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.invokeMethod(TemplatePrimitiveInjector.groovy) [JTE] groovy.lang.GroovyObject$invokeMethod$0.call(Unknown Source) [JTE] org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [JTE] groovy.lang.GroovyObject$invokeMethod$0.call(Unknown Source) [JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector$_invoke_closure1.doCall(TemplatePrimitiveInjector.groovy:144) [JTE] jdk.internal.reflect.GeneratedMethodAccessor3863.invoke(Unknown Source) [JTE] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [JTE] java.base/java.lang.reflect.Method.invoke(Method.java:566) [JTE] org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [JTE] org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) [JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) [JTE] groovy.lang.Closure.call(Closure.java:414) [JTE] groovy.lang.Closure.call(Closure.java:430) [JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040) [JTE] org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source) [JTE] org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274) [JTE] org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) [JTE] org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.invoke(TemplatePrimitiveInjector.groovy:139) [JTE] java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [JTE] java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [JTE] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [JTE] java.base/java.lang.reflect.Method.invoke(Method.java:566) [JTE] org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [JTE] org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46) [JTE] org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:102) [JTE] org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:222) [JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.orchestrate(TemplatePrimitiveInjector.groovy:88) [JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector$orchestrate.call(Unknown Source) [JTE] org.boozallen.plugins.jte.init.PipelineDecorator.initialize(PipelineDecorator.groovy:62) [JTE] org.boozallen.plugins.jte.init.PipelineDecorator$initialize.call(Unknown Source) [JTE] org.boozallen.plugins.jte.job.TemplateFlowDefinition.initializeJTE(TemplateFlowDefinition.groovy:67) [JTE] jdk.internal.reflect.GeneratedMethodAccessor2667.invoke(Unknown Source) [JTE] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [JTE] java.base/java.lang.reflect.Method.invoke(Method.java:566) [JTE] org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210) [JTE] org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59) [JTE] org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166) [JTE] org.boozallen.plugins.jte.job.TemplateFlowDefinition.create(TemplateFlowDefinition.groovy:60) [JTE] org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310) [JTE] hudson.model.ResourceController.execute(ResourceController.java:99) [JTE] hudson.model.Executor.run(Executor.java:431) org.boozallen.plugins.jte.util.AggregateException: The following errors occurred: 1: There can only be one @StepAlias annotation per step. Found 2 in npm library's npm_invoke.groovy at jdk.internal.reflect.GeneratedConstructorAccessor1316.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:239) at org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.invoke(TemplatePrimitiveInjector.groovy:138) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46) at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:102) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:222) at org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.orchestrate(TemplatePrimitiveInjector.groovy:88) at org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector$orchestrate.call(Unknown Source) at org.boozallen.plugins.jte.init.PipelineDecorator.initialize(PipelineDecorator.groovy:62) at org.boozallen.plugins.jte.init.PipelineDecorator$initialize.call(Unknown Source) at org.boozallen.plugins.jte.job.TemplateFlowDefinition.initializeJTE(TemplateFlowDefinition.groovy:67) at jdk.internal.reflect.GeneratedMethodAccessor2667.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166) at org.boozallen.plugins.jte.job.TemplateFlowDefinition.create(TemplateFlowDefinition.groovy:60) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310) at hudson.model.ResourceController.execute(ResourceController.java:99) at hudson.model.Executor.run(Executor.java:431) Finished: FAILURE
Include a library with the StepAlias annotation applied to a step with optional/default parameters:
// pipeline_config.groovy libraries{ npm{} }
// npm/steps/generic.groovy @StepAlias(["build", "unit_test"]) void call(appEnv = []){ // magic }
Jenkins Version
2.303.3
JTE Version
2.3
Bug Description
Using step aliasing on a library step with an optional/default parameter fails with the exception from this check: https://github.com/jenkinsci/templating-engine-plugin/blob/release/2.3/src/main/groovy/org/boozallen/plugins/jte/init/primitives/injectors/LibraryStepInjector.groovy#L207-L220
Relevant log output
Steps to Reproduce
Include a library with the StepAlias annotation applied to a step with optional/default parameters: