#any reference on how those content
1 messages · Page 1 of 1 (latest)
They are an internal implementation detail, so no reference other than the code where they are implemented: https://github.com/sipsma/dagger/blob/738bbf96b0f896cfeb77473bc25870392706c21b/core/cache.go#L58-L58
But actually, I'm sort of surprised the ID would ever get that long looking at the cache id implementation again. Is it possible for you to share the part of the code where you are using a cache mount?
cc @last nimbus
This is the entire function
export default async (client: Client, target: string, env: string) => {
const sourcePath = 'build/argo-manifests'
const buildSource = await client.host().directory(sourcePath).id()
const pulumiDir = await client.host().directory('build/pulumi').id()
const npmCache = await client.cacheVolume("node_modules").id()
return await client.container()
.from('pulumi/pulumi')
.withDirectory(`${workDir}/${buildSource}`, buildSource)
.withMountedDirectory(`${workDir}/build/pulumi`, pulumiDir)
.withMountedCache(`${workDir}/${buildSource}/node_modules`, npmCache)
.withEntrypoint([])
.withEnvVariable('PULUMI_CONFIG_PASSPHRASE', 'local')
.withEnvVariable('IMAGE_TAG', process.env.IMAGE_TAG ?? 'latest')
.withEnvVariable('PULUMI_RENDER_PATH', `${workDir}/${outputDir}`)
.withEnvVariable('APP_ENV', env)
.withEnvVariable('RELEASE_TARGET', target)
.withWorkdir(`${workDir}/${sourcePath}`)
.withExec(['ls'])
.withExec(['npm', 'install'])
.withExec(['pulumi', 'login', '--local'])
.withExec(['pulumi', 'stack', 'init', 'dev'])
.withExec(['pulumi', 'up', '-y'])
.directory(`${workDir}/${outputDir}/1-manifest`)
.id()
}
the only cache there is the npmCache
I have an extremely similar function that works just fine
Ohh I see it now: .withMountedCache(${workDir}/${buildSource}/node_modules, npmCache)
You are putting buildSource in as the path where the cache mount should be located, but buildSource is an ID (which is the really long bas64 string you were getting in the error)
Not very obvious that was the problem though, what was your original intention there? For it to be build/pulumi, or something else? Just wondering if there's anything we can do to make things like this more obvious (other than a better error message of course)

yeah, I used to pass build/argo-manifests in as an argument
think I'll skip the bug report unless you want it? I at least personally don't really consider it a bug
Sure thing, I'm gonna file one for some extra validation on our end to make the error message better. I think we can just enforce the limit in our code rather than let buildkit encounter much later
.withDirectory(`${workDir}/${buildSource}`, buildSource)
yeah there's some bugs in here lol
thanks for spotting that, that's saving me some time
yeah that's fair
In an ideal world I'd be told "you have a dagger ID in your path, you probably don't want this as your path"
alright, looks like we have running code 😄 if all this works, that'll mean I have our new monorepo setup with Dagger for every CI step (test, build, release)
No worries, happy to be an extra pair of eyes.