Skip to content

Commit

Permalink
Use registry cache only from LastBuid.Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
c0d1ngm0nk3y committed Aug 23, 2021
1 parent 7eb503a commit 4f4f13f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/apis/build/v1alpha2/build_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,9 @@ func (b *Build) BuildPod(images BuildPodImages, secrets []corev1.Secret, taints
if (!b.Spec.NeedVolumeCache() && !b.Spec.NeedRegistryCache()) || config.OS == "windows" {
genericCacheArgs = nil
} else if b.Spec.NeedRegistryCache() {
if b.Spec.LastBuild != nil && b.Spec.LastBuild.Cache.Image != "" {
useCacheFromLastBuild := (b.Spec.LastBuild != nil && b.Spec.LastBuild.Cache.Image != "")
if useCacheFromLastBuild {
genericCacheArgs = []string{fmt.Sprintf("-cache-image=%s", b.Spec.LastBuild.Cache.Image)}
} else {
genericCacheArgs = []string{fmt.Sprintf("-cache-image=%s", b.Spec.Cache.Registry.ImageTag)}
}
exporterCacheArgs = []string{fmt.Sprintf("-cache-image=%s", b.Spec.Cache.Registry.ImageTag)}
} else {
Expand Down
2 changes: 1 addition & 1 deletion samples/image_with_cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ spec:
source:
git:
url: https://github.com/buildpack/sample-java-app.git
revision: master
revision: master

0 comments on commit 4f4f13f

Please sign in to comment.