#Why is this function not caching?

1 messages · Page 1 of 1 (latest)

sand vector
#

I have this function and it's the only one where I can't get the layer cache to work at all. The first step is always saying CACHED but beyond that it fails.

$ Container.from(address: "ghcr.io/oss-review-toolkit/ort:56.1.0"): Container! 0.5s CACHED
│ ✔ .withUser(name: "root"): Container! 0.0s
│ ✔ .withDirectory(
│ │ │ directory: Host.directory(exclude: [], path: "/root/dagger-dev"): Directory!
│ │ │ include: [".ort.yml", "ort/*"]
│ │ │ path: "/project"
│ │ ): Container! 0.0s
#

this happens when I rerun the function on a completely unchanged codebase...

#

I also noticed that it never says CACHED for .withUser("root") . Does this mean that that's where the layer caching breaks, or is that a red herring?

#

my goal is to make absolutely sure that this function never reruns if the included hasn't changed since the last run since it takes ages...

sand vector
#

i think it's due to the withSecretVariable

#

yeah confirmed. if i replace that with withEnvVariable it works. but that's obviously not wanted 😦

#

so how can I avoid withSecretVariable("FOO", dag.setSecret("FOO", "bar")) busting my cache?

sand vector
#

<@&946480760016207902> does anybody have any idea about this? I saw this issue, but it's literally the opposite behavior from what I am seeing. https://github.com/dagger/dagger/issues/9354 seems like the SetSecret stuff might be a bit broken currently.

GitHub

What is the issue? On a dagger.Container, using WithSecretVariable will not invalidate the cache of the following layers if the secret name does not change. i.e. token := dag.SetSecret("foo&qu...

sand vector
#

@autumn ingot btw I think it's probably fine if secrets never invalidate cache (as the issue above experiences), but it seems that behavior changed since this issue was created and secrets created with SetSecret now always invalidate cache, which is very annoying...

sand vector
waxen ermine
#

@sand vector seems lika a regression indeed. We'll take a look at it 🙏 . cc @edgy latch

waxen ermine
#

🙏