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

Add image reference to SBOM #1629

Merged
merged 3 commits into from
Nov 29, 2024
Merged

Add image reference to SBOM #1629

merged 3 commits into from
Nov 29, 2024

Conversation

Allda
Copy link
Contributor

@Allda Allda commented Nov 20, 2024

The SBOM generated by the buildah task now contains the reference to the image itself. The new script supports both spdx and cyclonedx format.

In order to inject the image reference to the SBOM steps were rearanged to push first and then generate SBOM. The code that stored the sbom into image itself was removed as not used anymore.

JIRA: ISV-5411

Before you complete this pull request ...

Look for any open pull requests in the repository with the title "e2e-tests update" and
see if there are recent e2e-tests updates that will be applicable to your change.

@Allda Allda marked this pull request as draft November 20, 2024 15:28
@Allda Allda force-pushed the ISV-5411 branch 2 times, most recently from 37483c9 to 26ec0e3 Compare November 21, 2024 13:20
@Allda Allda changed the title [WiP]Add image reference to SBOM Add image reference to SBOM Nov 21, 2024
@Allda Allda marked this pull request as ready for review November 21, 2024 13:21
@Allda
Copy link
Contributor Author

Allda commented Nov 21, 2024

The build task with new changes has been tested as part of this pipelinerun https://github.com/Allda/devfile-sample-python-basic/pull/16/checks?check_run_id=33323099120

@Allda
Copy link
Contributor Author

Allda commented Nov 25, 2024

@brunoapimentel @rcerven Can you guys please review this PR. Thanks

@tnevrlka
Copy link
Contributor

/ok-to-test

Copy link
Contributor

@chmeliik chmeliik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you split this into two commits?

  • Stop injecting SBOM into image
  • Add image reference to SBOM

The first change has potential consequences, it shouldn't be "hidden" in a commit that does something else

@Allda
Copy link
Contributor Author

Allda commented Nov 26, 2024

Could you split this into two commits?

* Stop injecting SBOM into image

* Add image reference to SBOM

The first change has potential consequences, it shouldn't be "hidden" in a commit that does something else

I split the change into 2 commits as suggested.

@chmeliik
Copy link
Contributor

/ok-to-test

@chmeliik
Copy link
Contributor

/retest

@chmeliik
Copy link
Contributor

tkn pr -n konflux-ci logs build-definitions-pull-request-nw6ql
[e2e-tests : e2e-test]   [FAILED] in [It] - /konflux-e2e/tests/build/build_templates.go:602 @ 11/26/24 14:28:35.951
[e2e-tests : e2e-test] • [FAILED] [4.849 seconds]
[e2e-tests : e2e-test] [build-service-suite Build templates E2E test] HACBS pipelines when the container image for component with Git source URL https://github.com/konflux-qe-bd/retrodep is created and pushed to container registry [It] contains non-empty sbom files [build, build-templates, HACBS, pipeline, sbom, slow, build-templates-e2e]
[e2e-tests : e2e-test] /konflux-e2e/tests/build/build_templates.go:600
[e2e-tests : e2e-test] 
[e2e-tests : e2e-test]   [FAILED] Unexpected error:
[e2e-tests : e2e-test]       <*errors.errorString | 0xc00171a0f0>: 
[e2e-tests : e2e-test]       failed to get sbom purl content: sbom file not found in path /tmp/eimage3422397966/root/buildinfo/content_manifests/sbom-purl.json
[e2e-tests : e2e-test]       {
[e2e-tests : e2e-test]           s: "failed to get sbom purl content: sbom file not found in path /tmp/eimage3422397966/root/buildinfo/content_manifests/sbom-purl.json",
[e2e-tests : e2e-test]       }
[e2e-tests : e2e-test]   occurred
[e2e-tests : e2e-test]   In [It] at: /konflux-e2e/tests/build/build_templates.go:602 @ 11/26/24 14:28:35.951

Looks like this will need a corresponding change in https://github.com/konflux-ci/e2e-tests

@Allda
Copy link
Contributor Author

Allda commented Nov 26, 2024

