konflux-ci / build-definitions

Apache License 2.0
21 stars 117 forks source link

Task "show-sbom" raises this error: level=fatal msg="Exactly one argument expected" #1466

Open cmoulliard opened 3 weeks ago

cmoulliard commented 3 weeks ago

Issue

The Task "show-sbom" raises an error when executed with this PipelineRun - https://github.com/redhat-buildpacks/builder-ubi-base/blob/main/.tekton/pipelinerun-builder-ubi-base.yaml#L37-L50

Error

builder-ubi-base-9dbgl-show-sbom[Duration: 15 seconds]

builder-ubi-base-9dbgl-show-sbom
[prepare] 2024/09/11 16:06:40 Entrypoint initialization

[place-scripts] 2024/09/11 16:06:41 Decoded script /tekton/scripts/script-0-fxckb

[show-sbom] time="2024-09-11T16:06:43Z" level=fatal msg="Exactly one argument expected"
[show-sbom] /tekton/scripts/script-0-fxckb: line 25: [: ==: unary operator expected
[show-sbom] Failed to get SBOM after 5 tries
[show-sbom] Error: accepts 1 arg(s), received 7
[show-sbom] main.go:74: error during command execution: accepts 1 arg(s), received 7
[show-sbom] Error: accepts 1 arg(s), received 7
[show-sbom] main.go:74: error during command execution: accepts 1 arg(s), received 7
[show-sbom] Error: accepts 1 arg(s), received 7
[show-sbom] main.go:74: error during command execution: accepts 1 arg(s), received 7
[show-sbom] Error: accepts 1 arg(s), received 7
[show-sbom] main.go:74: error during command execution: accepts 1 arg(s), received 7
[show-sbom] Error: accepts 1 arg(s), received 7
[show-sbom] main.go:74: error during command execution: accepts 1 arg(s), received 7

%!s(<nil>)
chmeliik commented 1 week ago

What did you pass as the IMAGE_URL? It looks like it was 7 whitespace-separated items

[show-sbom] Failed to get SBOM after 5 tries
[show-sbom] Error: accepts 1 arg(s), received 7
cmoulliard commented 1 week ago

Here is a recent job executed : https://console.redhat.com/application-pipeline/workspaces/cmoullia/applications/buildpack-remote/pipelineruns/builder-ubi-base-cpffn

IMAGE_URL populated is the following and don't include white spaces

quay.io/redhat-user-workloads/cmoullia-tenant/buildpack-remote/builder-ubi-base:c5c33d9829696a26e807e745dc56aa983fc2fc0f

Screenshot 2024-10-09 at 11 10 01

chmeliik commented 1 week ago

We won't really be able to reproduce this since you have a highly custom pipeline. Could you try running a modified version of the show-sbom task (e.g. add set -x to the bash script) in your pipeline and debugging what is going wrong?