Skip to content

Commit

Permalink
Change CachePullDestinationLookupReferenceFunc to take a types.ImageR…
Browse files Browse the repository at this point in the history
…eference arg

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
  • Loading branch information
aaronlehmann committed May 24, 2024
1 parent ef82d06 commit 7d61a74
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion define/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ type BuildOptions struct {
// CachePullDestinationLookupReferenceFunc is an optional generator
// function which provides a LookupReferenceFunc used to look up
// destination references for cache pulls.
CachePullDestinationLookupReferenceFunc func(imageName string) libimage.LookupReferenceFunc
CachePullDestinationLookupReferenceFunc func(srcRef types.ImageReference) libimage.LookupReferenceFunc
// CachePushSourceLookupReferenceFunc is an optional generator function
// which provides a LookupReferenceFunc used to look up source
// references for cache pushes.
Expand Down
2 changes: 1 addition & 1 deletion imagebuildah/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type Executor struct {
maxPullPushRetries int
retryPullPushDelay time.Duration
cachePullSourceLookupReferenceFunc libimage.LookupReferenceFunc
cachePullDestinationLookupReferenceFunc func(imageName string) libimage.LookupReferenceFunc
cachePullDestinationLookupReferenceFunc func(srcRef types.ImageReference) libimage.LookupReferenceFunc
cachePushSourceLookupReferenceFunc func(dest types.ImageReference) libimage.LookupReferenceFunc
cachePushDestinationLookupReferenceFunc libimage.LookupReferenceFunc
ociDecryptConfig *encconfig.DecryptConfig
Expand Down
5 changes: 2 additions & 3 deletions imagebuildah/stage_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,6 @@ func (s *StageExecutor) pullCache(ctx context.Context, cacheKey string) (referen
for _, src := range srcList {
srcDockerRef := src.DockerReference()
logrus.Debugf("trying to pull cache from remote repo: %+v", srcDockerRef)
imageName := srcDockerRef.String()
options := buildah.PullOptions{
SignaturePolicyPath: s.executor.signaturePolicyPath,
Store: s.executor.store,
Expand All @@ -2037,10 +2036,10 @@ func (s *StageExecutor) pullCache(ctx context.Context, cacheKey string) (referen
options.SourceLookupReferenceFunc = s.executor.cachePullSourceLookupReferenceFunc
}
if s.executor.cachePullDestinationLookupReferenceFunc != nil {
options.DestinationLookupReferenceFunc = s.executor.cachePullDestinationLookupReferenceFunc(imageName)
options.DestinationLookupReferenceFunc = s.executor.cachePullDestinationLookupReferenceFunc(src)
}

id, err := buildah.Pull(ctx, imageName, options)
id, err := buildah.Pull(ctx, srcDockerRef.String(), options)
if err != nil {
logrus.Debugf("failed pulling cache from source %s: %v", src, err)
continue // failed pulling this one try next
Expand Down

0 comments on commit 7d61a74

Please sign in to comment.