tkn pr -n konflux-ci logs build-definitions-pull-request-nw6ql
[e2e-tests : e2e-test]   [FAILED] in [It] - /konflux-e2e/tests/build/build_templates.go:602 @ 11/26/24 14:28:35.951
[e2e-tests : e2e-test] • [FAILED] [4.849 seconds]
[e2e-tests : e2e-test] [build-service-suite Build templates E2E test] HACBS pipelines when the container image for component with Git source URL https://github.com/konflux-qe-bd/retrodep is created and pushed to container registry [It] contains non-empty sbom files [build, build-templates, HACBS, pipeline, sbom, slow, build-templates-e2e]
[e2e-tests : e2e-test] /konflux-e2e/tests/build/build_templates.go:600
[e2e-tests : e2e-test] 
[e2e-tests : e2e-test]   [FAILED] Unexpected error:
[e2e-tests : e2e-test]       <*errors.errorString | 0xc00171a0f0>: 
[e2e-tests : e2e-test]       failed to get sbom purl content: sbom file not found in path /tmp/eimage3422397966/root/buildinfo/content_manifests/sbom-purl.json
[e2e-tests : e2e-test]       {
[e2e-tests : e2e-test]           s: "failed to get sbom purl content: sbom file not found in path /tmp/eimage3422397966/root/buildinfo/content_manifests/sbom-purl.json",
[e2e-tests : e2e-test]       }
[e2e-tests : e2e-test]   occurred
[e2e-tests : e2e-test]   In [It] at: /konflux-e2e/tests/build/build_templates.go:602 @ 11/26/24 14:28:35.951

Looks like this will need a corresponding change in https://github.com/konflux-ci/e2e-tests

I am not familiar with the e2e code base and I did just a quick check. Is this the place that needs to be remove?
https://github.com/konflux-ci/e2e-tests/blob/main/tests/build/build_templates.go#L600

@chmeliik
Copy link
Contributor

I am not familiar with the e2e code base and I did just a quick check. Is this the place that needs to be remove? https://github.com/konflux-ci/e2e-tests/blob/main/tests/build/build_templates.go#L600

Me neither 😅 but yes, I think that's the place

@Allda
Copy link
Contributor Author

Allda commented Nov 26, 2024

I am not familiar with the e2e code base and I did just a quick check. Is this the place that needs to be remove? https://github.com/konflux-ci/e2e-tests/blob/main/tests/build/build_templates.go#L600

Me neither 😅 but yes, I think that's the place

I opened a PR there with the change. Once the CI passes please review konflux-ci/e2e-tests#1465

Copy link
Contributor

@chmeliik chmeliik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file not found in path /tmp/eimage3422397966/root/buildinfo/content_manifests/sbom-purl.json

This made me realize we can also delete the code that creates sbom-purl.json. I believe that the file isn't used for anything anymore

@Allda
Copy link
Contributor Author

Allda commented Nov 28, 2024

/retest

1 similar comment
@Allda
Copy link
Contributor Author

Allda commented Nov 28, 2024

/retest

@Allda
Copy link
Contributor Author

Allda commented Nov 28, 2024

@chmeliik The e2e test is green now. Can you do a last round of review and merge if all looks good? Thanks

@Allda Allda force-pushed the ISV-5411 branch 2 times, most recently from 6c56baf to 39d172c Compare November 29, 2024 09:34
@Allda
Copy link
Contributor Author

Allda commented Nov 29, 2024

@chmeliik I also removed the purl script from the tekton task and here is another PR that removes the script itself konflux-ci/build-tasks-dockerfiles#193

Copy link
Contributor

@chmeliik chmeliik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We can keep the version bump after all, it doesn't really hurt anything. Thanks for adding the "changelog" to the README

@Allda
Copy link
Contributor Author

Allda commented Nov 29, 2024

LGTM. We can keep the version bump after all, it doesn't really hurt anything. Thanks for adding the "changelog" to the README

So do you want to bump a patch version to 0.2.1?

EDIT: Never mind.. I didn't realize I never reverted it back to 0.2

@Allda
Copy link
Contributor Author

Allda commented Nov 29, 2024

/retest

2 similar comments
@Allda
Copy link
Contributor Author

Allda commented Nov 29, 2024

/retest

@Allda
Copy link
Contributor Author

Allda commented Nov 29, 2024

/retest

The SBOM was stored into a container image as part of a build step. This
feature is however obsolete and not needed anymore.

From now on a containers won't have an SBOM stored inside of
/root/buildinfo/content_manifests/ directory.

JIRA: ISV-5411

Signed-off-by: Ales Raszka <[email protected]>
The SBOM generated by the buildah task now contains the reference to the
image itself. The new script supports both spdx and cyclonedx format.

JIRA: ISV-5411

Signed-off-by: Ales Raszka <[email protected]>
The script is no longer needed since we don't use its output anymore.

Signed-off-by: Ales Raszka <[email protected]>
@chmeliik chmeliik added this pull request to the merge queue Nov 29, 2024
Merged via the queue into konflux-ci:main with commit 4ccd3a6 Nov 29, 2024
15 checks passed
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

Successfully merging this pull request may close these issues.

4 participants