Skip to content

Unable to run script provided by installed gem #213

@pfaffle

Description

@pfaffle

I have automation which runs in a Jenkins pipeline which uses the Ruby Docker container as the execution environment. Just last night, a job started failing because it was unable to find a script that is provided by a gem that I install as part of the job.

It seems the scripts are landing in /usr/local/bundle/bin, but that directory is not on my path.

I'm using the ruby:2.4 image. Below is some output from me reproducing the error on my local workstation and poking around at the environment and filesystem in the container:

docker run -it ruby:2.4 /bin/bash

root@9822526cb6fb:/#
root@9822526cb6fb:/# gem install tw-vsphere --source [my_local_repo]
Fetching: builder-3.2.3.gem (100%)
Successfully installed builder-3.2.3
Fetching: mini_portile2-2.3.0.gem (100%)
Successfully installed mini_portile2-2.3.0
Fetching: nokogiri-1.8.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.8.2
Fetching: trollop-2.1.2.gem (100%)
Successfully installed trollop-2.1.2
Fetching: rbvmomi-1.12.0.gem (100%)
Successfully installed rbvmomi-1.12.0
Fetching: tw-vsphere-0.1.7.gem (100%)
Successfully installed tw-vsphere-0.1.7
6 gems installed
root@9822526cb6fb:/# reap_expired_vms
bash: reap_expired_vms: command not found
root@9822526cb6fb:/# echo $PATH
/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root@9822526cb6fb:/# env
RUBYGEMS_VERSION=2.7.7
BUNDLER_VERSION=1.16.2
HOSTNAME=9822526cb6fb
RUBY_VERSION=2.4.4
GEM_HOME=/usr/local/bundle
PWD=/
HOME=/root
BUNDLE_PATH=/usr/local/bundle
BUNDLE_APP_CONFIG=/usr/local/bundle
TERM=xterm
BUNDLE_SILENCE_ROOT_WARNING=1
RUBY_MAJOR=2.4
BUNDLE_BIN=/usr/local/bundle/bin
SHLVL=1
RUBY_DOWNLOAD_SHA256=1d0034071d675193ca769f64c91827e5f54cb3a7962316a41d5217c7bc6949f0
PATH=/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
root@9822526cb6fb:/# ls /usr/local/bundle/gems/bin
ls: cannot access '/usr/local/bundle/gems/bin': No such file or directory
root@9822526cb6fb:/# ls /usr/local/bundle/gems/
builder-3.2.3  mini_portile2-2.3.0  nokogiri-1.8.2  rbvmomi-1.12.0  trollop-2.1.2  tw-vsphere-0.1.7
root@9822526cb6fb:/# ls /usr/local/bundle/bin
nokogiri  rbvmomish  reap_expired_vms  reap_vms_owned_by
root@9822526cb6fb:/#

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions