Support loading of locally installed gems
What does this MR do?
Support loading of locally installed gems
Allow administrators to load additional gems during gitlab-rails
initialization via gitlab.rb
configuration.
This is a general approach that may satisfy many different use cases. Some examples are:
- Enabling additional OmniAuth strategies. Ref #1420 (closed)
- Integrations that are specific to on-premise installations and not appropriate for contribution to upstream gitlab-ce.
Note that gems can only be sourced from local directories and must be
installed prior to gitlab-ctl reconfigure
. This reduces the complexity
of the implementation in comparison to one that would install gems from
remote sources and ensures the Bundler config can maintain its frozen
state between reconfigurations. Administrators can choose which method
of installation makes sense for their environment, e.g. Bundler, distro
packages, or some configuration management.
If local gems are defined, a Gemfile.local
is created that wraps the
original Gemfile
and defines a path
source section for each set of
gems in gitlab_rails['gems']
. Using path
constrains gems to the
local path source.
Example configuration:
gitlab_rails['gems'] = {
'/a/local/dir/of/vendored/gems' => ['some_gem', 'another_gem'],
}
Resulting Gemfile.local
:
eval_gemfile("Gemfile")
path "/a/local/dir/of/vendored/gems" do
gem "some_gem"
gem "another_gem"
end
Related issues
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
-
MR title and description are up to date, accurate, and descriptive. -
MR targeting the appropriate branch. -
Latest Merge Result pipeline is green. -
When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow.
For GitLab team members
If you don't have access to this, the reviewer should trigger these jobs for you during the review process.
-
The manual Trigger:ee-package
jobs have a green pipeline running against latest commit. -
If config/software
orconfig/patches
directories are changed, make sure thebuild-package-on-all-os
job within theTrigger:ee-package
downstream pipeline succeeded. -
If you are changing anything SSL related, then the Trigger:package:fips
manual job within theTrigger:ee-package
downstream pipeline must succeed. -
If CI configuration is changed, the branch must be pushed to dev.gitlab.org
to confirm regular branch builds aren't broken.
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes. -
Documentation created/updated. -
Tests added. -
Integration tests added to GitLab QA. -
Equivalent MR/issue for the GitLab Chart opened. -
Validate potential values for new configuration settings. Formats such as integer 10
, duration10s
, URIscheme://user:passwd@host:port
may require quotation or other special handling when rendered in a template and written to a configuration file.