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

Does not authenticate pull unless the image requires authentication. #414

Merged
merged 7 commits into from
Jun 19, 2018

Conversation

coollog
Copy link
Contributor

@coollog coollog commented Jun 18, 2018

Fixes #376

This improves build speed by ~500ms for default distroless base image.


Authorization registryCredentials =
NonBlockingSteps.get(retrieveBaseRegistryCredentialsStep);
return new Result(pullBaseImage(registryCredentials), registryCredentials);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe pullBaseImage could just return a Result instead of having to wrap the returned image in a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Usually I think that'd be good, though here it would mean just calling the new Result in the returns in pullBaseImage, but pullBaseImage is intended to be a method that just pulls the base image using the credentials, whereas Result is the result of the step as a whole. I'll add a javadoc for this method.

@@ -21,6 +21,8 @@
import com.google.cloud.tools.jib.async.NonBlockingSteps;
import com.google.cloud.tools.jib.blob.Blobs;
import com.google.cloud.tools.jib.builder.BuildConfiguration;
import com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.Result;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this import necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, it is actually necessary for the class to use Result as the template.


private static final String DESCRIPTION = "Pulling base image manifest";

/** Structure for the result returned by this step. */
static class Result {
Copy link
Member

Choose a reason for hiding this comment

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

maybe a more descriptive name?

@coollog coollog merged commit 2640802 into master Jun 19, 2018
@coollog coollog deleted the no-authenticate-pull branch June 19, 2018 20:01
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.

3 participants