Skip to content

Commit 55828b6

Browse files
authored
feat(dagger): add annotations support (#2255)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent 94eca57 commit 55828b6

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

extras/dagger/main.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ func (att *Attestation) AddRawEvidence(
244244
// if not provided it will either be loaded from the contract or inferred automatically
245245
// +optional
246246
kind string,
247+
// List of annotations to be attached to the evidence for example:
248+
// "key1=value1,key2=value2"
249+
// +optional
250+
annotations []string,
247251
) (*Attestation, error) {
248252
args := []string{
249253
"attestation", "add",
@@ -263,6 +267,12 @@ func (att *Attestation) AddRawEvidence(
263267
)
264268
}
265269

270+
for _, annotation := range annotations {
271+
args = append(args,
272+
"--annotation", annotation,
273+
)
274+
}
275+
266276
_, err := att.
267277
Container(0).
268278
WithExec(args, execOpts).
@@ -284,6 +294,10 @@ func (att *Attestation) AddFileEvidence(
284294
// if not provided it will either be loaded from the contract or inferred automatically
285295
// +optional
286296
kind string,
297+
// List of annotations to be attached to the evidence for example:
298+
// "key1=value1,key2=value2"
299+
// +optional
300+
annotations []string,
287301
) (*Attestation, error) {
288302
filename, err := path.Name(ctx)
289303
if err != nil {
@@ -298,6 +312,12 @@ func (att *Attestation) AddFileEvidence(
298312
"--value", mountPath,
299313
}
300314

315+
for _, annotation := range annotations {
316+
args = append(args,
317+
"--annotation", annotation,
318+
)
319+
}
320+
301321
if kind != "" {
302322
args = append(args,
303323
"--kind", kind,
@@ -412,6 +432,10 @@ func (att *Attestation) Push(
412432
// Output format
413433
// +default="table"
414434
format OutputFormat,
435+
// List of annotations to be attached to the attestation for example:
436+
// "key1=value1,key2=value2"
437+
// +optional
438+
annotations []string,
415439
) (string, error) {
416440
container := att.Container(0)
417441
args := []string{
@@ -420,6 +444,10 @@ func (att *Attestation) Push(
420444
"--output", string(format),
421445
}
422446

447+
for _, annotation := range annotations {
448+
args = append(args, "--annotation", annotation)
449+
}
450+
423451
if key != nil {
424452
container = container.WithMountedSecret("/tmp/key.pem", key)
425453
args = append(args, "--key", "/tmp/key.pem")

0 commit comments

Comments
 (0)