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

Fix V22ManifestListTemplate cast when pulling an oci index manifest #3974

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

rquinio
Copy link
Contributor

@rquinio rquinio commented Mar 30, 2023

Fixes #3958

Since there's no more downcast in PullBaseImageStep of manifest lists actual implementation, use the parent class in the unit tests.
Also update jib-core gradle example to compile with 0.23.0.

I was able to reproduce via a gradle build using jib-core (from: gcr.io/distroless/java17-debian11:nonroot@sha256:5154596f58d81687d66c8302face284198caf65033cde6bf6667c488b21745e6) and verify the fix works. Though I'm not sure why the issue wasn't caught by the new integration test cases added in #3965 ?

Before filing a pull request, make sure to do the following:

This helps to reduce the chance of having a pull request rejected.

Copy link
Contributor

@emmileaf emmileaf left a comment

Choose a reason for hiding this comment

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

Just one small typo typo fix, otherwise LGTM. Thank you for the contribution!

On your note about integration tests, I think the ones added in #3965 didn't catch this issue because it is in the caching logic and will not be reached (and fail) on the first time pulling. It would be nice to have additional coverage in the integration tests for this (perhaps by having a test using OciIndexTemplate that pulls twice and forces cache with Djib.alwaysCacheBaseImage=true?), but not a blocker for merging this fix.

@rquinio
Copy link
Contributor Author

rquinio commented Apr 3, 2023

Regarding the integration test I've realized ManifestPullerIntegrationTest only tests the RegistryClient, not the actual Jib build steps.
I think it's missing a case in JibIntegrationTest that would pull an oci index.
Today it's targeting only docker.io busybox image which is a V22 Manifest list.
I'll have a look later in the week.

Since there's no more downcast in PullBaseImageStep of manifest lists actual implementation, use the parent class in the unit tests.

Add an integration-test case of building a multi-platform image from a base oci index manifest.

Also update jib-core gradle example to compile with 0.23.0.
@rquinio
Copy link
Contributor Author

rquinio commented Apr 10, 2023

I've added a test case to JibIntegrationTest, which was failing before the fix.

@sonarcloud
Copy link

sonarcloud bot commented Apr 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@emmileaf
Copy link
Contributor

Awesome, thank you @rquinio for the fix and improvement to test coverage!

@emmileaf emmileaf merged commit 9f2d0ba into GoogleContainerTools:master Apr 11, 2023
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.

buildTar fails with latest Google distroless Java 17 images
3 participants