-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
git clone vs downloading zip #180
Comments
according to CocoaPods/CocoaPods#4989 (comment) and CocoaPods/CocoaPods#4989 (comment) doing
FYI, mentioned issue has been resolved by removing |
Thanks for the response. If the solution for github load is to remove |
Cocoapods was special because it cloned a single repository every single time. Shards doesn't do that, every single shard is in its own repository. We'd need to put in special logic to handle github if we wanted to do this, and currently we don't have that. We rely on a local git heck out and actually perform full git operations on the repo such as listing tags and checking out multiple tags. For this reason we need a full clone unless we also use the github api to replace this. So this is neither simple or neccesary I think. |
We could specialise the GitHub resolver, but we should verify that it's actually faster. Having to request the Git server for tags, for each If I remember correctly, Bower doesnt specialise for GitHub but checks for a "smart" Git server and clones at Maybe |
Looking deeper into the CocoaPods issue, there are a couple things we could do to improve the situation:
|
I don't think we should overcomplicate shards with too much optimizations. I'd go for a central repository index first in (2) is still pretty easy, just a simple API call, but it is github-specific. So i'd leave that off for now. (3) I don't think we should ever implement unless github communicates with us that we're causing excessive load. |
Point 2. is a mere method overload to call super or not. I expect the HTTP call to be faster than a Git fetch. Let's be honest: 99% of shards are hosted on GitHub and will benefit from it, so we should implement it. |
Surely you need to match the git url to github? |
No I mean an overload in https://github.com/crystal-lang/shards/blob/master/src/resolvers/github.cr |
Seems slightly unexpected that it'd work for the |
I wanted to add an example of where this would be extremely helpful - mostly if any shard creator or maintainer accidentally forgets to gitignore something early in the project, then the git clone is stuck with that forever (unless git history is re-written or deleted). One example shard, doing a git clone was downloading 30+ MB
EDIT : I realized that with a global cache, there will be cache hits. With containers and when running tests on travis, those containers may have an empty global cache to start. |
Global cache is now available on the master branch, and should be alongside crystal's cache. You may customize it with |
Global Cache should help a lot. One issue for people using github is that every branch/fork/pr that's ever existed remains in github repo's and can't be deleted or modified. This means that when using |
Shards needs all refs, because versions are tags and we can install any refs (branch, tag, commit). But maybe my understanding is wrong and |
Worst case it could just try to fetch the specified ref and see if that works, no? |
Even with a simple clone should be sufficient to switch to tags. @jhass your suggestion sounds good to me. |
@ysbaddaden Thanks you so much for local cache feature! 🎉 Now I can install amber project dependencies faster:
We put a lot effort trying to reduce amber repo size, but
I think we can use
|
Maybe this could be as simple as adding a flag like |
@ysbaddaden Do you think we can add an optional |
If |
Done in 3a64a76. Tests are passing in local. Please try, but make sure to drop |
@ysbaddaden I tested master and works fine, I tried installing different shards versions and all is working ok. Also Before:
After: (master)
|
Another use case for ability to download package instead of cloning shard repo is to support fast containers, such as Alpine Linux containers.
|
@vtambourine I know the following comments does not provide a solution to your request, but you can take advantage of multiple Something similar to what Brian posted here: https://manas.tech/blog/2017/04/03/shipping-crystal-apps-in-a-small-docker-image.html And the repository: https://github.com/bcardiff/miniserver Hope that helps. Cheers. |
Thank you, @luislavena, that is really helpful! However, I really think Apline builds should also be quite useful. |
Closing. Both |
It seems that
shards
does a clone of the project vs just downloading the the relevant code for tag or branch. Wouldn't it be more efficient for both us and github to just download the required shard as a zip or tar.gz?curl -OL https://github.com/amberframework/amber/archive/v0.3.0.tar.gz
There were issues related to this with CocoaPods using github in this fashion a while back.
https://news.ycombinator.com/item?id=11245652
The text was updated successfully, but these errors were encountered: