fix pipeline caching when using cache mounts

Force the Pipeline to resolve the canonical Cue value before computing.
This ensures that `.Path()` gives a constant result even on references.

Fixes #399

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-05-04 16:26:56 -07:00
parent e43532b6fc
commit d8a1f35f68
5 changed files with 90 additions and 54 deletions

View File

@@ -24,7 +24,6 @@ setup() {
# cache
run "$DAGGER" compute "$TESTDIR"/ops/mounts/valid/cache
assert_line '{"TestMountCache":"NOT SURE WHAT TO TEST YET"}'
assert_success
# component

View File

@@ -1,6 +1,8 @@
package testing
import "dagger.io/dagger/op"
import (
"dagger.io/dagger/op"
)
TestMountCache: {
string
@@ -11,7 +13,7 @@ TestMountCache: {
},
op.#Exec & {
args: ["sh", "-c", """
echo -n "NOT SURE WHAT TO TEST YET" > /out
echo -n "$RANDOM" > /out
"""]
dir: "/"
mount: something: "cache"
@@ -22,3 +24,6 @@ TestMountCache: {
},
]
}
// Make sure references to pipelines with cache mounts never get re-executed. #399
TestReference: TestMountCache