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

Function NewAttestationAdd

app/cli/pkg/action/attestation_add.go:62–80  ·  view source on GitHub ↗
(cfg *AttestationAddOpts)

Source from the content-addressed store, hash-verified

60}
61
62func NewAttestationAdd(cfg *AttestationAddOpts) (*AttestationAdd, error) {
63 opts := []crafter.NewOpt{crafter.WithLogger(&cfg.Logger)}
64 if cfg.RegistryServer != "" && cfg.RegistryUsername != "" && cfg.RegistryPassword != "" {
65 cfg.Logger.Debug().Str("server", cfg.RegistryServer).Str("username", cfg.RegistryUsername).Msg("using OCI registry credentials")
66 opts = append(opts, crafter.WithOCIAuth(cfg.RegistryServer, cfg.RegistryUsername, cfg.RegistryPassword))
67 }
68 if cfg.NoStrictValidation {
69 opts = append(opts, crafter.WithNoStrictValidation(cfg.NoStrictValidation))
70 }
71
72 return &AttestationAdd{
73 ActionsOpts: cfg.ActionsOpts,
74 newCrafterOpts: &newCrafterOpts{cpConnection: cfg.CPConnection, opts: opts},
75 casURI: cfg.CASURI,
76 casCAPath: cfg.CASCAPath,
77 connectionInsecure: cfg.ConnectionInsecure,
78 localStatePath: cfg.LocalStatePath,
79 }, nil
80}
81
82var ErrAttestationNotInitialized = errors.New("attestation not yet initialized")
83

Callers 1

newAttestationAddCmdFunction · 0.92

Calls 4

WithLoggerFunction · 0.92
WithOCIAuthFunction · 0.92
WithNoStrictValidationFunction · 0.92
DebugMethod · 0.45

Tested by

no test coverage detected