RubyGems
Use a RubyGems registry to host private Ruby gems and serve them to the gem CLI and Bundler.
Before you begin
Ensure you have the RubyGems CLI (
gem) installed on your local machine. Bundler is optional and required only if you install gems withbundle.Access to a Harness account with appropriate permissions to create registries and connectors.
Create a RubyGems artifact registry
Go to the Artifact Registry module in your Harness project.
Click New Artifact Registry.
In the Registry Type list, select Ruby.
Enter a Registry Name.
Optionally, add a Description and Labels for better organization.
Select Create Registry to finalize.
Configure an upstream proxy (optional)
An upstream proxy allows your registry to fetch gems from external RubyGems sources when they are not available locally. The default upstream is RubyGems.org.
Create an upstream proxy
In the Artifact Registry module, select the dropdown next to New Artifact Registry and select Upstream Proxy.
Select Ruby as the proxy type.
Enter an Upstream Proxy Key.
Optionally, add a Description and Labels.
Select your Source:
RubyGems.org
Custom
If you choose Custom, enter your Remote Registry URL (for example,
https://rubygems.org).Choose your Authentication method (
Anonymousby default for public RubyGems sources).Click Create Upstream Proxy to establish the connection.
Configure the upstream proxy in your registry
In the Artifact Registry module, select an existing RubyGems Artifact Registry.
Go to the Configuration tab.
In the Advanced (Optional) section, click Configure Upstream.
Select from the list of compatible proxies to add them to your registry.
Select Save to save the configuration.
Set up the RubyGems client
In your Harness RubyGems Artifact Registry, click Set Up Client and follow the instructions to configure the gem CLI to use the registry.
1. Generate identity token
In your Harness RubyGems Artifact Registry, click Set Up Client.
Click Generate Token to generate an identity token.
2. Configure registry
Add the registry as a remote host:
or (to save along with token)
Add the following entry to ~/.gem/credentials (create the file if it does not exist):
Configure Bundler to authenticate with this registry:
Add the registry URL to your Gemfile:
3. Push package
Set allowed_push_host in your gemspec to the registry host, then push your gem:
4. Install package
Install a gem from this registry:
5. Yank package
Remove a gem version from this registry:
Troubleshooting
Last updated
Was this helpful?