Skip to content

Commit 388c9c1

Browse files
feat(wanda): Add dependency graph with @name discovery
Add buildDepGraph() to parse wanda specs and resolve @name dependencies by scanning the repo for *.wanda.yaml files. The dependency graph is built in deterministic topological order using Kahn's algorithm with lexicographic tie-breaking. Key features: - @name syntax in froms references local specs by name - Automatic discovery by scanning repo from git root - Parallel spec parsing for performance - Cycle detection with helpful error messages - Variable expansion with unexpanded var detection Topic: wanda-deps Signed-off-by: andrew <andrew@anyscale.com>
1 parent 8d6bd66 commit 388c9c1

File tree

11 files changed

+1109
-3
lines changed

11 files changed

+1109
-3
lines changed

wanda/deps.go

Lines changed: 445 additions & 0 deletions
Large diffs are not rendered by default.

wanda/deps_test.go

Lines changed: 645 additions & 0 deletions
Large diffs are not rendered by default.

wanda/forge_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func TestForge_withHints(t *testing.T) {
172172
t.Fatalf("build: %v", err)
173173
}
174174

175-
const tag = "cr.ray.io/rayproject/hello"
175+
const tag = "cr.ray.io/rayproject/hello-hint"
176176

177177
ref, err := name.ParseReference(tag)
178178
if err != nil {

wanda/testdata/Dockerfile.dep-base

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM scratch
2+
COPY Dockerfile.dep-base /opt/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM dep-base
2+
COPY world.txt /opt/

wanda/testdata/Dockerfile.dep-top

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM dep-middle
2+
COPY Dockerfile.dep-top /opt/

wanda/testdata/dep-base.wanda.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name: dep-base
2+
dockerfile: Dockerfile.dep-base
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: dep-middle
2+
froms: ["cr.ray.io/rayproject/dep-base"]
3+
dockerfile: Dockerfile.dep-middle
4+
srcs:
5+
- world.txt

wanda/testdata/dep-top.wanda.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: dep-top
2+
froms: ["cr.ray.io/rayproject/dep-middle"]
3+
dockerfile: Dockerfile.dep-top
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: hello
1+
name: hello-hint
22
dockerfile: Dockerfile.hello
33
build_hint_args:
44
- MESSAGE=hint message

0 commit comments

Comments
 (0)