#Help with caching

1 messages · Page 1 of 1 (latest)

brisk sequoia
#

I'm trying to work around a silly npm package that put all the optimized images in a weird directory which I can't mount a directory directly, cause I will override project files.

So I'm trying to copy the results into a cache volume, and then restore it on the next run prior to usage.

#

Checking with ls is seems that the cache gets its data in after optimizing, but on the next run, the cache is empty

#

The cache key is the same every time, coming from a const

#

This is how I create the caches.

    caches := map[string]*dagger.CacheVolume{
        config.NpmCacheDir:       dag.Client.CacheVolume(config.GlobalNpmCacheKey),
        config.ElectronCacheDir:  dag.Client.CacheVolume(config.GlobalElectronCacheKey),
        config.PreCommitCacheDir: dag.Client.CacheVolume(config.GlobalPreCommitCacheKey),
        config.ImageCacheDir:     dag.Client.CacheVolume(config.GlobalImageCacheKey),
    }

    cacheOpts := dagger.ContainerWithMountedCacheOpts{Sharing: dagger.Shared}
    for k, v := range caches {
        c = c.WithMountedCache(k, v, cacheOpts)
    }
#

Hmm locally runs fine, but not on the jenkins agent

How I would check if the buildkit flushes the cache for some reason

#

Actually on jenkins nothing seems to be cached.
Re-running the same job, it takes the full time