'groovy.lang.MissingMethodException: No signature of method: while running method scanload
I am new to groovy and am trying to pass a closure as a parameter to a method , below is my code , I am using Groovy 2.4
package api
public static void scanload(String VERACODE_API_ID, String VERACODE_API_SECRET, String failOnSeverity, String BaseFile ) {
sh """#!/bin/bash
set
python --version
cd PipelineScan && cp PipelineScan.py .. && cd ..
ls -lrth
git diff --name-only HEAD^ HEAD > list_files.txt
cat list_files.txt
cat list_files.txt | zip -@ diffedfiles.zip
ls -lrth
mkdir test && cp diffedfiles.zip test/ && cd test && unzip diffedfiles.zip && mkdir latestCommit && find . -type f -exec cp {} latestCommit/ \\; && cd ..
cp -R test/latestCommit .
cd latestCommit && zip latestCommit.zip * && mv latestCommit.zip .. && cd ..
ls -lrth
python PipelineScan.py "PipelineScan('${VERACODE_API_ID}', '${VERACODE_API_SECRET}', '${failOnSeverity}', '${BaseFile}')"
"""
}
I am getting the below exception when i am trying to execute it ,
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: static api.Scan.sh() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [#!/bin/bash
set
python --version
cd PipelineScan && cp PipelineScan.py .. && cd ..
ls -lrth
git diff --name-only HEAD^ HEAD > list_files.txt
cat list_files.txt
cat list_files.txt | zip -@ diffedfiles.zip
ls -lrth
mkdir test && cp diffedfiles.zip test/ && cd test && unzip diffedfiles.zip && mkdir latestCommit && find . -type f -exec cp {} latestCommit/ \; && cd ..
cp -R test/latestCommit .
cd latestCommit && zip latestCommit.zip * && mv latestCommit.zip .. && cd ..
ls -lrth
python PipelineScan.py "PipelineScan('VERACODE_API_ID', 'VERACODE_API_SECRET', 'VeryHigh', 'result.json')"
]
Possible solutions: use([Ljava.lang.Object;), is(java.lang.Object), run(), run(), any(), each(groovy.lang.Closure)
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1501)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1487)
at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
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)
Could anyone please help ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
