Skip to content

Running configs with --no-cache that have #CacheDirs breaks #1357

@jlongtine

Description

@jlongtine

While working on the Changelog.com config, I found that running dagger with --no-cache caused #CacheDir to not persist needed files across tasks (not just runs - that's expected).

As seen below, I download dependencies in deps (into /app/deps, and those dependencies would not be in a subsequent task depsCompileProd when that #CacheDir is mounted.

actions: {
  depsCache: engine.#CacheDir & {
    id: "depsCache"
  }
  depsCacheMount: "depsCache": {
    dest:     *"/app/deps/" | string
    contents: depsCache
  }
  deps:                engine.#Exec & {
    input:   _
    mounts:  depsCacheMount
    workdir: "/app"
    args: ["bash", "-c", " mix deps.get"]
  }
  depsCompileProd: engine.#Exec & {
    input: deps.output
    env: MIX_ENV: "prod"
    mounts:  depsCacheMount
    workdir: "/app"
    args: ["bash", "-c", "mix do deps.compile, compile"]
  }
}

per @aluzzardi, we should repro with docker RUN --mount and add a --no-cache test to tests/tasks/exec/mount_cache.cue

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions