refactor: cleanup GetArtifactRegistryCredentials error handling
Update fluxcd/pkg/auth to v0.18.0 and simplify error handling for GetArtifactRegistryCredentials() following the improvements made in the library. Similar to fluxcd/image-reflector-controller#786, this removes unnecessary nil checks as the function now returns errors directly for unsupported providers. - Replace authentication code in push_artifact.go with loginWithProvider() - Remove unnecessary authenticator nil check in oci.go - Remove unused imports (errors, auth packages) Signed-off-by: cappyzawa <cappyzawa@gmail.com>
This commit is contained in:
@@ -18,7 +18,6 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/go-containerregistry/pkg/crane"
|
||||
@@ -38,8 +37,5 @@ func loginWithProvider(ctx context.Context, url, provider string) (crane.Option,
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not login to provider %s with url %s: %w", provider, url, err)
|
||||
}
|
||||
if authenticator == nil {
|
||||
return nil, errors.New("unsupported provider")
|
||||
}
|
||||
return crane.WithAuth(authenticator), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user