MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / wrappedArtifactConn

Function wrappedArtifactConn

app/cli/cmd/artifact.go:39–72  ·  view source on GitHub ↗
(cpConn *grpc.ClientConn, role pb.CASCredentialsServiceGetRequest_Role, digest string)

Source from the content-addressed store, hash-verified

37}
38
39func wrappedArtifactConn(cpConn *grpc.ClientConn, role pb.CASCredentialsServiceGetRequest_Role, digest string) (*grpc.ClientConn, error) {
40 // Retrieve temporary credentials for uploading
41 client := pb.NewCASCredentialsServiceClient(cpConn)
42 resp, err := client.Get(context.Background(), &pb.CASCredentialsServiceGetRequest{
43 Role: role,
44 Digest: digest,
45 })
46 if err != nil {
47 return nil, err
48 }
49
50 if apiInsecure() {
51 logger.Warn().Msg("API contacted in insecure mode")
52 }
53
54 var opts = []grpcconn.Option{
55 grpcconn.WithInsecure(apiInsecure()),
56 grpcconn.WithCLIVersion(fullVersion()),
57 }
58
59 if maxRecv := apiMaxRecvMsgSize(); maxRecv > 0 {
60 opts = append(opts, grpcconn.WithMaxRecvMsgSize(maxRecv))
61 }
62
63 if caValue := viper.GetString(confOptions.CASCA.viperKey); caValue != "" {
64 if _, err := os.Stat(caValue); err == nil {
65 opts = append(opts, grpcconn.WithCAFile(caValue))
66 } else {
67 opts = append(opts, grpcconn.WithCAContent(caValue))
68 }
69 }
70
71 return grpcconn.New(viper.GetString(confOptions.CASAPI.viperKey), resp.Result.Token, opts...)
72}

Callers 2

newArtifactDownloadCmdFunction · 0.85
newArtifactUploadCmdFunction · 0.85

Calls 10

GetMethod · 0.95
WithInsecureFunction · 0.92
WithCLIVersionFunction · 0.92
WithMaxRecvMsgSizeFunction · 0.92
WithCAFileFunction · 0.92
WithCAContentFunction · 0.92
NewFunction · 0.92
apiInsecureFunction · 0.85
fullVersionFunction · 0.85
apiMaxRecvMsgSizeFunction · 0.85

Tested by

no test coverage detected