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

Function predicateV1Table

app/cli/cmd/workflow_workflow_run_describe.go:194–252  ·  view source on GitHub ↗
(att *action.WorkflowRunAttestationItem)

Source from the content-addressed store, hash-verified

192}
193
194func predicateV1Table(att *action.WorkflowRunAttestationItem) {
195 // Materials
196 materials := att.Materials
197 if len(materials) > 0 {
198 mt := output.NewTableWriter()
199 mt.SetTitle("Materials")
200
201 for _, m := range materials {
202 mt.AppendRow(table.Row{"Name", m.Name})
203 mt.AppendRow(table.Row{"Type", m.Type})
204 if m.Filename != "" {
205 mt.AppendRow(table.Row{"Filename", m.Filename})
206 }
207
208 // We do not want to show the value if it is a file
209 if !m.EmbeddedInline && m.UploadedToCAS || m.Type == "CONTAINER_IMAGE" {
210 v := m.Value
211 if m.Tag != "" {
212 v = fmt.Sprintf("%s:%s", v, m.Tag)
213 }
214 if v != "" {
215 mt.AppendRow(table.Row{"Value", wrap.String(v, 100)})
216 }
217 }
218
219 if m.Hash != "" {
220 mt.AppendRow(table.Row{"Digest", m.Hash})
221 }
222
223 if len(m.Annotations) > 0 {
224 mt.AppendRow(table.Row{"Annotations", "------"})
225 for _, a := range m.Annotations {
226 mt.AppendRow(table.Row{"", wrap.String(fmt.Sprintf("%s: %s", a.Name, a.Value), 100)})
227 }
228 }
229 evs := att.PolicyEvaluations[m.Name]
230 if len(evs) > 0 {
231 mt.AppendRow(table.Row{"Policies", "------"})
232 policiesTable(evs, mt, flagDebug)
233 }
234 mt.AppendSeparator()
235 }
236
237 mt.Render()
238 }
239
240 envVars := att.EnvVars
241 if len(envVars) > 0 {
242 mt := output.NewTableWriter()
243 mt.SetTitle("Environment Variables")
244
245 header := table.Row{"Name", "Value"}
246 mt.AppendHeader(header)
247 for _, e := range envVars {
248 mt.AppendRow(table.Row{e.Name, e.Value})
249 }
250 mt.Render()
251 }

Callers 1

Calls 4

NewTableWriterFunction · 0.92
policiesTableFunction · 0.85
RenderMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected