#Can someone help me explain why this
1 messages · Page 1 of 1 (latest)
tried simple repro that has an outer module and an inner module with no dependency between them (I didn't dagger install inner from outer). Initially, I can't perform an equiv of either of your examples if I'm inside inner and try to call ../outer because I'm escaping the context dir. But I'm going to try to make it a git repo rooted at outer and see how that changes it.
outer
├── LICENSE
├── dagger.gen.go
├── dagger.json
├── go.mod
├── go.sum
├── inner
│ ├── LICENSE
│ ├── dagger.gen.go
│ ├── dagger.json
│ ├── go.mod
│ ├── go.sum
│ └── main.go
└── main.go
The outer main.go:
package main
import (
"dagger/outer/internal/dagger"
)
type Outer struct{}
func (m *Outer) Deploy(file *dagger.File) *dagger.Container {
return dag.
Container().
From("alpine:latest").
WithWorkdir("/app").
WithFile("foo", file)
}
The inneer main.go:
package main
import (
"dagger/inner/internal/dagger"
)
type Inner struct{}
func (m *Inner) Build() *dagger.File {
return dag.File("foo", "I am a foo file")
}
dagger <<.
. | build | export dist
.. | deploy ./dist
.
Error: find module "..": can't escape context root: /Users/jeremyadams/src/raw/outer/inner
Similar error in shell
Your second example is going 3 levels deep for dagger/cloudflare as opposed to two levels in the first. Is that intentional?
After I git init in outer I can do it 🙂 since me context is now the git repo scope they're both in versus the individual module scope.
For example
dagger <<. git:master*
. | build | export dist
.. | deploy ./dist | terminal
.
trying in interactive shell
works, for example
dist=$(. | build)
.. | deploy $dist | terminal
Other thing is that since my git repo "boundary" is at outer, I can only refer to it from inner/ by calling it .. and not with the name of the module directory path. I can call ../inner from inner/ but I can't escape outside of the whole repo to say ../../outer so I can't refer to it by name. If I move the root of my git repo out an orbit, then I should be fine. Confirmed.
outer ➤ rm -rf .git
outer ➤ cd ..
far-outer ➤ git init
far-outer ➤ cd outer/inner
inner ➤
dagger <<.
. | build | export dist
../../outer | deploy ./dist | terminal
.
Two different projects, I just failed to copy from the same one; but it's valid 🙂
@gleaming drum My Git boundary is ../../../