containerbuildsystem / cachi2

GNU General Public License v3.0
5 stars 20 forks source link

cachi2 rubygems / bundler design #565

Open slimreaper35 opened 2 weeks ago

slimreaper35 commented 2 weeks ago

Maintainers will complete the following section

Note: if the contribution is external (not from an organization member), the CI pipeline will not run automatically. After verifying that the CI is safe to run:

brunoapimentel commented 1 day ago

I noticed that it is necessary to add --local to the bundle install in order to successfully perform a offline install. The problem is, this is something we can't really solve just by injecting project files or source env variables.

This would force the user to modify his Dockerfile, which is still something we don't require with Cachi2. I wonder if there's a way to work around that.

brunoapimentel commented 1 day ago

I did a small test trying to build Porta with this PoC here (while disabling the Yarn deps :see_no_evil:).

The prefetch was successful, but the build failed because it was trying to reach out to the Internet to grab the git dependencies. Were you able to successfully prefetch and build any project that has git deps? I think we should enhance our cachi2-rubygems repo to include at least one git dep.

slimreaper35 commented 1 day ago

The prefetch was successful, but the build failed because it was trying to reach out to the Internet to grab the git dependencies.

I know; that was copied from cachito. Git dependencies must have this format (I did not implement it in the PoC): https://github.com/containerbuildsystem/cachi2/pull/565/files#diff-cf42ff83f7bd882bd043479db1ad05961c5ef7218a816f2640347dd50c08fec8R193

EDIT:

I wonder if there's a way to work around that.

I tried to set export BUNDLE_ALLOW_OFFLINE_INSTALL=true and remove --local, but it ain't work. I found this workaround => commenting out source "https://rubygems.org" in Gemfilem, but I see a deprecation warning.

brunoapimentel commented 13 hours ago

I tried to set export BUNDLE_ALLOW_OFFLINE_INSTALL=true and remove --local, but it ain't work. I found this workaround => commenting out source "https://rubygems.org" in Gemfilem, but I see a deprecation warning.

The deprecation warning worries me a little. Also, the official docs seem to indicate that this is a required setting. In any case, I think we can add it as an option in the design doc and leave it up for discussion.

I wonder if turning all dependencies into path dependencies would work? This is a much more invasive change, and I would not like to turn to it, though.

I also noticed that --prefer-local seems to always try to reach out for the internet, although the docs say otherwise. It could be a less invasive change to the Dockerfile, in case it worked.

brunoapimentel commented 12 hours ago

I know; that was copied from cachito. Git dependencies must have this format (I did not implement it in the PoC): https://github.com/containerbuildsystem/cachi2/pull/565/files#diff-cf42ff83f7bd882bd043479db1ad05961c5ef7218a816f2640347dd50c08fec8R193

Oh, I also did a small test with a git dependency and I was able to build the image. The thing that was not clear to me immediatelly was that the repository files need to be unpacked in a folder following the naming format you mentinoned.

Since what the prefetch does is to download a tarball of the repo+ref, it took me some time to figure it out. Maybe we can add a note in the design doc about this?