(status *action.AttestationStatusResult, w io.Writer, full bool)
| 89 | } |
| 90 | |
| 91 | func attestationStatusTableOutput(status *action.AttestationStatusResult, w io.Writer, full bool) error { |
| 92 | // General info table |
| 93 | gt := output.NewTableWriterWithWriter(w) |
| 94 | gt.AppendRow(table.Row{"Initialized At", status.InitializedAt.Format(time.RFC822)}) |
| 95 | gt.AppendSeparator() |
| 96 | meta := status.WorkflowMeta |
| 97 | gt.AppendRow(table.Row{"Attestation ID", status.AttestationID}) |
| 98 | if status.Digest != "" { |
| 99 | gt.AppendRow(table.Row{"Digest", status.Digest}) |
| 100 | } |
| 101 | gt.AppendRow(table.Row{"Organization", meta.Organization}) |
| 102 | gt.AppendRow(table.Row{"Name", meta.Name}) |
| 103 | gt.AppendRow(table.Row{"Project", meta.Project}) |
| 104 | projectVersion := versionStringAttestation(meta.ProjectVersion, status.IsPushed) |
| 105 | gt.AppendRow(table.Row{"Version", projectVersion}) |
| 106 | gt.AppendRow(table.Row{"Contract", fmt.Sprintf("%s (revision %s)", meta.ContractName, meta.ContractRevision)}) |
| 107 | if status.RunnerContext.JobURL != "" { |
| 108 | gt.AppendRow(table.Row{"Runner Type", status.RunnerContext.RunnerType}) |
| 109 | gt.AppendRow(table.Row{"Runner URL", status.RunnerContext.JobURL}) |
| 110 | } |
| 111 | |
| 112 | if len(status.Annotations) > 0 { |
| 113 | gt.AppendRow(table.Row{"Annotations", "------"}) |
| 114 | for _, a := range status.Annotations { |
| 115 | value := a.Value |
| 116 | if value == "" { |
| 117 | value = NotSet |
| 118 | } |
| 119 | gt.AppendRow(table.Row{"", fmt.Sprintf("%s: %s", a.Name, value)}) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | if status.TimestampAuthority != "" { |
| 124 | gt.AppendRow(table.Row{"Timestamp Authority", status.TimestampAuthority}) |
| 125 | } |
| 126 | |
| 127 | var blockingColor text.Color |
| 128 | var blockingText = action.PolicyViolationBlockingStrategyAdvisory |
| 129 | if status.MustBlockOnPolicyViolations { |
| 130 | blockingColor = text.FgHiYellow |
| 131 | blockingText = action.PolicyViolationBlockingStrategyEnforced |
| 132 | } |
| 133 | gt.AppendRow(table.Row{"Policy violation strategy", blockingColor.Sprint(blockingText)}) |
| 134 | |
| 135 | evs := status.PolicyEvaluations[chainloop.AttPolicyEvaluation] |
| 136 | if len(evs) > 0 { |
| 137 | gt.AppendRow(table.Row{"Policies", "------"}) |
| 138 | policiesTable(evs, gt, flagDebug) |
| 139 | } |
| 140 | |
| 141 | // Add the Attestation View URL if available |
| 142 | if status.AttestationViewURL != "" { |
| 143 | gt.AppendRow(table.Row{"Attestation View URL", status.AttestationViewURL}) |
| 144 | } |
| 145 | |
| 146 | gt.Render() |
| 147 | |
| 148 | if err := materialsTable(status, w, full); err != nil { |
no test coverage detected