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

Check configured platforms for single image building #2793

Merged
merged 6 commits into from
Oct 5, 2020

Conversation

chanseokoh
Copy link
Member

@chanseokoh chanseokoh commented Sep 30, 2020

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.

  1. Multiple platforms are configured.
  2. The configured platform doesn't match the actual platform, unless the "configured" platform is amd64/linux.

About 2): Currently we cannot distinguish between explicitly configured amd64/linux and the implicit amd64/linux default when omitted, so unfortunately sometimes we need to suppress logging even if the platforms don't match.

@@ -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);
Copy link
Member Author

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;
Copy link
Member Author

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;
Copy link
Member Author

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);
Copy link
Member Author

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);
Copy link
Member Author

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.

@chanseokoh chanseokoh marked this pull request as ready for review October 1, 2020 16:19
@chanseokoh
Copy link
Member Author

Ready for review.

Copy link
Contributor

@mpeddada1 mpeddada1 left a 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.

@chanseokoh chanseokoh merged commit 7d29959 into master Oct 5, 2020
@chanseokoh chanseokoh deleted the i2746-check-single-image-platform branch October 5, 2020 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants