-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Check configured platforms for single image building #2793
Conversation
@@ -111,6 +111,8 @@ static boolean isGzipped(Path path) throws IOException { | |||
Optional<LocalImage> cachedImage = | |||
getCachedDockerImage(buildContext.getBaseImageLayersCache(), dockerImageDetails); | |||
if (cachedImage.isPresent()) { | |||
PlatformChecker.checkManifestPlatform( | |||
buildContext, cachedImage.get().configurationTemplate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is when a local docker://
base image is cached.
progressEventDispatcher.newChildProducer(), | ||
tempDirectoryProvider); | ||
PlatformChecker.checkManifestPlatform(buildContext, localImage.configurationTemplate); | ||
return localImage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using a local docker://
image that has not been cached.
cacheDockerImageTar( | ||
buildContext, tarPath, progressEventDispatcherFactory, tempDirectoryProvider); | ||
PlatformChecker.checkManifestPlatform(buildContext, localImage.configurationTemplate); | ||
return localImage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When tar://
(covers both cached and fresh cases).
@@ -233,6 +233,7 @@ public ImagesAndRegistryClient call() | |||
BuildableManifestTemplate imageManifest = (BuildableManifestTemplate) manifestTemplate; | |||
ContainerConfigurationTemplate containerConfig = | |||
pullContainerConfigJson(manifestAndDigest, registryClient, progressEventDispatcher); | |||
PlatformChecker.checkManifestPlatform(buildContext, containerConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When pulling a remote manifest (not cached).
|
||
ContainerConfigurationTemplate containerConfig = | ||
Verify.verifyNotNull(manifestsAndConfigs.get(0).getConfig()); | ||
PlatformChecker.checkManifestPlatform(buildContext, containerConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using a cached manifest for a remote base image.
Ready for review. |
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PlatformChecker.java
Show resolved
Hide resolved
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PlatformChecker.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Fixes #2746. Fixes #2745.
When the base image is not a manifest list (including a local Docker and tar image), logs a warning in the follow cases.
amd64/linux
.About 2): Currently we cannot distinguish between explicitly configured
amd64/linux
and the implicitamd64/linux
default when omitted, so unfortunately sometimes we need to suppress logging even if the platforms don't match.