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

[SBOM] Drop support for cyclonedx-python-lib v4 #89

Merged
merged 6 commits into from
Apr 12, 2024

Conversation

hedtke
Copy link
Contributor

@hedtke hedtke commented Nov 8, 2023

This PR drops support for cyclonedx-python-lib v4 as dependency track cannot parse the resulting XML. We now support only v5.

New XML was tested with dependency track v4.9.1 and it works now

fixes #88

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

This looks good, thanks for the contribution.

I'd like to ask if there are strong reasons to provide support for version 3. Maybe we can jump directly to support version 5 only, and simplify things? I guess that cyclonedx community is also moving forward, tooling, etc, will be supporting the latest versions, so we can move forward without issues and drop 3 support?

@hedtke
Copy link
Contributor Author

hedtke commented Nov 8, 2023

I'd like to ask if there are strong reasons to provide support for version 3. Maybe we can jump directly to support version 5 only, and simplify things? I guess that cyclonedx community is also moving forward, tooling, etc, will be supporting the latest versions, so we can move forward without issues and drop 3 support?

The GitHub Workflow for the Conan extensions works with python 3.6, and there only v3 is supported. I was surprised by the usage of such an old python version when I wrote the first version of the extension: #66 (comment)

component.external_references.add(ExternalReference(
type=ExternalReferenceType.WEBSITE, # noqa
url=XsUri(node.conanfile.homepage),
)) # noqa
return component

def me_as_tool() -> Tool:
tool = Tool(name="conan extension recipe:create-sbom")
if cyclonedx_major_version_is_4():
tool = Tool(name="conan extension sbom:cyclonedx")
Copy link
Contributor

Choose a reason for hiding this comment

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

this change of the route - is a breaking change, right?

... even though it was already documented as the "new" value in the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure what you mean by "route". I just stumbled across this outdated tool name. Something that I overlooked in #66. Should we keep it as it was?

Copy link
Contributor

Choose a reason for hiding this comment

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

understood.

@memsharded
Copy link
Member

The GitHub Workflow for the Conan extensions works with python 3.6, and there only v3 is supported. I was surprised by the usage of such an old python version when I wrote the first version of the extension: #66 (comment)

It is true that Conan itself still supports Python 3.6, this is our backward and stability commitment. If this is important and allows to simplify things and have a cleaner and simpler integration, I think we can increase the Python version requirement, and use something newer to test it. What minimum Python version would be necessary for version 5?

@hedtke
Copy link
Contributor Author

hedtke commented Nov 8, 2023

What minimum Python version would be necessary for version 5?

Python 3.8, https://pypi.org/project/cyclonedx-python-lib/

@hedtke
Copy link
Contributor Author

hedtke commented Nov 8, 2023

I would then drop the support for v3 of cyclonedx-python-lib completely

@CLAassistant
Copy link

CLAassistant commented Nov 15, 2023

CLA assistant check
All committers have signed the CLA.

@hedtke
Copy link
Contributor Author

hedtke commented Nov 20, 2023

What do we do here? Wait for minimum Python 3.8, or continue with supporting two different versions of cyclonedx-python-lib?

@memsharded
Copy link
Member

What do we do here? Wait for minimum Python 3.8, or continue with supporting two different versions of cyclonedx-python-lib?

I think we should be able to require Python 3.8 in the CI of this repo so this can be tested, and the extension could have a check for minimum Python version to give a good error in case some user tries to use it with older Python versions.

But I need to discuss this with the team and get feedback, sorry I haven't been able to do this yet, I'll do it as soon as possible.

@hedtke
Copy link
Contributor Author

hedtke commented Feb 1, 2024

I'd like to ping here 😸

@czoido
Copy link
Contributor

czoido commented Feb 1, 2024

I'd like to ping here 😸

Hi @hedtke,

I have just update the python version the CI runs to 3.8, so you can update the PR accordingly and add a warning to the extension and check for minimum Python version in the extension to give a good error in case some user tries to use it with older Python versions.
Thanks a lot and sorry for the delay

@hedtke
Copy link
Contributor Author

hedtke commented Apr 12, 2024

Sorry, it took me a while to continue here. Ready for the next review round. Support for cyclonedx-python-lib v4 dropped and Python 3.8 now required

Copy link
Contributor

@jkowalleck jkowalleck left a comment

Choose a reason for hiding this comment

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

why are all these # noqa needed?

def package_type_to_component_type(pt: str) -> ComponentType:
return ComponentType.APPLICATION if pt == "application" else ComponentType.LIBRARY

def licenses(ls: Optional[Union[Tuple[str, ...], Set[str], List[str], str]]) -> Optional[Iterable[LicenseChoice]]:
def licenses(ls: Optional[Union[Tuple[str, ...], Set[str], List[str], str]]):
Copy link
Contributor

Choose a reason for hiding this comment

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

where is the return type hint gone?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to drop it when we supported v3 and v5 which returned different things. I re-added them

return [LicenseChoice(license=LicenseFactory().make_from_string(i)) for i in ls] # noqa
else:
return [LicenseChoice(license_=LicenseFactory().make_from_string(i)) for i in ls]
return [LicenseFactory().make_from_string(i) for i in ls] # noqa
Copy link
Contributor

Choose a reason for hiding this comment

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

why is that # noqa needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, they were required when parts of the code were not tested in the CI, I dropped it

)
if node.conanfile.homepage and cyclonedx_major_version_is_4(): # bug in cyclonedx 3 enforces hashes
component = Component(
type=package_type_to_component_type(node.conanfile.package_type), # noqa
Copy link
Contributor

Choose a reason for hiding this comment

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

why uis this # noqa needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, they were required when parts of the code were not tested in the CI, I dropped it

Co-authored-by: Carlos Zoido <[email protected]>
Copy link
Contributor

@czoido czoido left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks a lot @hedtke for contributing this

@czoido czoido merged commit 3c971d1 into conan-io:main Apr 12, 2024
2 checks passed
fuzzypixelz added a commit to ZettaScaleLabs/zenoh-sboms that referenced this pull request Apr 18, 2024
fuzzypixelz added a commit to ZettaScaleLabs/zenoh-sboms that referenced this pull request Apr 18, 2024
* Add conan-recipes

* Add generate conan sboms for zenoh-c and zenoh-cpp

* fix: Conan SBOM filename

* feat: Support zenoh-pico

* fix: Update zenoh-recipes submodule

* chore: Rerun workflows

* chore: Rerun workflows (again)

* fix: Update cyclonedx-python-lib requirement

See conan-io/conan-extensions#89.

* fix: Autodetect Conan profile

* fix: Collapse path to Conan SBOMs

* fix: Handle error from `conan profile detect`

---------

Co-authored-by: Mahmoud Mazouz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SBOM XML namespace cannot be parsed by dependencytrack
6 participants