-
Notifications
You must be signed in to change notification settings - Fork 44
Making bundler respect hermetic requirement #733
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
Making bundler respect hermetic requirement #733
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach seems to be the only one that makes bundler stop accessing the internet with git dependencies, regardless of any extra env variables used sadly.
While at it, I think this effort should also contain the following changes:
- enforce
BUNDLE_ALLOW_OFFLINE_INSTALL- didn't do anything for git deps, but seems very relevant to our use case in general - enforce
BUNDLE_DISABLE_VERSION_CHECK- I've encountered different bundler behaviour with different versions and older versions were particularly stubborn trying to check the latest version of bundler online, sometimes it was a hard failure, sometimes bundler ignored it and proceeded further where it failed on the build - enforce
BUNDLE_DISABLE_LOCAL_REVISION_CHECK- it has a similar function to yourBUNDLE_DISABLE_LOCAL_BRANCH_CHECK - stop enforcing
BUNDLE_DEPLOYMENT- this is a user's choice for how they wish to distributed their built app which we don't control and should not try doing; it's essentially a way of vendoring one's app which is not our business. Moreover, it doesn't seem to have any effect on the offline install per se
tests/integration/test_data/bundler_everything_present_except_gemspec/.build-config.yaml
Show resolved
Hide resolved
00c7df6 to
457eae2
Compare
eskultety
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see BUNDLE_DEPLOYMENT being dropped anywhere in any commit. I also think that commit 2 and 3's order should be swapped (first make changes, the lift the restriction). Anyway, I think this is no longer a WIP material :).
I wonder whether I just forgot that I had However, I'm still not a fan of forcing our users to do vendoring, although we do document it here: https://github.com/containerbuildsystem/cachi2/blob/main/docs/bundler.md#bundle_deployment. I am not sure if people are able to connect the dots given the extremely copy-paste (from the docs) explanation of the flag. It is only after further digging in the docs/blogs or read the definition That all said, the deployment conundrum made spend some more unplanned time on this figuring out what is bundler unhappy about: for all dependencies. So I did run deployment to see what the vendor directory hierarchy looks like and tried copying over just the That didn't get bundler any further as it still complained about missing definitions. I think it could be solved by forcing the Ruby platform in the build, making some deps to be recompiled during the build as a side effect, however, that requires changes to the lockfile, so it's out of question/reach. Compiling the extensions ourselves is also out of question because we don't know the target architecture. In summary, unpacking the gems and creating an extra directory hierarchy by us for bundler to consult to find gem specs before consulting the internet isn't a general enough solution, so this whole process made me accept the fact that we may not have another choice but to keep using That said, I think the user-facing docs could be improved on that front and also that we could extend our CLI input JSON such that we could set the install path for the user in order for them to avoid making undesirable manual cachi2-only changes to their Dockerfiles. |
|
FWIW I just opened ruby/rubygems#8265 to request the |
eskultety
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One commit msg nitpick and I still believe commits 2 and 3 should be swapped. With that addressed -> ACK.
a4c3ae6 to
1ca23fb
Compare
eskultety
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-ovchinnikov Sorry for a late notice, I know you have 2 ACKs, but I just noticed something in the design doc which we should IMO fix here, it's a trivial change, see my comment.
Disregard, it's better I'll do that in my docs patches which I'll rebase onto this work, so re-approving, sorry for the noise. |
1ca23fb to
d85a9ee
Compare
It turned out that due to a yet unknown change somewhere in the ecosystem bundler started ignoring instructions to not access the web during a build when a git dependency was present. This change adds a workaround that explicitly forbids consulting remotes for branches and references and also pins a path to local repository in a config. Signed-off-by: Alexey Ovchinnikov <aovchinn@redhat.com>
This change adds BUNDLE_ALLOW_OFFLINE_INSTALL BUNDLE_DISABLE_VERSION_CHECK to flags to make it less likely that bundler would try accessing the web while performing a hermetic build. Signed-off-by: Alexey Ovchinnikov <aovchinn@redhat.com>
This reverts commit cea5779. Signed-off-by: Alexey Ovchinnikov <aovchinn@redhat.com>
d85a9ee to
d061c72
Compare
It turned out that due to a yet unknown change somewhere
in the ecosystem bundler started ignoring instructions
to not access the web during a build when a git dependency
was present.
This change adds a workaround that explicitly forbids
consulting remotes for branches and references and also
pins a path to local repository in a config.
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:
/ok-to-test(as is the standard for Pipelines as Code)