Skip to content

Container.AsTarball does not cache as expected #6927

Closed

Description

@jedevc

Imagine the below:

	ctr := dag.Container().From("alpine")
	ctr.
		WithMountedFile("/ctr.tar", ctr.AsTarball()).
		WithExec([]string{"ls", "-lh", "/"}).
		Sync(ctx)

On the first run, this works as expected:

  1. ctr is built
  2. AsTarball triggers an OCI export
  3. WithExec is run on the result

However, on subsequent runs, this doesn't cache as expected - AsTarball is always executed, which results in ls always being run. I don't observe this change if I comment out the WithMountedFile line.


Currently, this seems to be one of the main issues that causes slow re-builds of the dagger engine image during development. Because we build the SDKs using this, this means we need to always run the AsTarball step, which breaks cache invalidation.

This was surfaced during work on #6843, where the better progress view means it's actually more obvious what the issue is.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions