griddynamics / mpl

[IT-36925] Jenkins Shared Modular Pipeline Library
https://blog.griddynamics.com/developing-a-modular-pipeline-library-to-improve-devops-collaboration/
Apache License 2.0
156 stars 97 forks source link

Issue with module from project #59

Closed and-1 closed 4 years ago

and-1 commented 4 years ago

When i use module from project repo i get error

hudson.remoting.ProxyException: com.griddynamics.devops.mpl.MPLModuleException: Found error during execution of the module '.jenkins/modules/Build/Build.groovy#null':
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
.jenkins/modules/Build/Build.groovy: 1: unexpected token: @ @ line 1, column 30.
   sun.nio.ch.ChannelInputStream@4886b758
                                ^

1 error

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
    at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
    at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:350)
    at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:144)
    at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
    at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
    at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
    at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
    at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
    at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
    at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.parse(CpsGroovyShell.java:113)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:584)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:604)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
    at com.griddynamics.devops.mpl.Helper.runModule(Helper.groovy:245)
    at MPLModule.call(MPLModule.groovy:86)
    at MPLModule.call(MPLModule.groovy)
    at WorkflowScript.run(WorkflowScript:13)

Module contain simple step like echo "good job"

In library modules work fine

Jenkins = 2.223 workflow-cps = 2.80 workflow-job = 2.37 workflow-cps-global-lib = 2.16

sparshev commented 4 years ago

Hi @and-1 , hmmm... The process of loading the modules should be quite the same, but need to check. Maybe the last modifications of silent loading break the reading of workspace modules.

sparshev commented 4 years ago

Yeah, confirmed - latest master contains the issue with project modules.

sparshev commented 4 years ago

Yeah, so Helper.pathRead is not working properly - it's used during loading the local modules.

sparshev commented 4 years ago

@and-1 thank you for this bug report - I just pushed the fix, soon it will be reviewed and merged.

and-1 commented 4 years ago

Good news, thanks for your fast reaction

sparshev commented 4 years ago

Ok, just merged to master - please feel free to reopen the issue if the solution is not working for you.