-
Notifications
You must be signed in to change notification settings - Fork 681
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
Updated omnibus postinst
script to symlink to appbundle created binstubs
#2732
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 looks like a fine change, and matches what we do in other projects (see https://github.com/chef/chef/blob/master/omnibus/package-scripts/chef/postinst#L14 for example).
For consistency with other projects, I'd like to see the var name stay the same. Also, before we approve and proceed, have we done an ad-hoc Jenkins build from this branch and tested the resulting package on macOS and one other OS (such as Ubuntu) just to make sure this succeeds?
Another thing to think about (outside of this PR) is a change to the Jenkins "test" job to do a GEM_HOME=/nonexistent/path GEM_PATH=/nonexistent/path /usr/local/bin/inspec version
or whatever the symlink path is to ensure the package works properly.
@@ -5,7 +5,7 @@ | |||
# | |||
|
|||
PROGNAME=`basename $0` | |||
INSTALLER_DIR=/opt/inspec/embedded |
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.
To keep this consistent with other omnibus projects, I would leave this as INSTALLER_DIR
and just change the value to /opt/inspec
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.
Thanks for the feedback @adamleff =)
rather than rubygems binstubs in embedded directory. The rubygems binstubs do not account for GEM_HOME or GEM_PATHS existing in the invoking shell. This creates problems on systems with multiple ruby versions. If GEM_HOME or GEM_PATH is set the rubygems embedded binstubs will attempt to use this external gem source which will generally result in errors for the user. Signed-off-by: Miah Johnson <[email protected]>
Excellent comment about Jenkins test as well, I'll add one! |
Jenkins to verify the appbundler shim is working correctly. Signed-off-by: Miah Johnson <[email protected]>
I added two scripts to this PR which will be called by Jenkins during the verify stage. |
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.
Looks good to me. Great work @miah!
@adamleff What do you think friend? =) |
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 dig it!
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.
Thanks @miah !
that inspec is functional. #2732 Signed-off-by: Miah Johnson <[email protected]>
…ify (#3038) that inspec is functional. #2732 Signed-off-by: Miah Johnson <[email protected]>
The binstubs created by rubygems, and linked to by our omnibus postinst script error when they encounter GEM_HOME or GEM_PATH set to anything outside of the
/opt/inspec/embedded
directory.On my laptop with chruby the environment variables GEM_HOME and GEM_PATH are set when I create a new shell. When I invoke InSpec via
/usr/local/bin/inspec
or/opt/inspec/embedded/bin/inspec
I get the following error:This error persists until I
unset GEM_HOME
andunset GEM_PATH
.The inspec binstub created by appbundler correctly deals with GEM_HOME and GEM_PATH.
Because our omnibus package already uses appbundler, the fix is to change our symlink to use it rather than the rubygems binstub.
This problem exists in older 1.x packaged releases as well.
Fixes #2727