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

Function newAttestationStatusCmd

app/cli/cmd/attestation_status.go:39–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37var full bool
38
39func newAttestationStatusCmd() *cobra.Command {
40 cmd := &cobra.Command{
41 Use: "status",
42 Short: "check the status of the current attestation process",
43 Annotations: map[string]string{
44 useAPIToken: "true",
45 supportsFederatedAuthAnnotation: "true",
46 },
47 RunE: func(cmd *cobra.Command, args []string) error {
48 a, err := action.NewAttestationStatus(
49 &action.AttestationStatusOpts{
50 UseAttestationRemoteState: attestationID != "",
51 ActionsOpts: ActionOpts,
52 LocalStatePath: attestationLocalStatePath,
53 },
54 )
55 if err != nil {
56 return fmt.Errorf("failed to load action: %w", err)
57 }
58
59 res, err := a.Run(cmd.Context(), attestationID)
60 if err != nil {
61 return err
62 }
63
64 outputF := simpleStatusTable
65 if full {
66 outputF = fullStatusTable
67 }
68
69 return output.EncodeOutput(flagOutputFormat, res, outputF)
70 },
71 }
72
73 cmd.Flags().BoolVar(&full, "full", false, "full report including current recorded values")
74 flagAttestationID(cmd)
75
76 return cmd
77}
78
79func simpleStatusTable(status *action.AttestationStatusResult) error {
80 return attestationStatusTableOutput(status, os.Stdout, false)

Callers 1

newAttestationCmdFunction · 0.85

Calls 5

RunMethod · 0.95
NewAttestationStatusFunction · 0.92
EncodeOutputFunction · 0.92
flagAttestationIDFunction · 0.85
ContextMethod · 0.80

Tested by

no test coverage detected