Skip to content

Commit 1a5c6b2

Browse files
committed
Optionally make context absolute
1 parent 78352f3 commit 1a5c6b2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tasks/image/build.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"io"
55
"io/ioutil"
66
"os"
7+
"path/filepath"
78
"strings"
89

910
"github.com/dnephin/dobi/config"
@@ -77,7 +78,7 @@ func buildIsStale(ctx *context.ExecuteContext, t *Task) (bool, error) {
7778
excludes = append(excludes, ".dobi")
7879

7980
mtime, err := fs.LastModified(&fs.LastModifiedSearch{
80-
Root: ctx.WorkingDir,
81+
Root: absPath(ctx.WorkingDir, t.config.Context),
8182
Excludes: excludes,
8283
Paths: paths,
8384
})
@@ -103,6 +104,13 @@ func buildIsStale(ctx *context.ExecuteContext, t *Task) (bool, error) {
103104
return false, nil
104105
}
105106

107+
func absPath(path string, wd string) string {
108+
if filepath.IsAbs(path) {
109+
return filepath.Clean(path)
110+
}
111+
return filepath.Join(wd, path)
112+
}
113+
106114
func buildImage(ctx *context.ExecuteContext, t *Task) error {
107115
var err error
108116
if t.config.Steps != "" {

0 commit comments

Comments
 (0)