()
| 37 | var full bool |
| 38 | |
| 39 | func 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 | |
| 79 | func simpleStatusTable(status *action.AttestationStatusResult) error { |
| 80 | return attestationStatusTableOutput(status, os.Stdout, false) |
no test coverage detected