Problem
Given the following example:
package main
import (
"context"
"time"
)
type CacheErrorsTest struct{}
func (m *CacheErrorsTest) Test(ctx context.Context) {
c := dag.Container().From("alpine").
WithMountedCache("/lala", dag.CacheVolume("cache")).
WithEnvVariable("BUST", time.Now().String()).
WithExec([]string{"rm", "-rf", "/lala/foo.txt"})
_, err := c.WithExec([]string{"ls", "/lala/foo.txt"}).Sync(ctx)
if err == nil {
panic("should error")
}
c.WithExec([]string{"touch", "/lala/foo.txt"}).Sync(ctx)
_, err = c.
//WithEnvVariable("BUST", time.Now().String()). uncomment to make the test pass
WithExec([]string{"ls", "/lala/foo.txt"}).Sync(ctx)
if err != nil {
panic("should not error")
}
}
You'll notice that without a cache bust, the second ls exec will fail given that it will return the cached error response from the first one.
Seem to me that this comes from the dagQL level somehow given that the trace (https://v3.dagger.cloud/marcos-test/traces/000a7698719eb365026ed03cc27ed7e1?span=06966b2aa4707511) doesn't show the second operation as being cached from buildkit's side.
Solution
The test should pass since we shouldn't be caching error responses.
Problem
Given the following example:
You'll notice that without a cache bust, the second
lsexec will fail given that it will return the cached error response from the first one.Seem to me that this comes from the
dagQLlevel somehow given that the trace (https://v3.dagger.cloud/marcos-test/traces/000a7698719eb365026ed03cc27ed7e1?span=06966b2aa4707511) doesn't show the second operation as beingcachedfrom buildkit's side.Solution
The test should pass since we shouldn't be caching error responses.