Skip to content

Commit 84929ca

Browse files
authored
feat(cp): expose CAS upload/inline status in API (#342)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 4ca2a82 commit 84929ca

File tree

7 files changed

+182
-115
lines changed

7 files changed

+182
-115
lines changed

app/cli/internal/action/workflow_run_describe.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ type WorkflowRunAttestationItem struct {
5757
type Material struct {
5858
Name string `json:"name"`
5959
// filename, container image name, string value, ...
60-
Value string `json:"value"`
61-
Hash string `json:"hash"`
62-
Type string `json:"type"`
63-
Annotations []*Annotation `json:"annotations,omitempty"`
60+
Value string `json:"value"`
61+
Hash string `json:"hash"`
62+
Type string `json:"type"`
63+
Annotations []*Annotation `json:"annotations,omitempty"`
64+
UploadedToCAS bool `json:"uploadedToCAS,omitempty"`
65+
EmbeddedInline bool `json:"embeddedInline,omitempty"`
6466
}
6567

6668
type EnvVar struct {
@@ -163,10 +165,12 @@ func (action *WorkflowRunDescribe) Run(runID string, verify bool, publicKey stri
163165

164166
func materialPBToAction(in *pb.AttestationItem_Material) *Material {
165167
m := &Material{
166-
Name: in.Name,
167-
Value: in.Value,
168-
Type: in.Type,
169-
Hash: in.Hash,
168+
Name: in.Name,
169+
Value: in.Value,
170+
Type: in.Type,
171+
Hash: in.Hash,
172+
UploadedToCAS: in.UploadedToCas,
173+
EmbeddedInline: in.EmbeddedInline,
170174
}
171175

172176
// append annotations sorted

app/controlplane/api/controlplane/v1/response_messages.pb.go

Lines changed: 124 additions & 101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/response_messages.pb.validate.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/response_messages.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ message AttestationItem {
7878
string type = 3;
7979
map<string, string> annotations = 4;
8080
string hash = 5;
81+
// it's been uploaded to an actual CAS backend
82+
bool uploaded_to_cas = 6;
83+
// the content instead if inline
84+
bool embedded_inline = 7;
8185
}
8286
}
8387

app/controlplane/api/controlplane/v1/status_http.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts

Lines changed: 31 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/internal/service/attestation.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,12 @@ func extractMaterials(in []*chainloop.NormalizedMaterial) ([]*cpAPI.AttestationI
387387
res := make([]*cpAPI.AttestationItem_Material, 0, len(in))
388388
for _, m := range in {
389389
materialItem := &cpAPI.AttestationItem_Material{
390-
Name: m.Name,
391-
Type: m.Type,
392-
Annotations: m.Annotations,
393-
Value: m.Value,
390+
Name: m.Name,
391+
Type: m.Type,
392+
Annotations: m.Annotations,
393+
Value: m.Value,
394+
UploadedToCas: m.UploadedToCAS,
395+
EmbeddedInline: m.EmbeddedInline,
394396
}
395397

396398
if m.Hash != nil {

0 commit comments

Comments
 (0)