Skip to content

core git should have keepGitDir option and perhaps depth. Should it be true by default? #3050

Closed

Description

@jpadams

I've found it confusing that when I see demos of doing a git pull of the dagger/dagger repo and a dockerbuild that the docker version command run afterwards doesn't show a short git hash in the version number like it does when I git clone and build dagger locally on my machine.

For example:

dagger devel (708210f74) darwin/arm64
dagger devel (708210f74) linux/arm64
{
    core {
        git(remote: "https://github.com/dagger/dagger") {
            dockerbuild(dockerfile: "Dockerfile") {
                exec(input:{args:["dagger", "version"]}) {
                    stdout
                }
            }
        }
    }
}

{
  "data": {
    "core": {
      "git": {
        "dockerbuild": {
          "exec": {
            "stdout": "dagger devel () linux/arm64\n"
          }
        }
      }
    }
  }
}

I expected a git clone type functionality. Not sure if other folks are expecting something else. If the size of the .git directory is a concern, we could use something like git clone --depth=1.

It seems that perhaps the default BuildKit behavior is to not preserve the .git directory (not sure), but I see that this is an option in BuildKit LLB land (depending on things like dockerfile frontends and such I think), and so we should have that option in cloak to keep the .git directory and likely limit the clone depth and other bells and whistles.

https://github.com/dagger/dagger/blob/main/plan/task/gitpull.go#L40-L43
https://github.com/dagger/dagger/blob/main/version/version.go#L16-L30
https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#example-keep-git-dir

Activity

  1. changed the title [-]`core` `git` should have `keepGitDir` option. Should it be `true` by default?[/-] [+]`core` `git` should have `keepGitDir` option and perhaps `depth`. Should it be `true` by default?[/+] on Aug 22, 2022
  2. added this to the Cloak GA milestone on Sep 16, 2022
  3. transferred this issue fromdagger/cloakon Sep 16, 2022
  4. added
    area/engine
    and removed on Dec 5, 2022
  5. sipsma commented on Dec 6, 2022

    @sipsma
    Contributor

    We have support for including the git dir now. We don't have an option for git depth though

  6. vito commented on Feb 10, 2023

    @vito
    Contributor

    I'm leaning towards keeping the .git dir by default at this point. It seems like we've needed it more than half the time we've used the Git API.

  7. helderco commented on Jul 14, 2023

    @helderco
    Contributor

    Closing since this is done. If reopening because of making keepGitDir default to true, please update issue or create new one.

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

    area/engine

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions