#Dagger run cache not breaking

1 messages · Page 1 of 1 (latest)

novel canyon
#

I am new to Dagger and currently testing things out. I am trying to understand the purpose of dagger run. I saw the new TUI that was added and wanted to try it out. Upon first use I've immediately ran into caching issues. Wrapping my existing command go run main.go -w ../ lint with dagger run go run main.go -w ../ lint does not break the cache when the code that is being linted is changed. Please see the video for the example. Is there something I am misunderstanding about dagger run? Or is this a known bug?

For the code itself, I am basically using a slimmed down version of https://github.com/dagger/dagger/blob/4ee5b2af7f73462a84e24dedc9362545fd9d8684/internal/mage/sdk/go.go#LL26C1-L49C2.

reef silo
#

My guess is this has to do with the working directory. Does it work if you do this instead? dagger run --workdir ../ go run main.go lint (or dagger run --workdir ../ go run main.go -w ../ lint - not sure if it makes -w redundant)

novel canyon
#

Thanks @reef silo! Both of those worked as intended

reef silo
#

Thanks for checking! That does seem surprising. This happens because the workdir is determined when the session starts, which dagger run does before running the command.

You can expect this to be fixed sometime soon. We're considering changing it to not start the session and let the SDK start it instead, which is what's happening without dagger run, so this seems like an extra motivation for that change.