Skip to content

✨ load private modules via mounting git config or ssh config #8809

Closed

Description

@raghavendramallela

What are you trying to do?

trying to load private module frm a private git instance

dagger -m 'ssh://[email protected]/raghavendramallela/sample-repo.git/dgmodules/node@main' functions -vvvvvvv
✔ connect 2.5s
  ✔ starting engine 0.0s
  ✔ connecting to engine 0.7s
  ✔ starting session 1.2s
  ✔ subscribing to telemetry 0.6s
    ✔ consuming /v1/traces 0.6s
    ✔ consuming /v1/logs 0.0s
    ✔ consuming /v1/metrics 0.0s
✘ initialize 16.7s
! failed to get configured module: failed to get module ref kind: input: moduleSource resolve: failed to resolve git src to commit: failed to load cache key: failed to fetch remote ssh://[email protected]/raghavendramallela/sample-repo.git: git error: exit status 128
  ✘ resolving module ref 16.7s
  ! failed to get configured module: failed to get module ref kind: input: moduleSource resolve: failed to resolve git src to commit: failed to load cache key: failed to fetch remote ssh://[email protected]/raghavendramallela/sample-repo.git: git error: exit status 128
    ✔ cache request: mkfile /schema.json 0.0s
    ✔ load cache: mkfile /schema.json 0.0s
    ✔ cache request: blob://sha256:0aff3009fd4981ff50337ab097a7ad9370b8b2d6eccacb5971edd2cad68103cd 0.0s
    ✔ load cache: blob://sha256:0aff3009fd4981ff50337ab097a7ad9370b8b2d6eccacb5971edd2cad68103cd 0.0s
    ✔ blob(digest: "sha256:0aff3009fd4981ff50337ab097a7ad9370b8b2d6eccacb5971edd2cad68103cd", mediaType: "application/vnd.oci.image.layer.v1.tar", size: 167936, uncompressed: "sha256:0aff3009fd4981ff50337ab097a7ad9370b8b2d6eccacb5971edd2cad68103cd"): Directory! = xxh3:f454a91b472a82b9 0.0s
    ✔ Directory.file(path: "schema.json"): File! = xxh3:73efab4f927585b8 0.4s
    ✘ moduleSource(refString: "ssh://[email protected]/raghavendramallela/sample-repo.git/dgmodules/node@main"): ModuleSource! = xxh3:dd58abd5505841d6 15.2s
    ! failed to resolve git src to commit: failed to load cache key: failed to fetch remote ssh://[email protected]/raghavendramallela/sample-repo.git: git error: exit status 128
      ✔ parseRefString: ssh://[email protected]/raghavendramallela/sample-repo.git/dgmodules/node@main 0.0s
      ✔ git(url: "ssh://[email protected]/raghavendramallela/sample-repo.git"): GitRepository! = xxh3:c0075b0f5de11074 0.0s
        ✔ host: Host! = xxh3:ff73c85214b8f75c 0.0s
        ✔ Host.__internalSocket(accessor: "2f746d702f7373682d383254536f633846494149712f6167656e742e313537363539b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad"): Socket! = xxh3:868707ad72e3f5af 0.0s
      ✔ GitRepository.commit(id: "main"): GitRef! = xxh3:5d7ff737156ac626 0.0s
      ✘ cache request: git://privgit.com/raghavendramallela/sample-repo.git#main 5.2s
      ! failed to fetch remote ssh://[email protected]/raghavendramallela/sample-repo.git: git error: exit status 128

Error: failed to get configured module: failed to get module ref kind: input: moduleSource resolve: failed to resolve git src to commit: failed to load cache key: failed to fetch remote ssh://[email protected]/raghavendramallela/sample-repo.git: git error: exit status 128
stderr:
ssh: Could not resolve hostname privgit.com: Try again
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Why is this important to you?

a way to mount config files like ~/.gitconfig or ~/.ssh/config for dagger functions or any related dagger cli commands to use dagger "privately"

How are you currently working around this?

No response

Activity

  1. raghavendramallela commented on Oct 29, 2024

    @raghavendramallela
    Author

    if _EXPERIMENTAL_DAGGER_RUNNER_HOST uses proxy vars like http_proxy or https_proxy ,
    can dagger engine add git config --global https.proxy='http://proxyserver.com:443' for dagger functions or any related dagger engine "git" calls?

  2. marcosnils commented on Oct 29, 2024

    @marcosnils
    Contributor

    The only supported mechanism to use private modules is via ssh agent currently. More information can be found here: https://docs.dagger.io/api/remote-modules/#configuring-ssh-authentication

    Having said that, PAT support will also be landing soon.
    #8805

    Let us know if you have other questions 👐

  3. grouville commented on Oct 29, 2024

    @grouville
    Member

    Related comment from @raghavendramallela #8805 (comment). It seems that the git.tags() does not resolve the HTTPS_PROXY env var, even when added to the engine 👀

    As a side question: introducing an automatic dependency on the .gitconfig is something to be discussed, as it breaks the local / ci agnosticity ; but if you're ok to have your own engine with such params mounted inside, I don't see any issue.

    It seems to be, indeed, a bug on our end

  4. changed the title [-]✨ <title>load private modules via mounting git config or ssh config[/-] [+]✨ load private modules via mounting git config or ssh config[/+] on Oct 31, 2024
  5. raghavendramallela commented on Oct 31, 2024

    @raghavendramallela
    Author

    Related comment from @raghavendramallela #8805 (comment). It seems that the git.tags() does not resolve the HTTPS_PROXY env var, even when added to the engine 👀

    As a side question: introducing an automatic dependency on the .gitconfig is something to be discussed, as it breaks the local / ci agnosticity ; but if you're ok to have your own engine with such params mounted inside, I don't see any issue.

    It seems to be, indeed, a bug on our end

    This issue is related to proxy & using HTTPS_PROXY should be fine IMO,
    but if user want to configure how git is used for engine, using .gitconfig dependency will be good option.

  6. self-assigned this
    on Nov 7, 2024
  7. deleted a comment from pspurlock on Nov 18, 2024
  8. deleted a comment from pspurlock on Nov 18, 2024
  9. deleted a comment from pspurlock on Nov 18, 2024
  10. grouville commented on Nov 20, 2024

    @grouville
    Member

    Might be fixed by #9007, if I understood it properly

  11. rajatjindal commented on Jan 3, 2025

    @rajatjindal
    Contributor

    me and Marcos just had a sync regarding what we can do here. Here is what I will be trying out:

    • implement an attachable that gets "effective gitconfig of the user"
    • that attachable will read only a "safelisted" set of keys to start with (this is still under consideration to avoid breaking something else by importing some gitconfig that works only on user's system. We may decide to import everything or change the list based on feedback.)
    • find all the "replace https with ssh" entries. find all the hostnames
    • automatically create a GOPRIVATE env variable with those hostnames entries
    • and after the ^^ we should have this working.

    I think this should fix private deps for atleast Rust/Golang/Javascript, but I will try these (and other sdks) to verify the gaps once I have the attachable working.

  12. jedevc commented on Mar 18, 2025

    @jedevc
    Contributor

    This feels like a duplicate of #8766, so going to close this one out.

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

Metadata

Metadata

Assignees

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