-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Error was: Input length = 1 while publishing bom.json in Jenkins pipeline #138
Comments
Please check the encoding of the file and the encoding of the Jenkins machine where this actions runs on. The source of the /**
* Reads this file into a string, by using the current system encoding on the remote machine.
*/
public String readToString() throws IOException, InterruptedException {
return act(new ReadToString());
}
private static class ReadToString extends MasterToSlaveFileCallable<String> {
private static final long serialVersionUID = 1L;
@Override
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
return Files.readString(fileToPath(f), Charset.defaultCharset());
}
} Versions of Jenkins prior to 2.346 did not used the default charset (1, 2), they used return JLA.newStringNoRepl(ba, cs); |
Thank you @sephiroth-j ! The file encoding of the bom.json was UTF-8. But the jenkins was the problem. In our environment we have a jenkins master running on Linux and a jenkins slave running on windows 2019.
Source of this information was: https://www.linkedin.com/pulse/how-resolve-utf-8-encoding-issue-jenkins-ajuram-salim#:~:text=In%20normal%20cases%20Jenkins%20pass%20the%20characters%20in,4%20bytes%29%20which%20can%20encode%20all%20possible%20characters. After that, the bom.json for angular is uploaded successfully. So the ticket can be closed / rejected. I just wonder why I could upload a bom.json for nuget-packages in the same jenkinsfile and environment and with the bom.json for npm/angular it did not work. Maybe that's a point for the documentation? Thank you and sorry for opening the issue! Stefan |
The next major release will update the Jenkins baseline and incorporate the file reading changes introduced in Jenkins 2.346. |
Describe the bug
The upload of a bom.json of an angular project to the Dependency-Track server is not possible due to the error:
"[DependencyTrack] Es ist ein Fehler beim verarbeiten des Artefakts "path_to_file\angular_sbom.json" aufgetreten. Der Fehler war: Input length = 1"
In English:
"[DependencyTrack] An error occurred processing artifact "path_to_file\angular_sbom.json". Error was: Input length = 1"
Environment
To Reproduce
Steps to reproduce the behavior (in a declarative pipeline):
cyclonedx-npm <path_to_angular-project>\package.json --output-reproducible --short-PURLs --output-file angular_sbom.json
(using the jenkinsfile)dependencyTrackPublisher artifact: "${angularOutputFile}", projectName: "${projectName}", projectVersion: "${projectVersion}", synchronous: "${dtSynchronous}", dependencyTrackApiKey: "<top-secret>"
As you can imagine, the variables are filled correctly. The reason why I'm quite sure about it is that it's the same why I upload a bom.json for a nuget project and that works fine.
Expected behavior
The bom.json can be uploaded successfully to the Dependency-Track server.
Additional context
The text was updated successfully, but these errors were encountered: