Skip to content

Commit 8033908

Browse files
authored
Merge pull request #3371 from jsternberg/dap-nested-dockerfile-path
dap: look for base name of dockerfile name instead of path from context
2 parents 10605b8 + b3c3896 commit 8033908

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

dap/thread.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dap
22

33
import (
44
"context"
5+
"path"
56
"path/filepath"
67
"sync"
78

@@ -106,7 +107,14 @@ func (t *thread) init(ctx Context, c gateway.Client, ref gateway.Reference, meta
106107
t.c = c
107108
t.ref = ref
108109
t.meta = meta
109-
t.sourcePath = inputs.ContextPath
110+
111+
// Combine the dockerfile directory with the context path to find the
112+
// real base path. The frontend will report the base path as the filename.
113+
dir := path.Dir(inputs.DockerfilePath)
114+
if !path.IsAbs(dir) {
115+
dir = path.Join(inputs.ContextPath, dir)
116+
}
117+
t.sourcePath = dir
110118

111119
if err := t.getLLBState(ctx); err != nil {
112120
return err

dap/variables.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"io/fs"
7+
"path"
78
"path/filepath"
89
"strconv"
910
"strings"
@@ -44,6 +45,7 @@ func (f *frame) fillLocation(def *llb.Definition, loc *pb.Locations, ws string)
4445

4546
info := def.Source.Infos[l.SourceIndex]
4647
f.Source = &dap.Source{
48+
Name: path.Base(info.Filename),
4749
Path: filepath.Join(ws, info.Filename),
4850
}
4951
return

0 commit comments

Comments
 (0)