-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to overlap .gitignore setting #1190
Comments
This is mentioned here in the docs: https://docs.garden.io/using-garden/configuration-files#including-excluding-files-and-directories By default, we respect both kind: Project
name: my-project
dotIgnoreFiles: [.gardenignore] Then you can add files you do want to ignore in a separate |
Thank you for the solution, but it does not helps. Just nothing changes. Maybe, the problem root is in the folder structure? in the real world example it is
There is a few services in At this moment it looks like in the background garden use |
Maybe, my explanation is clumsy. Just add some bash, which may be handy: $ garden scan
✔ providers → Getting status... → Done
modules: []
$ cd core
$ mv .git .git_backup
$ cd ..
$ garden scan
✔ providers → Getting status... → Done
modules:
- allowPublish: true
apiVersion: garden.io/v0
build:
dependencies: []
configPath: /Users/mike/proj/replay/infrastructure/development/core/garden.yaml
description: Image for poker-core
kind: Module
name: poker-core
outputs:
deployment-image-name: poker-core
local-image-name: poker-core
path: /Users/mike/proj/replay/infrastructure/development/core
serviceConfigs: []
taskConfigs: []
...
|
Ah, now I understand (I think). You have submodules in your repo, right? There is a known issue for that: #1097. I'll be working on that soon. We do support remote repositories however, so until the issue is resolved, you could explicitly point at those repos in your project config, as per this guide: https://docs.garden.io/using-garden/using-remote-sources |
Thank you, @edvald , it may be a solution. Will try it a bit later and give back the feedback a bit later. And I feel, that I understood the roop of the problem here. Garden calculates the files for |
It's a little tricky to get all this right, and so that it behaves how people expect it to in all/most situations. We do use git for resolution of files, for a number of good reasons, and I'd argue that it would in many cases be unexpected for I'd say the real issue is that we're currently not supporting submodules properly, which is something we definitely need to resolve, as well as to document any potential caveats. |
It's totally ok to use the same semantics. And it means that I described myself earlier not quite clear, sorry about that. Garden also use It is the case when you do not use |
Just to explain a little: We still only scope .ignore files within repos, but include/exclude fields work across those boundaries. This is to stay in line with standard Git behavior, and also because other options would have been prohibitively complex to implement. Making special cases for different types of ignore files felt confusing to explain, so I went with something reasonably straightforward. Check the added section here: https://docs.garden.io/using-garden/configuration-files#git-submodules |
Just some additions from my side:
With this structure i can not just
|
Thanks for clarifying, I took the fact you had a nested git repository to mean you had submodules. I can in turn clarify how we do our file scanning. Basically we always use git to scan for files. Git is a declared dependency of Garden, and Garden will fail to start if you don't have it. This is done for performance reasons, as well as to natively support .ignore files, including how they deal with multiple levels of ignore files (which is, turns out, the complicated part). This means that we factor in .ignore files first, and then we apply include/exclude filters. This is mentioned in our docs, and is by design. So when you set e.g. I hope that's more clear. Regarding your project structure, you do currently need to have the project config higher in your tree than your module configs, or at the same level. This was also a design choice, so that Garden can easily scan to find your project config, and have sane defaults as to where to look for files. Similar to many or most package managers etc. That said, we can still look into allowing configuring relative paths outside of a config directory, but we'd need to make sure the paths are still within the same repository, and we could not allow it for all such fields because it could trigger cascading edge-cases to support. But I get where you're coming from :) |
Thank you @edvald for a such a quick and full response. This limitation wire the hands for the projects with multiple repositories, since on one hand i should have the project level config on the top (where it was all the time), on the other hand i can not put another projects in the sub-directories under the project level config (moving all services in 1 repo is not applicable for my case) since each of them has own get repository. I'm looking forward for adjusting the workflow process for the tool, but at this moment this case does not have the solution. At this moment I may only ask to share this limitation in the docs with required project (repo) structure, since it may save time for other developers. |
I'm still not quite sure I understand your overall layout, and why it's hard to accommodate, but it seems you've tried a lot of different options. I expect you tried the remote sources features (https://docs.garden.io/using-garden/using-remote-sources), which on the surface would seem to be more geared towards your setup, but I gather that also didn't work out? |
Yes, i tried it already. That gave the ability to start the service, but #1205. So does not actually works, plus lack of hot reload even for tests (since Garden does not detect the service as started). |
Understood. We'll fix #1205 for sure, I figure that'll be a blocker either way. But the shallow Git clone only applies if you don't use |
Thank you for such a great support! Will be happy to try out this approach later. |
Bug
I can not manually include garden.yaml, when the project has own
.git
.simplified folders structure
where
core
is excluded from git.If try the same config with out
.git
folder in the projects-garden scan
founds the configuration file.Current Behavior
Additional context
I tried to put it in another folder, which is not in
.gitignore
and with out own git repo, but it produced:$ garden scan Error validating module poker-core (support/core/garden.yml): key .dockerfile must be a relative sub-path (may not contain '..' segments or be an absolute path)
For me it is a blocker now.
Your environment
garden version
0.10.9
kubectl version
1.15.2
docker version
2.1.0.2
The text was updated successfully, but these errors were encountered: