I have the following configuration:
stage('Snyk') {
steps {
snykSecurity(
snykInstallation: 'Snyk',
snykTokenId: 'SNYK_TOKEN',
)
{
{ }
}}
}
The job fails with the following error:
[Pipeline]
{ (Snyk)[Pipeline] snykSecurity ([hide|https://example.com/job/Customer%20Portal/11/console#])Testing project... > /home/someuser/jenkins/tools/io.snyk.jenkins.tools.SnykInstallation/Snyk/snyk-linux test --json --severity-threshold=low FATAL: Snyk Security scan failed. java.nio.charset.MalformedInputException: Input length = 1 at java.base/java.lang.StringCoding.throwMalformed(StringCoding.java:707) at java.base/java.lang.StringCoding.throwMalformed(StringCoding.java:713) at java.base/java.lang.StringCoding.newStringNoRepl1(StringCoding.java:1040) at java.base/java.lang.StringCoding.newStringNoRepl(StringCoding.java:1015) at java.base/java.lang.System$2.newStringNoRepl(System.java:2197) at java.base/java.nio.file.Files.readString(Files.java:3287) at hudson.FilePath$ReadToString.invoke(FilePath.java:2377) at hudson.FilePath$ReadToString.invoke(FilePath.java:2372) at hudson.FilePath.act(FilePath.java:1192) at hudson.FilePath.act(FilePath.java:1175) at hudson.FilePath.readToString(FilePath.java:2369) at io.snyk.jenkins.SnykTest.testProject(SnykTest.java:65) at io.snyk.jenkins.SnykStepFlow.testProject(SnykStepFlow.java:62) at io.snyk.jenkins.SnykStepFlow.perform(SnykStepFlow.java:36) at io.snyk.jenkins.workflow.SnykSecurityStep$Execution.run(SnykSecurityStep.java:172) at io.snyk.jenkins.workflow.SnykSecurityStep$Execution.run(SnykSecurityStep.java:159) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)[Pipeline] }
[Pipeline] // stage
I have tried using --debug to get more details but I have no clue. Everything seems to be working until the last part. See the attached log.
I think this error occurs if Jenkins is not configured to use UTF8 (-Dfile.encoding=UTF8)