Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions extras/dagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ func (att *Attestation) AddRawEvidence(
// if not provided it will either be loaded from the contract or inferred automatically
// +optional
kind string,
// List of annotations to be attached to the evidence for example:
// "key1=value1,key2=value2"
// +optional
annotations []string,
) (*Attestation, error) {
args := []string{
"attestation", "add",
Expand All @@ -263,6 +267,12 @@ func (att *Attestation) AddRawEvidence(
)
}

for _, annotation := range annotations {
args = append(args,
"--annotation", annotation,
)
}

_, err := att.
Container(0).
WithExec(args, execOpts).
Expand All @@ -284,6 +294,10 @@ func (att *Attestation) AddFileEvidence(
// if not provided it will either be loaded from the contract or inferred automatically
// +optional
kind string,
// List of annotations to be attached to the evidence for example:
// "key1=value1,key2=value2"
// +optional
annotations []string,
) (*Attestation, error) {
filename, err := path.Name(ctx)
if err != nil {
Expand All @@ -298,6 +312,12 @@ func (att *Attestation) AddFileEvidence(
"--value", mountPath,
}

for _, annotation := range annotations {
args = append(args,
"--annotation", annotation,
)
}

if kind != "" {
args = append(args,
"--kind", kind,
Expand Down Expand Up @@ -412,6 +432,10 @@ func (att *Attestation) Push(
// Output format
// +default="table"
format OutputFormat,
// List of annotations to be attached to the attestation for example:
// "key1=value1,key2=value2"
// +optional
annotations []string,
) (string, error) {
container := att.Container(0)
args := []string{
Expand All @@ -420,6 +444,10 @@ func (att *Attestation) Push(
"--output", string(format),
}

for _, annotation := range annotations {
args = append(args, "--annotation", annotation)
}

if key != nil {
container = container.WithMountedSecret("/tmp/key.pem", key)
args = append(args, "--key", "/tmp/key.pem")
Expand Down
Loading