Skip to content

Commit 37c151f

Browse files
committed
add comments
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
1 parent f6b0ff0 commit 37c151f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/controlplane/internal/service/attestation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ func (s *AttestationService) storeAttestation(ctx context.Context, envelope []by
289289

290290
// If we have an external CAS backend, we will push there the attestation
291291
if !casBackend.Inline {
292+
// Check the validation status of the backend. The backend might be different from the one configured as default
292293
if casBackend.ValidationStatus != biz.CASBackendValidationOK {
293294
// Try to re-validate the backend; if it still fails, return an error
294295
if err = s.casUC.PerformValidation(ctx, casBackend.ID.String()); err != nil {
@@ -450,10 +451,10 @@ func (s *AttestationService) GetUploadCreds(ctx context.Context, req *cpAPI.Atte
450451

451452
backend := wRun.CASBackends[0]
452453

453-
// Check the status of the backend
454+
// Check the validation status of the backend. The backend might be different from the one configured as default
454455
if backend.ValidationStatus != biz.CASBackendValidationOK {
455456
// Try to re-validate the backend; if it still fails, return an error
456-
// Assume PerformValidation updated the backend status; continue if validation succeeded
457+
// Ccontinue if validation succeeded
457458
if err = s.casUC.PerformValidation(ctx, backend.ID.String()); err != nil {
458459
return nil, cpAPI.ErrorCasBackendErrorReasonInvalid("your CAS backend can't be reached")
459460
}

0 commit comments

Comments
 (0)