#how do i clone a repo from a local file on linux using the go sdk?
1 messages · Page 1 of 1 (latest)
Ah 😢
This is not currently supported sadly 😦
I really want to have something kind of like this, that would be client.Directory("./path/to/.git").AsGit().Branch("main").Tree()
We would probably have that instead of a file:// protocol, since it's unclear where the file:// should come from (and it should be able to come from an arbitrary directory, not just the host)
But as mentioned, not currently supported - if you have a use case though, would definitely be interested in a feature request issue 🎉
Oh thank you for the fast reply ! the use case i have is to basically avoid commiting and pushing again and again just so i can test my ci locally. The repo that is doing my release build using dagger is searate repo that does all the CIs for about three projects. Is that something that could be supported ? or there is a work around (beside splitting all the ci code in each project ) ?
are you using dagger functions? if you don't need a Git input, you could have your main CI function that takes a Directory, and then pass each of your 3 projects in to there
note, with the cli, you can pass in a git repo as a directory
so --my-dir=https://github.com/dagger/dagger.git would totally work
i am not using functions yet. only the go sdk directly
also i am trying to do the git checkout as part of the build workflow
aha! then it's a bit more tricky - you could just have a conditional that tries to parse an input string repo, and tries to either load it as a Directory or a Git repo depending on the format
dagger functions definitely would help simplify that (it does that step automatically)
got it ... but how do i do the actual checkout using dagger from the release repo ?
i have 4 repos {a,b,c} and a bld repo to build them all and tag them
if you're using git checkout outside of dagger, then you need to load the repos using a Directory, something like client.Host.Directory
if you want dagger to do it, you can load them directly using client.Git
exact .. so this is my use case. being able to use client.Git when i am testing locally ... if i am working o repo a and i want to check if it will pass the release build i have to commit a and push it
as you said client.Git does not take a file based git repo url ... i was trying to explain my usecase
yes, but what you can do is you can conditionally choose to load a directory or a git repo depending on the setup
something like:
if gitrepo != nil {
dir = gitrepo.Branch("main").Tree()
} else {
dir = gitdir
}