-
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
Skip downloading base image layers if they exists in target repository #1840
Merged
Merged
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
17f77fc
wip
chanseokoh 3a7c93e
Merge branch 'master' into async-restructure
chanseokoh 705dc67
wip
chanseokoh 449744d
wip
chanseokoh 71567be
wip
chanseokoh 7d436eb
wip
chanseokoh 03525c9
Merge remote-tracking branch 'origin/master' into async-restructure
chanseokoh cdee3f6
wip
chanseokoh 25a47f5
wip
chanseokoh bcf23dc
Merge remote-tracking branch 'origin/master' into async-restructure
chanseokoh 3e96f0c
Merge remote-tracking branch 'origin/master' into async-restructure
chanseokoh 936c7bf
wip
chanseokoh 507b9d7
Unwrap nested execution exception
chanseokoh 74020ef
Refactor PushImageStep
chanseokoh 398f50f
Remove PullAndCacheBaseImageLayersStep
chanseokoh a1bf0c2
variable renaming and minor changes
chanseokoh 5c71c1d
Duplicate small section of code
chanseokoh 2853f53
Unroll nested ExecutionException
chanseokoh 2714a51
Merge branch 'async-restructure' into async-restructure-followup
chanseokoh 2a617f2
Make applicationLayers @Nullable
chanseokoh c693774
Merge branch 'async-restructure' into async-restructure-followup
chanseokoh 0f6bc13
Cleanup
chanseokoh 2bb59d8
Remove incorrect @VisibleForTesting
chanseokoh b966f5e
Merge branch 'async-restructure' into async-restructure-followup
chanseokoh 6ee9ef0
Refactor code
chanseokoh 2555cca
Merge branch 'master' into async-restructure-followup
chanseokoh 1575676
Delete files
chanseokoh b1c3722
Revert renaming
chanseokoh a758b43
Merge branch 'master' into async-restructure-followup
chanseokoh 5db4125
Fix Nullaway
chanseokoh 543c9c5
Merge branch 'master' into i1673-skip-download-base-layers
chanseokoh 2889b04
Prototyping (inefficient)
chanseokoh e8a5506
wip
chanseokoh ea165f8
Minor fixes
chanseokoh b707c43
Merge branch 'minor-fixes' into i1673-skip-download-base-layers
chanseokoh 498d2b5
Merge branch 'master' into async-restructure-followup
chanseokoh 2e99761
Merge branch 'async-restructure-followup' into i1673-skip-download-ba…
chanseokoh f78954a
wip
chanseokoh 6451d02
Merge branch 'master' into i1673-skip-download-base-layers
chanseokoh b723d54
Introduce PreparedLayer
chanseokoh ff71701
Merge remote-tracking branch 'origin/master' into i1673-skip-download…
chanseokoh e0e75e0
Refactor code
chanseokoh ed70606
wip
chanseokoh 86d7d3f
Clean up code
chanseokoh 68d0b82
Revert
chanseokoh 9b51f30
Add new system property
chanseokoh 934e019
Update Javadoc
chanseokoh 455a201
Merge branch 'master' into i1673-skip-download-base-layers
chanseokoh 36c441a
Add PushBlobStepTest
chanseokoh 1a2020e
Add PullAndCacheBaseImageLayerStepTest
chanseokoh e0b21e8
Clean up
chanseokoh d5c5cb8
Add integration test
chanseokoh 14ef045
doBlobCheck --> forcePush and flip values
chanseokoh d41c761
renmaing and comments only
chanseokoh 2661495
Rename to ObtainBaseImageLayerStep
chanseokoh 004b3bb
jib.forceDownload --> jib.cacheBaseImage (property renamed)
chanseokoh 4c2a70e
Update error message
chanseokoh 707d920
Rename variable
chanseokoh 05973e2
Remove stray comment
chanseokoh 9914261
Rename method and variables
chanseokoh 4d35db6
Address review comments
chanseokoh 5fd7baa
Go back to Boolean jib.alwaysCacheBaseImage
chanseokoh 4f9e459
Use openjdk8 on Travis instead of oraclejdk8
chanseokoh 21d734e
Ubuntu Trusty
chanseokoh ded043a
comments
chanseokoh a9f5a98
Merge remote-tracking branch 'origin/travis-openjdk8' into i1673-skip…
chanseokoh fdc576c
Merge branch 'master' into i1673-skip-download-base-layers
chanseokoh b0fe3cf
Rename variable
chanseokoh 3f1b512
Merge remote-tracking branch 'origin/master' into i1673-skip-download…
chanseokoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/CachedLayerAndName.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PreparedLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright 2019 Google LLC. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.cloud.tools.jib.builder.steps; | ||
|
||
import com.google.cloud.tools.jib.api.DescriptorDigest; | ||
import com.google.cloud.tools.jib.blob.Blob; | ||
import com.google.cloud.tools.jib.blob.BlobDescriptor; | ||
import com.google.cloud.tools.jib.image.Layer; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Layer prepared from {@link BuildAndCacheApplicationLayerStep} and {@link | ||
* ObtainBaseImageLayerStep} to hold information about either a base image layer or an application | ||
* layer. | ||
*/ | ||
class PreparedLayer implements Layer { | ||
|
||
static class Builder { | ||
|
||
private Layer layer; | ||
private String name = "unnamed layer"; | ||
private Optional<Boolean> stateInTarget = Optional.empty(); | ||
|
||
Builder(Layer layer) { | ||
this.layer = layer; | ||
} | ||
|
||
Builder setName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
/** Sets whether the layer exists in a target destination. Empty (absence) means unknown. */ | ||
Builder setStateInTarget(Optional<Boolean> stateInTarget) { | ||
this.stateInTarget = stateInTarget; | ||
return this; | ||
} | ||
|
||
PreparedLayer build() { | ||
return new PreparedLayer(layer, name, stateInTarget); | ||
} | ||
} | ||
|
||
private final Layer layer; | ||
private final String name; | ||
private final Optional<Boolean> stateInTarget; | ||
|
||
private PreparedLayer(Layer layer, String name, Optional<Boolean> stateInTarget) { | ||
this.layer = layer; | ||
this.name = name; | ||
this.stateInTarget = stateInTarget; | ||
} | ||
|
||
String getName() { | ||
return name; | ||
} | ||
|
||
Optional<Boolean> existsInTarget() { | ||
return stateInTarget; | ||
} | ||
|
||
@Override | ||
public Blob getBlob() { | ||
return layer.getBlob(); | ||
} | ||
|
||
@Override | ||
public BlobDescriptor getBlobDescriptor() { | ||
return layer.getBlobDescriptor(); | ||
} | ||
|
||
@Override | ||
public DescriptorDigest getDiffId() { | ||
return layer.getDiffId(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I wonder if this is as easy as adding
buildConfiguration.getBaseImageRegistry().equals(buildConfiguration.getTargetImageRegistry())
on in the existing-checker below?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.
I thought it involves more than that, like checking
to ensure that we will attempt the blob mount. And I think it is that we can attempt blob mount, and it might be possible that a server may not allow/support the mount by returning
202 Accepted
instead of201 Created
, in which caseRegistryClient.pushBlob()
will fall back to do the usual pushing. So I think this is actually complicated.But I think we are already pretty good without blob mount. Most of the time, the base image will be in the target repository. The blob mount can be a further optimization, but I think it does not give a huge value.