Skip to content

fix: #23915 podman build is not parsing sbom command line arguments #25647

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aguidirh
Copy link

Issue Description

SBOM flags are not respected while podman build command.

At the same time buildah build command works as expected.

Fixes #23915

Steps to reproduce the issue

With the following Containerfile:

FROM ubuntu:22.04
WORKDIR /app

Run the following podman build:

podman build -t sbom-img --sbom=trivy-spdx \
        --sbom-image-output=/app/sbom-spdx.json \
        --sbom-output=sbom-spdx.json \
        --sbom-scanner-image=ghcr.io/aquasecurity/trivy \
        --sbom-scanner-command="trivy filesystem -q {ROOTFS} --format spdx-json --output {OUTPUT}" \
        --sbom-scanner-command="trivy filesystem -q {CONTEXT} --format spdx-json --output {OUTPUT}" \
        --sbom-merge-strategy=merge-spdx-by-package-name-and-versioninfo \
        -f Containerfile

Create a container with the image built in the previous step and check if the file sbom-spdx.json is inside of the container as requested:

podman run -it --rm sbom-img ls -al

Expected result:

drwxr-xr-x. 1 root root     28 Mar 21 13:06 .
dr-xr-xr-x. 1 root root     12 Mar 21 13:17 ..
-rw-r--r--. 1 root root 147729 Mar 21 13:06 sbom-spdx.json

Actual results:

drwxr-xr-x. 1 root root     28 Mar 21 13:06 .
dr-xr-xr-x. 1 root root     12 Mar 21 13:17 ..

Running the steps above with the code from this PR shows the expected result (the same as when using buildah), while running with the code from the main branch shows the actual result (with the bug).

Does this PR introduce a user-facing change?

None

Copy link
Contributor

openshift-ci bot commented Mar 21, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aguidirh
Once this PR has been reviewed and has the lgtm label, please assign luap99 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@baude
Copy link
Member

baude commented Mar 21, 2025

@baude
Copy link
Member

baude commented Mar 21, 2025

@nalind ptal

@baude
Copy link
Member

baude commented Mar 21, 2025

and you need to add a release note ... this is cli and is an outward change.

and add a test

@aguidirh
Copy link
Author

Hi @baude,

please sign your commits https://github.com/containers/podman/blob/main/CONTRIBUTING.md#sign-your-prs

I believe the commit is signed.

and you need to add a release note

I did not add a release note because in the template it was saying to add it only in case of user-facing change, there is no user-facing change, only a bug fix for the flags that were already there.

@nalind
Copy link
Member

nalind commented Mar 21, 2025

This looks exactly what github.com/containers/buildah/pkg/cli.GenBuildOptions() does, so I expect it's going to handle the options correctly, so LGTM.
But if podman isn't calling that function, I have to wonder why we went to the trouble of exporting it there.

@aguidirh
Copy link
Author

/retest

Copy link
Contributor

openshift-ci bot commented Mar 21, 2025

@aguidirh: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@aguidirh
Copy link
Author

Hi @nalind,

I added the test requested by @baude.

They are passing locally, I am not sure why some tests are failing in the PR.

Could you please /retest them?

@nalind
Copy link
Member

nalind commented Mar 21, 2025

/ok-to-test

@nalind
Copy link
Member

nalind commented Mar 21, 2025

/retest

@aguidirh aguidirh force-pushed the fix/issue-23915 branch 2 times, most recently from 57d0980 to 3e42437 Compare March 24, 2025 17:49
@baude
Copy link
Member

baude commented Mar 25, 2025

the test [FAIL] Podman build [It] podman build with sbom flags is failing here.

@baude
Copy link
Member

baude commented Mar 25, 2025

also note the failures are all remote tests

@aguidirh
Copy link
Author

aguidirh commented Mar 26, 2025

also note the failures are all remote tests

Thanks @baude, I will have a look why they are failing for the remote tests and try to fix them.

…rguments

Signed-off-by: Alex Guidi <aguidi@redhat.com>
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Apr 11, 2025
Signed-off-by: Alex Guidi <aguidi@redhat.com>
@l0rd
Copy link
Member

l0rd commented Apr 15, 2025

Great job @aguidirh , tests are passing. If you don't mind, it would be helpful to add some remote tests (see pkg/machine/e2e). Also, please squash your commits as CI tests were not passing for the first one.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
kind/api-change Change to remote API; merits scrutiny ok-to-test release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SBOM. sbom flags are not respected
4 participants