Add verification failed reason
This commit is contained in:
parent
440c70d010
commit
40c1851ffc
|
@ -65,4 +65,8 @@ const (
|
||||||
// AuthenticationFailedReason represents the fact that a given secret does not
|
// AuthenticationFailedReason represents the fact that a given secret does not
|
||||||
// have the required fields or the provided credentials do not match.
|
// have the required fields or the provided credentials do not match.
|
||||||
AuthenticationFailedReason string = "AuthenticationFailed"
|
AuthenticationFailedReason string = "AuthenticationFailed"
|
||||||
|
|
||||||
|
// VerificationFailedReason represents the fact that the cryptographic provenance
|
||||||
|
// verification for the source failed.
|
||||||
|
VerificationFailedReason string = "VerificationFailed"
|
||||||
)
|
)
|
||||||
|
|
|
@ -80,7 +80,7 @@ type GitRepositoryVerification struct {
|
||||||
SecretRef corev1.LocalObjectReference `json:"secretRef,omitempty"`
|
SecretRef corev1.LocalObjectReference `json:"secretRef,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitRepositoryStatus defines the observed state of Git repository.
|
// GitRepositoryStatus defines the observed state of a Git repository.
|
||||||
type GitRepositoryStatus struct {
|
type GitRepositoryStatus struct {
|
||||||
// +optional
|
// +optional
|
||||||
Conditions []SourceCondition `json:"conditions,omitempty"`
|
Conditions []SourceCondition `json:"conditions,omitempty"`
|
||||||
|
|
|
@ -87,10 +87,12 @@ spec:
|
||||||
pattern: ^(http|https|ssh)://
|
pattern: ^(http|https|ssh)://
|
||||||
type: string
|
type: string
|
||||||
verify:
|
verify:
|
||||||
description: Verify PGP signature for the commit that HEAD points to.
|
description: Verify OpenPGP signature for the commit that HEAD points
|
||||||
|
to.
|
||||||
properties:
|
properties:
|
||||||
mode:
|
mode:
|
||||||
description: Mode describes what git object should be verified.
|
description: Mode describes what git object should be verified,
|
||||||
|
currently ('head').
|
||||||
enum:
|
enum:
|
||||||
- head
|
- head
|
||||||
type: string
|
type: string
|
||||||
|
@ -111,7 +113,7 @@ spec:
|
||||||
- url
|
- url
|
||||||
type: object
|
type: object
|
||||||
status:
|
status:
|
||||||
description: GitRepositoryStatus defines the observed state of the GitRepository.
|
description: GitRepositoryStatus defines the observed state of a Git repository.
|
||||||
properties:
|
properties:
|
||||||
artifact:
|
artifact:
|
||||||
description: Artifact represents the output of the last successful repository
|
description: Artifact represents the output of the last successful repository
|
||||||
|
|
|
@ -271,7 +271,7 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1.
|
||||||
|
|
||||||
if commit.PGPSignature == "" {
|
if commit.PGPSignature == "" {
|
||||||
err = fmt.Errorf("PGP signature not found for commit '%s'", ref.Hash())
|
err = fmt.Errorf("PGP signature not found for commit '%s'", ref.Hash())
|
||||||
return sourcev1.GitRepositoryNotReady(repository, sourcev1.GitOperationFailedReason, err.Error()), err
|
return sourcev1.GitRepositoryNotReady(repository, sourcev1.VerificationFailedReason, err.Error()), err
|
||||||
}
|
}
|
||||||
|
|
||||||
name := types.NamespacedName{
|
name := types.NamespacedName{
|
||||||
|
@ -283,7 +283,7 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1.
|
||||||
err = r.Client.Get(ctx, name, &secret)
|
err = r.Client.Get(ctx, name, &secret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("PGP public keys secret error: %w", err)
|
err = fmt.Errorf("PGP public keys secret error: %w", err)
|
||||||
return sourcev1.GitRepositoryNotReady(repository, sourcev1.GitOperationFailedReason, err.Error()), err
|
return sourcev1.GitRepositoryNotReady(repository, sourcev1.VerificationFailedReason, err.Error()), err
|
||||||
}
|
}
|
||||||
|
|
||||||
var verified bool
|
var verified bool
|
||||||
|
@ -296,7 +296,7 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1.
|
||||||
|
|
||||||
if !verified {
|
if !verified {
|
||||||
err = fmt.Errorf("PGP signature of '%s' can't be verified", commit.Author)
|
err = fmt.Errorf("PGP signature of '%s' can't be verified", commit.Author)
|
||||||
return sourcev1.GitRepositoryNotReady(repository, sourcev1.GitOperationFailedReason, err.Error()), err
|
return sourcev1.GitRepositoryNotReady(repository, sourcev1.VerificationFailedReason, err.Error()), err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue