-
Notifications
You must be signed in to change notification settings - Fork 112
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
Manually building and installing docker-api gem #1122
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Copyright 2012-2020 Chef Software, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
name "docker-api" | ||
default_version "master" | ||
|
||
source git: "https://github.com/chef/docker-api.git" | ||
|
||
license "MIT" | ||
license_file "https://github.com/raw/chef/docker-api/master/LICENSE" | ||
|
||
dependency "ruby" | ||
|
||
build do | ||
env = with_standard_compiler_flags(with_embedded_path) | ||
|
||
# docker-api does not have any unique dependencies not already | ||
# included in Chef Workstation. We let the master gem bundle | ||
# install those gems. If we ever add custom dependencies into | ||
# our fork we need to re-add bundle install here for make the | ||
# gemfile pull from the fork and don't build here. | ||
# bundle "install", env: env | ||
gem "build docker-api.gemspec", env: env | ||
gem "install docker-api-*.gem --no-document --ignore-dependencies", env: env | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lamont-granquist I know that doing a |
||
end |
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.
The client uses the ohai software definition to install ohai from git.
If you're installing from git it gets installed into the bundler gitsha'd directory and not into the proper location where normal rubygems can see it. Bundler sees it is from a git source and therefore untrusted so refuses to pollute your prestine set of gems from rubygems with that prerelease gem. That later gets cleaned up by the omnibus ruby cleanup scripts, but it never would have worked anyway.
So this is the right thing to do for git sources.
IMO this is screaming out that we need to either:
fork it to chef-docker-api gem, fully take it over, and release it to rubygems.
stop using the ruby API entirely and shell out to the docker command line.
I am mostly in favor of #2 (up until it is shown that the docker command line API is as big of a tirefire as dnf/yum or ruby is anyway). Until its shown that the CLI there is painfully slow, the benefits of a ruby library solution over shelling out to the command line are mostly philosophical rather than practical. The practical matter is that it ties you to that API gem being updated properly which is the net-ssh problem all over again.
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.
We also have to do this, but as long as you're not pushing anything to the docker-api gem the version in the Gemfile.lock that appbundler reads and the master version here shouldn't differ so you shouldn't need it. But if you're actively developing in the docker-api gem you'll need this as well:
https://github.com/chef/chef/blob/master/omnibus_overrides.rb#L27-L33
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.
Again, this is due to bundler and that stupid directory it installs git gems into. The
gem build; gem install
workaround is correct since that sends the gem into the right lib location. The problem is that may also pull all kinds of duplicated gems into the shipping artifact depending on the pins in the Gemfile.lock -- if you have any dependent gems in docker-api which are held back by other pins (e.g. inspec) that is how you get duplicated gems.And I think that will cause Tim at least to favor one of the other two approaches.
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 ended up having to remove the
git
sourcing from the Gemfile because that caused appbundling to fail with the errorI don't know how that was failing because I added a debug line to verify that the gem was being correctly installed from the omnibus software definition: