Skip to content

Commit

Permalink
Merge pull request #270 from depot/fix-auth
Browse files Browse the repository at this point in the history
Fix auth ServerAddress for containerd content store
  • Loading branch information
jacobwgillespie authored Apr 12, 2024
2 parents 6b365f6 + 3e90b6e commit b4312ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
24 changes: 14 additions & 10 deletions pkg/cmd/pull/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ func buildPullOpt(msg *cliv1.GetPullInfoResponse, userTags []string, platform, p
tags = msg.Options[0].Tags
}

serverAddress := "registry.depot.dev"
opts := load.PullOptions{
UserTags: tags,
Quiet: progress == prog.PrinterModeQuiet,
KeepImage: true,
Username: &msg.Username,
Password: &msg.Password,
UserTags: tags,
Quiet: progress == prog.PrinterModeQuiet,
KeepImage: true,
Username: &msg.Username,
Password: &msg.Password,
ServerAddress: &serverAddress,
}
if platform != "" {
opts.Platform = &platform
Expand Down Expand Up @@ -97,12 +99,14 @@ func bakePullOpts(msg *cliv1.GetPullInfoResponse, targets, userTags []string, pl
}
}

serverAddress := "registry.depot.dev"
opts := load.PullOptions{
UserTags: tags,
Quiet: progress == prog.PrinterModeQuiet,
KeepImage: true,
Username: &msg.Username,
Password: &msg.Password,
UserTags: tags,
Quiet: progress == prog.PrinterModeQuiet,
KeepImage: true,
Username: &msg.Username,
Password: &msg.Password,
ServerAddress: &serverAddress,
}
if platform != "" {
opts.Platform = &platform
Expand Down
13 changes: 7 additions & 6 deletions pkg/load/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ type DepotLoadOptions struct {

// Options to download from the Depot hosted registry and tag the image with the user provide tag.
type PullOptions struct {
UserTags []string // Tags the user wishes the image to have.
Quiet bool // No logs plz
Username *string // If set, use this username for the registry.
Password *string // If set, use this password for the registry.
Platform *string // If set, only pull the image if it matches the platform.
KeepImage bool // If set, do not remove the image after pulling and tagging with user tags.
UserTags []string // Tags the user wishes the image to have.
Quiet bool // No logs plz
Username *string // If set, use this username for the registry.
Password *string // If set, use this password for the registry.
ServerAddress *string // If set, use this server address for the registry.
Platform *string // If set, only pull the image if it matches the platform.
KeepImage bool // If set, do not remove the image after pulling and tagging with user tags.
}

// WithDepotImagePull updates buildOpts to push to the depot user's personal registry.
Expand Down
3 changes: 3 additions & 0 deletions pkg/load/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func ImagePullPrivileged(ctx context.Context, dockerapi docker.APIClient, imageN
Username: *opts.Username,
Password: *opts.Password,
}
if opts.ServerAddress != nil {
authConfig.ServerAddress = *opts.ServerAddress
}
buf, err := json.Marshal(authConfig)
if err != nil {
return err
Expand Down

0 comments on commit b4312ee

Please sign in to comment.