-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
skaffold cloudbuild ignores gitignore #1998
Comments
Hey, thanks for filing this issue!
So. To reduce the size, I would recommend using .dockerignore. You are using npm install anyway in your Dockerfile that gets the dependencies during build. |
Thanks for your answer. I did add a dockerignore file. IMHO if the skaffold tool is going to support cloudbuild It should use the .gitignore file as this is used when doing gcloud build submit and it is easier to adapt your code to use this tool. Just a suggestion. |
@panitaxx To me it would feel like an abuse of The node examples in the Skaffold repo all contain a |
I feel is more something of developer experience. If I am using cloudbuild and it uses gitignore and dockerignore then when I incorporate to my workflow skaffold I expect cloudbuild in skaffold to work like cloudbuild outside skaffold. Also it would be maintaining another file with little differences (like dockerignore most of the time has to add .git). |
After reading the docs of gcloud build submit (they are a little bit confusing), it seems gcloud builds submit uses a default .gcloudignore that includes the .gitignore contents in the build, therefore in a transient way respecting .gitignore. I also made a small test to prove this. So in the DX aspect is the same if you add something to .gitignore it will be ignored by gcloud build submit command but not by skaffold. Also tested and gcloud build does not respect .dockerignore. |
Thanks @panitaxx. We were not aware Thanks |
Ok give a couple of a days. This is my first PR ever. |
Looking forward to it! |
I'm not sure if we actually want to add support for this -- |
Thanks @priyawadhwa. Makes sense what you just mentioned. |
I guess it's just a little programmer's laziness and the fact that you would have to maintain two very similar files (plus the whole skaffold setup). It's no biggie. Maybe it should be explained in the docs only? |
Definitely think it should be clarified in the docs. Would you be open to submitting a PR @panitaxx? |
yes. will do. |
Expected behavior
Cloudbuild builds should files in ignore .gitignore
Actual behavior
It uploads .git and uploads node_modules.
Sometime they are ignored sometimes they aren't. I have another project with same .gitignore and no .dockerignore file in which .git and node_modules dirs are not uploaded. I provided a sample repo in which everything is ignore notwithstanding the contents of .gitignore.
Information
Steps to reproduce the behavior
This may not be an issue with small projects, but I have here a project with >1000 packages in node_modules and almost 150mb in .git and is very slow to upload.
The text was updated successfully, but these errors were encountered: