#Exclude files from host fs via CLI

1 messages · Page 1 of 1 (latest)

violet mulch
#

With the new Go SDK that doesn't include .Host(), I can't figure out how to only upload a subset of a directory when passed via the CLI?

I'd like to be able to say call my-function --root=. and be able to exclude certain files. It doesn't appear that e.g. .gitignore is respected, and inside the function it's too late as they've already been uploaded as far as I can tell.

Is there a way to do this with Dagger v0.10?

loud pasture
#

If you're adventurous, you can build a dev client from that PR and try it out.

violet mulch
#

That would work, thanks! It would also be nice to do it programmatically inside the function itself, but maybe that won't work architecturally?

loud pasture
#

You may still do away with a simple src.WithoutDirectory(".direnv") for example.

violet mulch
#

The use case I have in mind is I have a monorepo with a bunch of rust crates, and the rust workspace definition lives in the repo root and needs to be uploaded, but if I include the repo root it will also pull in the target directory which is several GBs

#

But it would be easier to know which directories I need programatically than having to maintain it in dagger.json

loud pasture
#

Are you able to put the dagger.json in the root of the repo, or do you have several modules competing for that?

violet mulch
#

I currently have it in the repo root yeah

#

(Is that also contributing to the "Module Source" step taking quite long?)

loud pasture
#

Ok, so you can "exclude" the target directory and any other rules in dagger.json. What do you get with the programatic approach?

loud pasture
violet mulch
#

Ah, nice. I was looking for a schema definition of dagger.json but couldn't find one, so I couldn't figure out what functionality was supported in dagger.json

#

Maybe it's documented somewhere but I couldn't find it

loud pasture
#

I'll get it for you. Give me a sec.

#

I went looking for the "exclude" thing in the docs, but seems we don't have any.

violet mulch
#

Ah great, thank you!

loud pasture
#

That's only temporary. As you can see only "include" and "exclude" need to be udpated manually. The plan is to always use the CLI to manage the dagger.json file. The PR I linked to in the beginning is going to make that possible.