The ClamAvRecorder (see
https://github.com/jenkinsci/clamav-plugin/blob/master/src/main/java/org/jenkinsci/plugins/clamav/ClamAvRecorder.java)
  extends Recorder (see https://javadoc.jenkins.io/hudson/tasks/Recorder.html )
which implements BuildStep.
So I thought it should work (?).

The snippet generator does not know about the ClamAv plugin.



On Wed, Jul 03, 2019 at 07:45:49AM -0700, Slide wrote:
> I would highly recommend using the snippet generator to do stuff like this.
> It may be that the ClamAv plugin will not work in pipeline at all though.
> It doesn't look like the recorder implements SimpleBuildStep which is a
> minimum requirement for something to work in pipeline.
> 
> On Wed, Jul 3, 2019, 06:17 <[email protected]> wrote:
> 
> > Hi,
> >
> > I have a scripted pipeline and want to add a call to the ClamAV plugin.
> > If I manually configure a working freestyle job that runs the ClamAV
> > plugin I see the following in the config.xml:
> >    <publishers>
> >      <org.jenkinsci.plugins.clamav.ClamAvRecorder plugin="[email protected]">
> >            <includes>**</includes>
> >      </org.jenkinsci.plugins.clamav.ClamAvRecorder>
> >    </publishers>
> >
> > Since I want to call ClamAV in a pipeline I put this snippet in there:
> >    import org.jenkinsci.plugins.clamav.ClamAvRecorder
> >    [...]
> >    step ([$class: 'ClamAvRecorder', includes: "**", excludes: "" ])
> >
> > However I am getting the following exception:
> >
> > java.lang.IllegalArgumentException: java.lang.ClassCastException@79aed164
> >         at sun.reflect.GeneratedConstructorAccessor177.newInstance(Unknown
> > Source)
> >         at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> >         at
> > org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:289)
> >         at
> > org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
> >         at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
> >         at
> > org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
> >         at
> > org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
> >         at sun.reflect.GeneratedMethodAccessor6075.invoke(Unknown Source)
> >         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 org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:158)
> >         at
> > org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
> >         at
> > org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
> >         at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:156)
> >         at
> > org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:160)
> >         at
> > org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
> >         at
> > org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
> >         at
> > org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
> >         at
> > com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
> > Caused: java.lang.IllegalArgumentException: Could not instantiate
> > {delegate={$class=org.jenkinsci.plugins.clamav.ClamAvRecorder, includes=**,
> > excludes=}} for CoreStep(delegate:
> > SimpleBuildStep{AnalysisPublisher(androidLintActivated?:
> >
> >
> >
> > Any idea how I can call ClamAV so it works?
> >
> > Thanks,
> > Martin
> >
> > PS: I'd be grateful for any other hints on scanning build results for
> > malware
> >
> > --
> > 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 [email protected].
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/jenkinsci-users/20190703081143.GF17110%40sourco.de
> > .
> > For more options, visit https://groups.google.com/d/optout.
> >
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfv%2BX5AHj7ws-W694pcA4_M9A5vy1Y0ErgVUU3o7OZmsA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/20190703150257.GG17110%40sourco.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to