Skip to content

added support to parse labels in dockerfile #3987

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 10 commits into
base: develop
Choose a base branch
from

Conversation

VarshaUN
Copy link

Fixes #3561

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁

Signed-off-by: Varsha U N varshaun58@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.

@VarshaUN Thanks++

Looking good, need another round of changes and a lot more tests here for the added functionality, and this should be much better.

@VarshaUN
Copy link
Author

@AyanSinhaMahapatra I have added everything that you told me. Please review it.

@VarshaUN VarshaUN force-pushed the support-OCI-labels branch 5 times, most recently from a7ba60e to adf690a Compare January 11, 2025 15:25
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>

Signed-off-by: Jono Yang <jyang@nexb.com>

Signed-off-by: Jono Yang <jyang@nexb.com>

addded support to parse labels in dockerfile

Signed-off-by: Varsha U N <varshamaddur2006@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++ @VarshaUN this is looking great! A few more comments for your consideration. Thank you for your patience

Can you also remove this file which was added with your PR: tests/packagedcode/__pycache__/test_parse_pyproject_toml.cpython-312-pytest-8.3.3.pyc.26520?

Please also make sure you look into test failures (many are failing as an effect of this PR) and try to resolve them if they are related to your PR, also merge from develop since it's been a while.

from packagedcode.dockerfile import DockerfileHandler

class TestDockerfileHandler:

Copy link
Member

Choose a reason for hiding this comment

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

Can you also run one full scan for one case, like the test here: https://github.com/aboutcode-org/scancode-toolkit/blob/develop/tests/packagedcode/test_cargo.py#L158, one is enough, don't have to do this for all files

expected_packages = self.load_expected(expected_loc)
assert packages == expected_packages

def test_extract_oci_labels_from_dockerfile(self, mocker):
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 an issue here, how is the files generated by this test different from the test functions test_parse_dockerfile above? You are using the same filenames for the test expectations so we are missing a set of test files.

We want to have two sets of tests distinctly both for DockerfileHandler.parse and DockerfileHandler.extract_oci_labels_from_dockerfile and this should generate 2 sets of files so 2 docker/container files and total 6 test expectation files. You might want to use -package.expected.json and -expected.json to differentiate there.

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.

@VarshaUN thanks for the updates, please fix all test failures. Looks good and ready to merge otherwise.

Signed-off-by: Varsha U N <varshaun58@gmail.com>
Signed-off-by: Varsha U N <varshaun58@gmail.com>
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.

Treat Dockerfile and Containerfile as "non-assembled" package data, collect OCi labels
3 participants