Skip to content

Commit

Permalink
update options.jobs in makeRemoteOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhasmitaSw committed Jun 14, 2022
1 parent 3f9fe2a commit 8621a6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 0 additions & 6 deletions pkg/builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/google/go-containerregistry/pkg/logs"
"github.com/google/go-containerregistry/pkg/v1/mutate"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/tarball"

v1 "github.com/google/go-containerregistry/pkg/v1"
Expand Down Expand Up @@ -55,11 +54,6 @@ func Build(options Options, dirs ...string) (string, error) {

StepLogger.Printf("Pushing image %s (insecure=%v)...", options.Target, options.PushInsecure)

remoteOptions := makeRemoteOptions(options.PullConfigDir)
if options.jobs > 0 {
remoteOptions = append(remoteOptions, remote.WithJobs(options.jobs))
}

if err := Push(newImage, options); err != nil {
return "", err
}
Expand Down
9 changes: 6 additions & 3 deletions pkg/builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Pull(options Options) (v1.Image, error) {
return nil, fmt.Errorf("parsing tag %q: %v", options.Base, err)
}

remoteOptions := makeRemoteOptions(options.PullConfigDir)
remoteOptions := makeRemoteOptions(options, options.PullConfigDir)
return remote.Image(ref, remoteOptions...)
}

Expand All @@ -31,7 +31,7 @@ func Push(img v1.Image, options Options) error {
return fmt.Errorf("parsing tag %q: %v", options.Target, err)
}

remoteOptions := makeRemoteOptions(options.PushConfigDir)
remoteOptions := makeRemoteOptions(options, options.PushConfigDir)
remoteOptions = append(remoteOptions, remote.WithJobs(options.jobs))
return remote.Write(tag, img, remoteOptions...)
}
Expand All @@ -43,7 +43,10 @@ func makeNameOptions(insecure bool) (nameOptions []name.Option) {
return
}

func makeRemoteOptions(configDir string) (remoteOptions []remote.Option) {
func makeRemoteOptions(options Options, configDir string) (remoteOptions []remote.Option) {
if options.jobs > 0 {
remoteOptions = append(remoteOptions, remote.WithJobs(options.jobs))
}
if configDir != "" {
keyChain := NewDirKeyChain(configDir)
remoteOptions = append(remoteOptions, remote.WithAuthFromKeychain(keyChain))
Expand Down

0 comments on commit 8621a6c

Please sign in to comment.