Skip to content

Commit

Permalink
Handle nil OCI authenticator with malformed registry
Browse files Browse the repository at this point in the history
Fixes #896

Signed-off-by: Adrien Fillon <adrien.fillon@manomano.com>
  • Loading branch information
adrien-f committed Sep 13, 2022
1 parent 9e853a9 commit 9a0e5bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion controllers/ocirepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,14 @@ func oidcAuth(ctx context.Context, url, provider string) (authn.Authenticator, e
opts.GcpAutoLogin = true
}

return login.NewManager().Login(ctx, u, ref, opts)
authenticator, err := login.NewManager().Login(ctx, u, ref, opts)
if err != nil {
return nil, err
} else if authenticator == nil {
return nil, fmt.Errorf("could not authenticate to OCI provider %s with URL %s", provider, url)
}

return authenticator, nil
}

// craneOptions sets the auth headers, timeout and user agent
Expand Down

0 comments on commit 9a0e5bb

Please sign in to comment.