Skip to content

Commit b81f027

Browse files
authored
fix(cli): handle inline PEM CA content in artifact download (#3013)
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
1 parent 6981c6e commit b81f027

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

app/cli/cmd/artifact.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2023-2025 The Chainloop Authors.
2+
// Copyright 2023-2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package cmd
1717

1818
import (
1919
"context"
20+
"os"
2021

2122
pb "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1"
2223
"github.com/chainloop-dev/chainloop/pkg/grpcconn"
@@ -54,8 +55,12 @@ func wrappedArtifactConn(cpConn *grpc.ClientConn, role pb.CASCredentialsServiceG
5455
grpcconn.WithInsecure(apiInsecure()),
5556
}
5657

57-
if caFilePath := viper.GetString(confOptions.CASCA.viperKey); caFilePath != "" {
58-
opts = append(opts, grpcconn.WithCAFile(caFilePath))
58+
if caValue := viper.GetString(confOptions.CASCA.viperKey); caValue != "" {
59+
if _, err := os.Stat(caValue); err == nil {
60+
opts = append(opts, grpcconn.WithCAFile(caValue))
61+
} else {
62+
opts = append(opts, grpcconn.WithCAContent(caValue))
63+
}
5964
}
6065

6166
return grpcconn.New(viper.GetString(confOptions.CASAPI.viperKey), resp.Result.Token, opts...)

0 commit comments

Comments
 (0)