Configure Ruby/Bundler for dependency resolution and publishing through Artifactory.

When to Use

Use jf ruby-config to configure Bundler/RubyGems to resolve gems from Artifactory. After configuration, standard bundle install commands resolve from your Artifactory repository.

Prerequisites

  • Ruby and Bundler must be installed.
  • Configure a server with jf config add or jf c add.
  • Authentication to Artifactory is required.

Configuration: jf ruby-config

Generate Ruby/Bundler configuration for dependency resolution and publishing through Artifactory. Run this once per project before your first bundle install.

To configure Ruby/Bundler for Artifactory:

Synopsis

jf ruby-config [options]

Aliases: rubyc

Configuration Options

FlagDefaultDescription
--globalfalseSet to true for global configuration (all projects). Specific projects can override.
--repo-deployRepository for artifacts deployment
--repo-resolveRepository for dependencies resolution
--server-id-deployArtifactory server ID for deployment. Configure with jf config add.
--server-id-resolveArtifactory server ID for resolution. Configure with jf config add.

Configuration Examples

View Help

jf ruby-config --help

Non-Interactive Configuration with Flags

jf ruby-config --server-id-resolve=<server-id> --repo-resolve=<repo-name>

Where:

  • <server-id>: The server ID configured using jf config add
  • <repo-name>: The name of the Ruby repository in Artifactory

For example:

jf ruby-config --server-id-resolve=my-server --repo-resolve=ruby-virtual

Global Configuration

jf ruby-config --global --server-id-resolve=<server-id> --repo-resolve=<repo-name>

Why Run Config First?

You must run jf ruby-config before using bundle install with Artifactory. The config sets the gem source to point to your Artifactory repository. Without it, Bundler resolves from the default public gem sources.

Shortcut: In CI/CD, pass all flags non-interactively so the config step is fully automated and reproducible.

Configuration Notes

  • Config-only: There is no jf ruby command. After running jf ruby-config, use standard Ruby/Bundler commands with Artifactory as the gem source.
  • Resolution and deployment: Use --repo-resolve for installing gems and --repo-deploy for publishing gems.
  • Run once per project: Re-run when changing repository assignments.

Expected Output

$ jf ruby-config --server-id-resolve=my-server --repo-resolve=ruby-virtual
Ruby build configuration saved successfully.

How to Verify

After running, verify the configuration is applied:

bundle config

After Configuration

After running jf ruby-config, use standard Bundler commands. JFrog CLI configures the gem source to point to Artifactory, so native commands resolve from it automatically:

# 1. Configure once
jf ruby-config --server-id-resolve=my-server --repo-resolve=ruby-virtual

# 2. Use standard Bundler — dependencies resolve from Artifactory
bundle install

# 3. To publish a gem (if --repo-deploy was configured)
gem push my-gem-1.0.0.gem

Important Notes

  • Config-only: There is no jf ruby command. After running jf ruby-config, use standard Ruby/Bundler commands with Artifactory as the gem source.
  • Resolution and deployment: Use --repo-resolve for installing gems and --repo-deploy for publishing gems.

CI/CD Example (GitHub Actions)

# .github/workflows/build.yml
steps:
  - uses: actions/checkout@v4
  - name: Setup JFrog CLI
    uses: jfrog/setup-jfrog-cli@v4
    env:
      JF_URL: ${{ vars.JF_URL }}
      JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
  - name: Setup Ruby
    uses: ruby/setup-ruby@v1
    with:
      ruby-version: '3.2'
  - name: Configure Ruby
    run: jf ruby-config --server-id-resolve=setup-jfrog-cli-server --repo-resolve=ruby-virtual
  - name: Install dependencies
    run: bundle install

Troubleshooting

SymptomCauseFix
bundle install does not resolve from Artifactory after configConfig not applied or gem source not setRe-run jf ruby-config and verify with bundle config
401 / 403 errorsInvalid credentials or insufficient permissionsRe-run jf config add with a valid access token
gem push failsDeploy repository not configuredRe-run jf ruby-config with --repo-deploy set

Enable debug logging: export JFROG_CLI_LOG_LEVEL=DEBUG


Related Topics