(ctx context.Context, conn *grpc.ClientConn, bundle *protobundle.Bundle, workflowRunID string, markVersionAsReleased bool)
| 304 | } |
| 305 | |
| 306 | func pushToControlPlane(ctx context.Context, conn *grpc.ClientConn, bundle *protobundle.Bundle, workflowRunID string, markVersionAsReleased bool) (string, error) { |
| 307 | encodedBundle, err := encodeBundle(bundle) |
| 308 | if err != nil { |
| 309 | return "", fmt.Errorf("encoding attestation: %w", err) |
| 310 | } |
| 311 | |
| 312 | client := pb.NewAttestationServiceClient(conn) |
| 313 | resp, err := client.Store(ctx, &pb.AttestationServiceStoreRequest{ |
| 314 | AttestationBundle: encodedBundle, |
| 315 | WorkflowRunId: workflowRunID, |
| 316 | MarkVersionAsReleased: &markVersionAsReleased, |
| 317 | }) |
| 318 | if err != nil { |
| 319 | return "", fmt.Errorf("storing attestation: %w", err) |
| 320 | } |
| 321 | |
| 322 | return resp.Result.Digest, nil |
| 323 | } |
| 324 | |
| 325 | func encodeBundle(b *protobundle.Bundle) ([]byte, error) { |
| 326 | return protojson.Marshal(b) |
no test coverage detected