Thanks for the suggestion. I will have to do so if I couldn't figure out a fix.
I intend to run it on the Jenkins master for 2 reasons. 1. The Jenkins master has no static working node. Each build task will get a dynamically provisioned worker node. 2. The task which uses the library is very brief. It takes less than 3 seconds when it was working. It feels an overkill to get a worker node. On Thursday, April 23, 2020 at 7:54:32 PM UTC-5, Mark Waite wrote: > > Wouldn't it be much safer to run a separate program to use that library? > By loading the library into the Jenkins master process you are placing the > Jenkins master at risk so that you can perform REST API calls to Gerrit. > > It is likely also much more difficult to test the REST API calls since you > must run the Jenkins pipeline to test them. > > If you place them in a separate program and run them from a shell step, > you can test them independently and run them without risking surprises > inside the Jenkins master. > > Mark Waite > > On Tue, Apr 21, 2020 at 9:27 AM Liejun Tao <liejun...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> I'm seeking some help to use gerrit-rest-java-client >> <https://github.com/uwolfer/gerrit-rest-java-client> in Jenkins Shared >> library. >> >> It seems more suitable to seek help in Gerrit forum, but I think there are >> many Jenkins experts here and if someone uses Gerrit-Jenkins interaction >> could help me out. >> >> >> I'm using the lib to do customized comment/review for Gerrit change from >> Jenkins Shared Library like this: >> >> >> @Grab('com.urswolfer.gerrit.client.rest:gerrit-rest-java-client:0.8.15') >> import com.google.gerrit.extensions.api.GerritApi >> ... >> >> >> >> It was working OK on and older Jenkins version 2.138.4 but broken on >> 2.176.4, with the Error below. >> >> I searched a bit and thought it's related with Guava and ClassLoader >> >> I appreciate any advise to help investigate and get a solution. >> >> java.lang.NoSuchMethodError: >> com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V >> at com.google.common.reflect.TypeCapture.capture(TypeCapture.java:32) >> at com.google.common.reflect.TypeToken.<init>(TypeToken.java:125) >> at >> com.urswolfer.gerrit.client.rest.http.changes.ChangesParser$1.<init>(ChangesParser.java:33) >> at >> com.urswolfer.gerrit.client.rest.http.changes.ChangesParser.<clinit>(ChangesParser.java:33) >> at >> com.urswolfer.gerrit.client.rest.GerritApiImpl$3.get(GerritApiImpl.java:67) >> at >> com.urswolfer.gerrit.client.rest.GerritApiImpl$3.get(GerritApiImpl.java:63) >> at >> com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:109) >> at >> com.urswolfer.gerrit.client.rest.GerritApiImpl.changes(GerritApiImpl.java:121) >> 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.PojoMetaClassSite.call(PojoMetaClassSite.java:47) >> 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 tech.cnhi.jenkins.Gerrit.queryChangesFirst10(Gerrit.groovy:24) >> at Script1.queryGerrit(Script1.groovy:4) >> at Script1.gerritTest(Script1.groovy:33) >> at WorkflowScript.run(WorkflowScript:44) >> at ___cps.transform___(Native Method) >> at >> com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86) >> at >> com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113) >> at >> com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:78) >> at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:498) >> at >> com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) >> at >> com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) >> at com.cloudbees.groovy.cps.Next.step(Next.java:83) >> at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) >> at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) >> at >> org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129) >> at >> org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268) >> at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) >> at >> org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) >> at >> org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) >> at >> org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185) >> at >> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400) >> at >> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96) >> at >> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312) >> at >> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276) >> at >> org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67) >> at java.util.concurrent.FutureTask.run(FutureTask.java:266) >> at >> hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) >> at >> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) >> at >> jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) >> at >> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) >> at java.util.concurrent.FutureTask.run(FutureTask.java:266) >> at >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) >> at java.lang.Thread.run(Thread.java:748) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to jenkins...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/8888e0f6-af9c-440d-896b-cc7d916a9225%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-users/8888e0f6-af9c-440d-896b-cc7d916a9225%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8fe0f4be-22d6-4dfc-905c-f869f466ddb4%40googlegroups.com.