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

Method AddRawEvidence

extras/dagger/main.go:422–483  ·  view source on GitHub ↗

Add a raw string piece of evidence to the attestation

(
	ctx context.Context,
	// Evidence name. Don't pass a name if the material
	// being attested is not part of the contract
	//  Example: "my-blob"
	// +optional
	name string,
	// The contents of the blob
	value string,
	// the material type of the evidence https://docs.chainloop.dev/concepts/material-types#material-types
	// if not provided it will either be loaded from the contract or inferred automatically
	// +optional
	kind string,
	// List of annotations to be attached to the evidence for example:
	// "key1=value1,key2=value2"
	// +optional
	annotations []string,
	// Skip strict schema validation for structured materials (SBOM_CYCLONEDX_JSON, OPENAPI_SPEC, ASYNCAPI_SPEC, OSSF_SCORECARD_JSON)
	// +optional
	noStrictValidation bool,
	// Enable debug logging
	// +optional
	debugMode bool,
)

Source from the content-addressed store, hash-verified

420
421// Add a raw string piece of evidence to the attestation
422func (att *Attestation) AddRawEvidence(
423 ctx context.Context,
424 // Evidence name. Don't pass a name if the material
425 // being attested is not part of the contract
426 // Example: "my-blob"
427 // +optional
428 name string,
429 // The contents of the blob
430 value string,
431 // the material type of the evidence https://docs.chainloop.dev/concepts/material-types#material-types
432 // if not provided it will either be loaded from the contract or inferred automatically
433 // +optional
434 kind string,
435 // List of annotations to be attached to the evidence for example:
436 // "key1=value1,key2=value2"
437 // +optional
438 annotations []string,
439 // Skip strict schema validation for structured materials (SBOM_CYCLONEDX_JSON, OPENAPI_SPEC, ASYNCAPI_SPEC, OSSF_SCORECARD_JSON)
440 // +optional
441 noStrictValidation bool,
442 // Enable debug logging
443 // +optional
444 debugMode bool,
445) (*Attestation, error) {
446 args := []string{
447 "attestation", "add",
448 "--attestation-id", att.AttestationID,
449 "--value", value,
450 }
451
452 if name != "" {
453 args = append(args,
454 "--name", name,
455 )
456 }
457
458 if kind != "" {
459 args = append(args,
460 "--kind", kind,
461 )
462 }
463
464 for _, annotation := range annotations {
465 args = append(args,
466 "--annotation", annotation,
467 )
468 }
469
470 if noStrictValidation {
471 args = append(args, "--no-strict-validation")
472 }
473
474 if debugMode {
475 args = append(args, "--debug")
476 }
477
478 _, err := att.
479 Container(0).

Callers

nothing calls this directly

Calls 1

ContainerMethod · 0.95

Tested by

no test coverage detected