Skip to content

Conversation

@crozzy
Copy link
Contributor

@crozzy crozzy commented May 19, 2025

Red Hat's new container image builder system does not include a
dockerfile at a known path in the image, this is replaces with a file
called labels.json file at a known location that contains the
information that the rhcc package and repository scanners need. This
change adds another rhcc package and repository scanner that read this
labels.json file. The dockerfile versions still exist but will be
eventually deprecated and removed.

@crozzy crozzy force-pushed the support-new-rhcc-logic branch 3 times, most recently from ddb6eba to 9046b95 Compare May 21, 2025 22:32
@crozzy crozzy force-pushed the support-new-rhcc-logic branch 4 times, most recently from 4a14fe9 to fec74b7 Compare May 30, 2025 22:27
@crozzy crozzy force-pushed the support-new-rhcc-logic branch 5 times, most recently from 41234fa to f884855 Compare July 10, 2025 18:05
@crozzy
Copy link
Contributor Author

crozzy commented Jul 11, 2025

This should be ready for a once over

@crozzy crozzy marked this pull request as ready for review July 11, 2025 17:55
@crozzy crozzy requested a review from a team as a code owner July 11, 2025 17:56
@crozzy crozzy requested review from hdonnay and removed request for a team July 11, 2025 17:56
Copy link
Member

@hdonnay hdonnay 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 to me for the approach. I think the commit could be split into a few to make it easier to digest.

Comment on lines +52 to +54
if !cpe.Compare(vuln.Repo.CPE, record.Repository.CPE).IsSuperset() && !rhel.IsCPESubstringMatch(record.Repository.CPE, vuln.Repo.CPE) {
return false, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

This smells backwards, but I guess it's not: If this isn't a superset and isn't a Red Hat substring, then it's not relevant. The arguments being swapped also is odd but makes sense after thinking about it.

@crozzy crozzy force-pushed the support-new-rhcc-logic branch 2 times, most recently from 09b9a69 to f8528c4 Compare July 14, 2025 16:16
@crozzy
Copy link
Contributor Author

crozzy commented Jul 14, 2025

This looks good to me for the approach. I think the commit could be split into a few to make it easier to digest.

Now split into 3 commits pertaining to indexing, updating and matching.

@crozzy crozzy force-pushed the support-new-rhcc-logic branch 2 times, most recently from 21d70d2 to 2612655 Compare July 14, 2025 17:28
@crozzy crozzy requested a review from hdonnay July 14, 2025 17:56
@crozzy crozzy force-pushed the support-new-rhcc-logic branch from 2612655 to 8aa9f41 Compare July 15, 2025 15:22
hdonnay
hdonnay previously approved these changes Jul 17, 2025
Copy link
Member

@hdonnay hdonnay left a comment

Choose a reason for hiding this comment

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

Some suggestions, but nothing worth holding this up over.

@crozzy crozzy force-pushed the support-new-rhcc-logic branch from 5fafc0b to 6a4aeb2 Compare July 17, 2025 23:05
@crozzy
Copy link
Contributor Author

crozzy commented Jul 17, 2025

I think there is a race condition in the tests that is triggered when a fixture is pulled from the cache (or reused in testing) https://github.com/quay/claircore/actions/runs/16357519449/job/46219135496

crozzy added 3 commits July 18, 2025 08:13
Red Hat's new container image builder system does not include a
dockerfile at a known path in the image, this is replaces with a file
called labels.json file at a known location that contains the
information that the rhcc package and repository scanners need. This
change adds another rhcc package and repository scanner that read this
labels.json file. The dockerfile versions still exist but will be
eventually deprecated and removed.

Signed-off-by: crozzy <[email protected]>
Previously all OCI advisories in VEX were given the same
rhcc.GoldRepo and the package version information was used to infer
product information. With the addition of a labels.json file and a
timestamp version for containers we need to take into account the
product CPE that the VEX surfaces during the matching process.

Signed-off-by: crozzy <[email protected]>
With the introduction on the labels.json file to identify RH produced
container images Clair needs to start accounting for the CPE surfaced in
the labels.json file and the VEX data. Care is taken here to ensure the
original Dockerfile parsing process still works as expected (although,
dockerfile images will require a re-index to include needed metadata).

Signed-off-by: crozzy <[email protected]>
@crozzy crozzy force-pushed the support-new-rhcc-logic branch from 6a4aeb2 to 7b8950e Compare July 18, 2025 15:14
@crozzy
Copy link
Contributor Author

crozzy commented Jul 18, 2025

I think there is a race condition in the tests that is triggered when a fixture is pulled from the cache (or reused in testing) https://github.com/quay/claircore/actions/runs/16357519449/job/46219135496

I think the issue here was that subtests (from different Test functions but from the same file) had the same name, so the fixture cache path was the same, causing a race condition github.com_quay_claircore/rhel_rhcc/LabelsTest, I modified the name of the subtest but maybe I should also go back and update the GenerateFixture to create a more specific cache path (in a separate PR).

@crozzy crozzy requested a review from hdonnay July 18, 2025 16:03
@crozzy
Copy link
Contributor Author

crozzy commented Jul 18, 2025

/fast-forward

@github-actions github-actions bot merged commit 7b8950e into quay:main Jul 18, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants