Skip to content

Commit 0264f95

Browse files
authored
feat: do not fail on cas backend (#275)
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
1 parent ac35f0a commit 0264f95

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/controlplane/internal/service/cascredential.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,19 @@ func (s *CASCredentialsService) Get(ctx context.Context, req *pb.CASCredentialsS
5858
}
5959

6060
// Get repository to provide the secret name
61-
repo, err := s.ociUC.FindDefaultBackend(ctx, currentOrg.ID)
61+
backend, err := s.ociUC.FindDefaultBackend(ctx, currentOrg.ID)
6262
if err != nil && !biz.IsNotFound(err) {
6363
return nil, sl.LogAndMaskErr(err, s.log)
64-
} else if repo == nil {
64+
} else if backend == nil {
6565
return nil, errors.NotFound("not found", "main repository not found")
6666
}
6767

68-
t, err := s.casUC.GenerateTemporaryCredentials(repo.SecretName, role)
68+
// If we want to upload an artifact but we have selected an inline backend we fail
69+
if backend.Provider == biz.CASBackendInline {
70+
return nil, errors.BadRequest("invalid argument", "cannot upload or download artifacts from an inline CAS backend")
71+
}
72+
73+
t, err := s.casUC.GenerateTemporaryCredentials(backend.SecretName, role)
6974
if err != nil {
7075
return nil, sl.LogAndMaskErr(err, s.log)
7176
}

0 commit comments

Comments
 (0)