Skip to content
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

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

Open
cmoulliard opened this issue Sep 25, 2024 · 4 comments

Comments

@cmoulliard
Copy link

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
Copy link
Contributor

chmeliik commented Oct 7, 2024

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
Copy link
Author

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
Copy link
Contributor

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?

@tkdchen
Copy link
Contributor

tkdchen commented Oct 28, 2024

We need these updates to the script block:

Reference https://stackoverflow.com/questions/13617843/unary-operator-expected-error-in-bash-if-condition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants