#any reference on how those content

1 messages · Page 1 of 1 (latest)

snow void
#

cc @last nimbus

kind spruce
#

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

snow void
#

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)

kind spruce
#

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

snow void
kind spruce
#
.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)

snow void