chainloop
chainloop copied to clipboard
policies: improve error response
When a remote policy fails to be fetched we show an error that doesn't tell me which one actually failed.
We should show which one couldn't be loaded.
chainloop att add --name sbom --value ./sbom.cyclonedx.json
INF uploading sbom.cyclonedx.json - sha256:16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c
ERR adding material: error applying policies to material: policy error: failed to load policy spec: loading policy spec: loading policy: rpc error: code = NotFound desc = policy not found
On another note, and maybe as part of #1207, we should also figure out how to extract the basic error from the grpc.
btw, this is the contract I used
{
"schemaVersion": "v1",
"materials": [
{
"type": "SBOM_CYCLONEDX_JSON",
"name": "sbom"
}
],
"policies": {
"materials": [
{
"ref": "cyclonedx-licenses.yaml"
},
{
"ref": "https://raw.githubusercontent.com/chainloop-dev/chainloop/main/docs/examples/policies/sbom/cyclonedx-licenses.yaml"
},
{
"ref": "chainloop://cyclonedx-licenses"
},
{
"ref": "chainloop://platform/cyclonedx-licenses"
}
]
}
}