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

bug: rbenv: no such command `install' #1671

Closed
aerickson opened this issue Oct 29, 2020 · 11 comments · Fixed by #1672
Closed

bug: rbenv: no such command `install' #1671

aerickson opened this issue Oct 29, 2020 · 11 comments · Fixed by #1672

Comments

@aerickson
Copy link

aerickson commented Oct 29, 2020

fails: https://travis-ci.com/github/mozilla-platform-ops/ronin_puppet/jobs/420816191
passes: https://travis-ci.com/github/mozilla-platform-ops/ronin_puppet/jobs/420881311

The difference in the failing job is pre-commit 2.8.1 (passing is using 2.7.1). It seems similar to https://stackoverflow.com/questions/17618113/the-command-rbenv-install-is-missing... perhaps Travis doesn't include that particular bit.

failure log snippet:

$ pre-commit run --all-files

[INFO] Installing environment for https://github.com/chriskuehl/puppet-pre-commit-hooks.git.

[INFO] Once installed this environment will be reused.

[INFO] This may take a few minutes...

An unexpected error has occurred: CalledProcessError: command: ('/bin/bash', '/home/travis/.cache/pre-commit/repoz146d2mg/rbenv-default/bin/rbenv', 'install', 'default')

return code: 1

expected return code: 0

stdout: (none)

stderr:

    rbenv: no such command `install'

    

Check the log at /home/travis/.cache/pre-commit/pre-commit.log
@aerickson aerickson changed the title bug/regression between 2.7.1 and 2.8.1 bug: rbenv: no such command `install' Oct 29, 2020
@asottile
Copy link
Member

this means there isn't a suitable ruby executable on the system

the logic changed a bit in 2.8.0: these two paths need to be available, not /shims/, and not in the home directory: gem, ruby

could you show which ruby and which gem?

@asottile
Copy link
Member

you can work around this by setting language_version either to system or to a specific version

@asottile
Copy link
Member

the error message from rbenv is just bad here by the way, ruby build is there but for some reason rbenv install default causes it to produce a strange error message

@asottile
Copy link
Member

another thing you may want to try (if you're interested in early alpha) is https://results.pre-commit.ci (more information here: https://pre-commit.ci)

@aerickson
Copy link
Author

$ which ruby; which gem

/home/travis/.rvm/rubies/ruby-2.6.6/bin/ruby

/home/travis/.rvm/rubies/ruby-2.6.6/bin/gem

@asottile
Copy link
Member

yep that makes sense then, those will now be detected as "shim" executables and skipped since they're in the home directory -- that was #1658 / #1668

@aerickson
Copy link
Author

aerickson commented Oct 30, 2020

I don't really want all users to use language_version: system (just Travis). It's painful to have to set it for each hook (we currently have 11). Is there a way of doing this globally?

What was the behavior in pre-2.8.0? Why the new requirement?

I'll check out the new service. Thanks :)

@asottile
Copy link
Member

you can use

default_language_version:
    ruby: system

I think I might partially revert such that default still attempts system since that has some chance of succeeding 🤔

@asottile
Copy link
Member

oh I see, there is a subtle difference from #1509

the code used to call _install_ruby(...) only if version was not C.DEFAULT -- now it calls it if it's not system

let me change that and see if it makes it better

@asottile
Copy link
Member

would you like to try out the patch in #1672?

@aerickson
Copy link
Author

Success!

test results: https://travis-ci.com/github/mozilla-platform-ops/ronin_puppet/jobs/422091909
test change to install the pip at the mentioned PR commit: mozilla-platform-ops/ronin_puppet@0e2809d

Thanks for working on this. :)

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

Successfully merging a pull request may close this issue.

2 participants