Skip to content

Add support for buildpack.toml files #4031

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

NucleonGodX
Copy link
Contributor

@NucleonGodX NucleonGodX commented Dec 19, 2024

Fixes #3477

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁

Signed-off-by: NucleonGodX manitsingh018@gmail.com

@NucleonGodX NucleonGodX marked this pull request as draft December 19, 2024 07:18
@NucleonGodX NucleonGodX marked this pull request as ready for review December 23, 2024 09:37
@NucleonGodX NucleonGodX marked this pull request as draft December 24, 2024 04:52
@NucleonGodX NucleonGodX marked this pull request as ready for review December 24, 2024 13:55
@NucleonGodX NucleonGodX changed the title Added support for buildpack.toml files Add support for buildpack.toml files Dec 31, 2024
…pack package

Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

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

Thanks++ @NucleonGodX for the PR!
This is a great start.
See my comments for your consideration.

keywords = ["java", "apm", "trace", "opentelemetry"]
name = "Paketo Buildpack for OpenTelemetry"
sbom-formats = ["application/vnd.cyclonedx+json", "application/vnd.syft+json"]
version = "{{.version}}"
Copy link
Member

Choose a reason for hiding this comment

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

This is not useful to parse and store directly as version, check the spec for how we could deduce this

Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
@NucleonGodX
Copy link
Contributor Author

Thanks @AyanSinhaMahapatra for your suggestions, I've implemented them.

Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

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

@NucleonGodX thanks++ for your changes, see comments for some more improvements, and this should be ready to merge after.

"type": "generic",
"namespace": null,
"name": "java-memory-assistant",
"version": "{{.version}}",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"version": "{{.version}}",
"version": null,

We should not keep a version value if we cannot extract this properly from somewhere in the manifest or elsewhere.

"is_optional": false,
"is_pinned": false,
"is_direct": true,
"resolved_package": {},
Copy link
Member

Choose a reason for hiding this comment

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

There is a bit more information here about dependencies that we can store, since the dependencies are also resolved. This would be a PackageData mapping, with extra information about the dependencies, including the purl fields, license info and others. Please check the spec to see what other info can be specified here, and add tests accordingly with richer data as applicable.

id = "java-memory-assistant"
name = "Java Memory Assistant Agent"
purl = "pkg:generic/sap-java-memory-assistant@0.5.0?arch=amd64"
sha256 = "9c5ffb4bdeec5ed6b4f1d734469500754a857d1452c3d253d89e2315addb04c5"
Copy link
Member

Choose a reason for hiding this comment

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

We need to preserve all these checksum, license, urls info in resolved_package field for the dependency. See comment below in the test expectation file too

uri = "https://github.com/paketo-buildpacks/java-memory-assistant/blob/main/LICENSE"

[metadata]
include-files = ["LICENSE", "NOTICE", "README.md", "linux/amd64/bin/build", "linux/amd64/bin/detect", "linux/amd64/bin/main", "linux/amd64/bin/helper", "linux/arm64/bin/build", "linux/arm64/bin/detect", "linux/arm64/bin/main", "linux/arm64/bin/helper", "buildpack.toml"]
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra Apr 25, 2025

Choose a reason for hiding this comment

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

We should also have these in the extra_data as this can be useful to assemble packages potentially.

result_packages = list(buildpack.BuildpackHandler.parse(test_file))
expected_packages = [
models.PackageData(
type=buildpack.BuildpackHandler.default_package_type,
Copy link
Member

Choose a reason for hiding this comment

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

YOu need to have these in test expectation files, this would be very hard to add/regenerate on changes otherwise. See the check_packages_data function used elsewhere like https://github.com/aboutcode-org/scancode-toolkit/blob/develop/tests/packagedcode/test_cargo.py#L60

Copy link
Member

Choose a reason for hiding this comment

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

You don't need to add two tests for these, just checking package data in each manifest case once is fine, and add one full scan (with run_scan_click like you've done above) overall for each type of buildpack manifests is enough.

package_data = dict(
datasource_id=cls.datasource_id,
type=cls.default_package_type,
name=name,
Copy link
Member

Choose a reason for hiding this comment

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

You are extracting namespace above but not including it in PackageData here.

homepage_url=buildpack.get("homepage"),
keywords=buildpack.get("keywords", []),
extracted_license_statement=None,
dependencies=[],
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to add dependencies and extra_data like this, as these are initialized by default. Remove these two lines.

@NucleonGodX
Copy link
Contributor Author

Hey @AyanSinhaMahapatra, thanks for your suggestions, I will apply them in a few days.

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.

Add support for buildpack.toml manifest
2 participants