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

Function ApplyContractFromRawData

app/cli/pkg/action/apply.go:117–128  ·  view source on GitHub ↗

ApplyContractFromRawData applies a single contract document using the gRPC client.

(ctx context.Context, conn *grpc.ClientConn, rawData []byte)

Source from the content-addressed store, hash-verified

115
116// ApplyContractFromRawData applies a single contract document using the gRPC client.
117func ApplyContractFromRawData(ctx context.Context, conn *grpc.ClientConn, rawData []byte) (bool, error) {
118 client := pb.NewWorkflowContractServiceClient(conn)
119
120 resp, err := client.Apply(ctx, &pb.WorkflowContractServiceApplyRequest{
121 RawSchema: rawData,
122 })
123 if err != nil {
124 return false, fmt.Errorf("failed to apply contract: %w", err)
125 }
126
127 return resp.GetChanged(), nil
128}
129
130// CollectYAMLFiles returns YAML file paths from the given path.
131// If path is a file, it returns that file. If a directory, it walks recursively.

Callers 1

RunMethod · 0.85

Calls 2

ApplyMethod · 0.95
GetChangedMethod · 0.80

Tested by

no test coverage detected