addressing review comments

Signed-off-by: Soule BA <soule@weave.works>
This commit is contained in:
Soule BA 2022-10-19 01:30:47 +02:00
parent 5355fb3142
commit 25673ac512
No known key found for this signature in database
GPG Key ID: 4D40965192802994
4 changed files with 10 additions and 7 deletions

View File

@ -214,6 +214,7 @@ func (r *HelmChartReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
summarizeHelper := summarize.NewHelper(r.EventRecorder, patchHelper)
summarizeOpts := []summarize.Option{
summarize.WithConditions(helmChartReadyCondition),
summarize.WithBiPolarityConditionTypes(sourcev1.SourceVerifiedCondition),
summarize.WithReconcileResult(recResult),
summarize.WithReconcileError(retErr),
summarize.WithIgnoreNotFound(),
@ -648,7 +649,7 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
ValuesFiles: obj.GetValuesFiles(),
Force: obj.Generation != obj.Status.ObservedGeneration,
// The remote builder will not attempt to download the chart if
// an artifact exist with the same name and version and the force is false.
// an artifact exists with the same name and version and `Force` is false.
// It will try to verify the chart if:
// - we are on the first reconciliation
// - the HelmChart spec has changed (generation drift)

View File

@ -95,7 +95,7 @@ func KeychainAdaptHelper(keyChain authn.Keychain) func(string) (registry.LoginOp
if err != nil {
return nil, fmt.Errorf("unable to parse registry URL '%s'", registryURL)
}
authenticator, err := keyChain.Resolve(resource{parsedURL.Host})
authenticator, err := keyChain.Resolve(stringResource{parsedURL.Host})
if err != nil {
return nil, fmt.Errorf("unable to resolve credentials for registry '%s': %w", registryURL, err)
}
@ -126,14 +126,16 @@ func AuthAdaptHelper(auth authn.Authenticator) (registry.LoginOption, error) {
return registry.LoginOptBasicAuth(username, password), nil
}
type resource struct {
// stringResource is there to satisfy the github.com/google/go-containerregistry/pkg/authn.Resource interface.
// It merely wraps a given string and returns it for all of the interface's methods.
type stringResource struct {
registry string
}
func (r resource) String() string {
func (r stringResource) String() string {
return r.registry
}
func (r resource) RegistryStr() string {
func (r stringResource) RegistryStr() string {
return r.registry
}

View File

@ -528,5 +528,5 @@ func (r *ChartRepository) RemoveCache() error {
func (r *ChartRepository) VerifyChart(_ context.Context, _ *repo.ChartVersion) error {
// no-op
// this is a no-op because this is not implemented yet.
return nil
return fmt.Errorf("not implemented")
}

View File

@ -45,7 +45,7 @@ type options struct {
ROpt []remote.Option
}
// Options is a function that configures the options applied to a CosignVerifier.
// Options is a function that configures the options applied to a Verifier.
type Options func(opts *options)
// WithPublicKey sets the public key.