jenkinsci / templating-engine-plugin

create tool-agnostic, templated pipelines to be shared by multiple teams
https://jenkinsci.github.io/templating-engine-plugin/latest/
Apache License 2.0
171 stars 58 forks source link

[Bug]: library not found #335

Open prandelicious opened 9 months ago

prandelicious commented 9 months ago

Jenkins Version

2.375.4

JTE Version

2.5.3

Bug Description

I'm following the instructions on Learning Lab - The Basics and it fails with Library maven not found and Library sonarqube not found. I'm using Bitbucket to store the repo. Tried looking at the Gitter chat but no one seems to be answering any questions there. I apologize if this is not the correct place to ask this question.

Here's my repo structure:

.
└── libraries
    ├── maven
    │   └── steps
    │       └── build.groovy
    ├── pipeline_config.groovy
    └── sonarqube
        └── steps
            └── static_code_analysis.groovy

libraries/maven/steps/build.groovy:

void call() {
    stage("Maven: Build") {
        println "build from the maven library"
    }
}

libraries/sonarqube/steps/static_code_analysis.groovy:

void call() {
    stage("SonarQube: Static Code Analysis") {
        println "static code analysis from the sonarqube library"
    }
}

libraries/pipelines_config.groovy:

libraries {
    maven
    sonarqube
}

The JTE plugin is configured to use the libraries base directory.

Relevant log output

[JTE] 1: Library maven not found.  
[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:250)
[JTE] org.boozallen.plugins.jte.init.primitives.injectors.LibraryStepInjector$_validateConfiguration_closure1.doCall(LibraryStepInjector.groovy:68)
[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:98)
[JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
[JTE] org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
[JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
[JTE] groovy.lang.Closure.call(Closure.java:420)
[JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForMapEntry(DefaultGroovyMethods.java:5361)
[JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2202)
[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:128)
[JTE] org.boozallen.plugins.jte.init.primitives.injectors.LibraryStepInjector.validateConfiguration(LibraryStepInjector.groovy:53)
[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:98)
[JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
[JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
[JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
[JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:822)
[JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.invokeMethod(TemplatePrimitiveInjector.groovy)
[JTE] groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
[JTE] org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
[JTE] groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
[JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector$_invoke_closure1.doCall(TemplatePrimitiveInjector.groovy:149)
[JTE] jdk.internal.reflect.GeneratedMethodAccessor591.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:98)
[JTE] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
[JTE] org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
[JTE] groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
[JTE] groovy.lang.Closure.call(Closure.java:420)
[JTE] groovy.lang.Closure.call(Closure.java:436)
[JTE] org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2125)
[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:128)
[JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.invoke(TemplatePrimitiveInjector.groovy:144)
[JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.invoke(TemplatePrimitiveInjector.groovy)
[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:98)
[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:225)
[JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector.orchestrate(TemplatePrimitiveInjector.groovy:87)
[JTE] org.boozallen.plugins.jte.init.primitives.TemplatePrimitiveInjector$orchestrate$1.call(Unknown Source)
[JTE] org.boozallen.plugins.jte.job.TemplateFlowDefinition.create(TemplateFlowDefinition.groovy:85)
[JTE] org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:312)
[JTE] hudson.model.ResourceController.execute(ResourceController.java:107)
[JTE] hudson.model.Executor.run(Executor.java:449)

Steps to Reproduce

Followed the steps outlined in Learning Lab - The Basics

cokieffebah commented 5 months ago

does this still fail with the current jenkins:lts? are you using a container or running the jenkins application in a specific OS like Mac, Windows, linux?

cokieffebah commented 5 months ago

generated a library source in bitbucket.org, used a jenkins:lts image and used code from learning lab build succeeded.