Skip to content

Do not require vendoring packages in git (i.e., use a global cache) #2503

Closed as not planned

Description

@helderco

Problem

CUE only looks for packages in cue.mod/{pkg,gen,usr} (merging these directories). This has required us to commit packages to git.

Solution

We do have our own dagger.mod and dagger.sum files, like Go. We can make them good enough to be depended on to reinstall packages in new git clones like in CI (verifying checksums). This makes committing cue.mod/pkg less necessary.

But I want to propose using a global cache here.

Global cache

We can take a hint from cuemod, which downloads modules into a global cache (GOMODCACHE in that case), and then symlinking them into cue.mod/pkg. @morlay took inspiration from pnpm (homebrew does this as well), although it uses hard links instead of symlinks (there's a whole discussion on why that's better).

We could do the same. Use the global cache to avoid re-downloading repos and also for verifying the checksums. At which point, link packages into cue.mod/pkg so that CUE can read them. CI can also be configured to cache this directory.

Ask upstream to add setting

It would be much better if upstream supported looking for packages in a $CUEMODCACHE environment variable, besides cue.mod/pkg, even if they don't use/manage it themselves yet. It would avoid the need to symlink and I think it's a very easy change on their part. Planned even.

UPDATE: not an easy change to ask because of lack of version concept.

Activity

  1. changed the title [-]Do not require to commit vendored packages in git (e.g. commit only `dagger.mod` and `dagger.sum`, just like go)[/-] [+]Do not require to commit vendored packages in git[/+] on May 24, 2022
  2. changed the title [-]Do not require to commit vendored packages in git[/-] [+]Do not require vendoring packages in git (i.e., use a global cache)[/+] on May 24, 2022
  3. helderco commented on May 26, 2022

    @helderco
    ContributorAuthor

    For the global cache to work, we need to support multiple versions of packages, so it's not a simple ask for upstream to add the setting because there's no concept of module versions yet.

    Example:

    ~/cue/mod/pkg/github.com/dagger/[email protected]
    ~/cue/mod/pkg/github.com/dagger/[email protected]
    
  4. helderco commented on Dec 22, 2022

    @helderco
    ContributorAuthor

    Closing. More context in parent issue: #2163.

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