jib
jib copied to clipboard
Support pulling OCI Image Index manifests
Resolves #2749
Implementation follows https://github.com/GoogleContainerTools/jib/issues/3700#issuecomment-1171283502
- Add Accept header application/vnd.oci.image.index.v1+json during base image pull
- Re-use the logic from V22ManifestListTemplate to select the target platform diget via a new interface ManifestListTemplate
Before filing a pull request, make sure to do the following:
- [x] Create a new issue at https://github.com/GoogleContainerTools/jib/issues/new/choose.
- [x] Ensure that your implementation plan is approved by the team.
- [x] Verify that integration tests and unit tests are passing after the change.
- [x] Address all checkstyle issues. Refer to the style guide.
This helps to reduce the chance of having a pull request rejected.
@rquinio Thank you; we'll review next week.
No worries. Hopefully I've fixed the formatting issue.
Done ! I also took the opportunity to fix missing coverage in PullBaseImageStep for manifest lists pulling and case where the target architecture is not in the list.
Test failure:
> Task :jib-core:test
com.google.cloud.tools.jib.builder.steps.PullBaseImageStepTest > testCall_allMirrorsFail FAILED
java.lang.NullPointerException
at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.pullBaseImages(PullBaseImageStep.java:296)
at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call(PullBaseImageStep.java:159)
at com.google.cloud.tools.jib.builder.steps.PullBaseImageStepTest.testCall_allMirrorsFail(PullBaseImageStepTest.java:571)
com.google.cloud.tools.jib.builder.steps.PullBaseImageStepTest STANDARD_OUT
[MockitoHint] PullBaseImageStepTest.testCall_allMirrorsFail (see javadoc for MockitoHint):
[MockitoHint] 1. Unused... -> at com.google.cloud.tools.jib.builder.steps.PullBaseImageStepTest.setUpWorkingRegistryClientFactoryWithV22ManifestList(PullBaseImageStepTest.java:672)
[MockitoHint] ...args ok? -> at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.pullBaseImages(PullBaseImageStep.java:294)
Should be fixed, testCall_allMirrorsFail was wrongly using the client factory with new V22ManifestList mocks, instead of the old V22ManifestTeplate mock.
@rquinio Thank you! I'm afraid we need a bit more testing to pass the 80% coverage gate. OciIndexTemplate.ManifestDescriptorTemplate
is likely an easy candidate. Can you see the Sonar report that's linked in "Details" under the Github Action checks?
@elefeint I've added a test for POJO -> JSON serialization. I had a look at the code duplication, but I wouldn't risk factorizing the JSON objects between docker and OCI manifests as they have different fields, and I'm not sure of the details of each spec.