Skip to content
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

Ability to run ruby_bundle without gemfile_lock attribute #129

Open
mvgijssel opened this issue Apr 10, 2022 · 2 comments
Open

Ability to run ruby_bundle without gemfile_lock attribute #129

mvgijssel opened this issue Apr 10, 2022 · 2 comments

Comments

@mvgijssel
Copy link

Currently when running a ruby_bundle without the gemfile_lock attribute results in the following error

ERROR: An error occurred during the fetch of repository 'vagrant_bundle':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_maarten/8c4bfcd606c4d7b95cf418885251b08c/external/bazelruby_rules_ruby/ruby/private/bundle/def.bzl", line 198, column 28, in _ruby_bundle_impl
		result = bundle_install(runtime_ctx, result)
	File "/private/var/tmp/_bazel_maarten/8c4bfcd606c4d7b95cf418885251b08c/external/bazelruby_rules_ruby/ruby/private/bundle/def.bzl", line 138, column 13, in bundle_install
		fail("bundle install failed: %s%s" % (result.stdout, result.stderr))
Error in fail: bundle install failed: The deployment setting requires a Gemfile.lock. Please make sure you have
checked your Gemfile.lock into version control before deploying

The documentation (https://github.com/bazelruby/rules_ruby#54-ruby_bundle) suggests that it's possible to run ruby_bundle without passing the gemfile_lock attribute. This is backed-up by the conditional in the code which checks for the presence of the gemfile_lock attribute https://github.com/bazelruby/rules_ruby/blob/master/ruby/private/bundle/def.bzl#L125-L126.

The problem is that the set_bundler_config hardcodes the deployment and frozen settings to true (https://github.com/bazelruby/rules_ruby/blob/master/ruby/private/bundle/def.bzl#L56-L58) which enforces that any bundle install command requires a Gemfile.lock file.

Disabling these settings as follows seems to help in the case of no Gemfile.lock:

    bundler_config = {
        # "deployment": "false",
        "standalone": "true",
        "force": "false",
        "redownload": "false",
        # "frozen": "true",
        "path": BUNDLE_PATH,
        "jobs": "20",
        "shebang": runtime_ctx.interpreter,
    }
@kigster
Copy link
Contributor

kigster commented May 12, 2022

I can't remember why we added these bundler settings but perhaps it's so that the bundle can be vendored?

If you can investigate the implications of not putting deployment into bundle config I could be convinced to drop that.

@kigster
Copy link
Contributor

kigster commented May 10, 2023

Looking for additional core maintainers: #146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants