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
17 changes: 14 additions & 3 deletions dap/thread.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,25 @@ func (t *thread) solveInputs(ctx context.Context, target *step) (string, map[str
}

func (t *thread) determineInputName(op *pb.Op, index int, input *pb.Input) string {
switch op := op.Op.(type) {
case *pb.Op_Exec:
for _, m := range op.Exec.Mounts {
// Attempt to match the input to one of the mount destinations if we have
// an exec operation.
if exec, ok := op.Op.(*pb.Op_Exec); ok {
for _, m := range exec.Exec.Mounts {
if m.Input >= 0 && m.Input == int64(index) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this assume that root mount is always input 0? I don't think there is a guarantee for that. Better to check .Dest == "/"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, it is greater-equal

return m.Dest
}
}
}

// Is our input digest a source? Use the identifier if it is.
// That should give us something that is at least more user-friendly.
if op := t.ops[digest.Digest(input.Digest)]; op != nil && input.Index == 0 {
if source, ok := op.Op.(*pb.Op_Source); ok {
return source.Source.Identifier
}
}

// Use a default name that matches the input digest.
return input.Digest
}

Expand Down