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

Method Push

extras/dagger/main.go:739–781  ·  view source on GitHub ↗

Generate, sign and push the attestation to the chainloop control plane

(
	ctx context.Context,
	// The private key to sign the attestation
	// +optional
	key *dagger.Secret,
	// The passphrase to decrypt the private key
	// +optional
	passphrase *dagger.Secret,
	// Whether not fail if the policy check fails
	// +optional
	exceptionBypassPolicyCheck *bool,
	// Output format
	// +default="table"
	format OutputFormat,
	// List of annotations to be attached to the attestation for example:
	// "key1=value1,key2=value2"
	// +optional
	annotations []string,
)

Source from the content-addressed store, hash-verified

737
738// Generate, sign and push the attestation to the chainloop control plane
739func (att *Attestation) Push(
740 ctx context.Context,
741 // The private key to sign the attestation
742 // +optional
743 key *dagger.Secret,
744 // The passphrase to decrypt the private key
745 // +optional
746 passphrase *dagger.Secret,
747 // Whether not fail if the policy check fails
748 // +optional
749 exceptionBypassPolicyCheck *bool,
750 // Output format
751 // +default="table"
752 format OutputFormat,
753 // List of annotations to be attached to the attestation for example:
754 // "key1=value1,key2=value2"
755 // +optional
756 annotations []string,
757) (string, error) {
758 container := att.Container(0)
759 args := []string{
760 "attestation", "push",
761 "--attestation-id", att.AttestationID,
762 "--output", string(format),
763 }
764
765 for _, annotation := range annotations {
766 args = append(args, "--annotation", annotation)
767 }
768
769 if key != nil {
770 container = container.WithMountedSecret("/tmp/key.pem", key)
771 args = append(args, "--key", "/tmp/key.pem")
772 }
773 if passphrase != nil {
774 container = container.WithSecretVariable("CHAINLOOP_SIGNING_PASSWORD", passphrase)
775 }
776 if exceptionBypassPolicyCheck != nil && *exceptionBypassPolicyCheck {
777 args = append(args, "--exception-bypass-policy-check")
778 }
779
780 return container.WithExec(args, execOpts).Stdout(ctx)
781}
782
783// Mark the attestation as failed
784func (att *Attestation) MarkFailed(

Callers

nothing calls this directly

Calls 1

ContainerMethod · 0.95

Tested by

no test coverage detected