Skip to content

RTECO-1536 - Add jf ruby command for native RubyGems/Bundler support#3574

Open
agrasth wants to merge 31 commits into
masterfrom
feature/rubygems-native-support
Open

RTECO-1536 - Add jf ruby command for native RubyGems/Bundler support#3574
agrasth wants to merge 31 commits into
masterfrom
feature/rubygems-native-support

Conversation

@agrasth

@agrasth agrasth commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Registers the jf ruby <gem|bundle> command in the JFrog CLI, wiring up the native RubyGems/Bundler support with full authentication, build-info collection, and Ghost Frog integration.

Depends on: jfrog/jfrog-cli-artifactory#499

What is included in this PR

  • Command registration: jf ruby with SkipFlagParsing: true for transparent arg passthrough
  • Flag extraction: --server-id, --repo, --build-name, --build-number, --module, --project consumed by jf; everything else forwarded to native tool
  • --repo flag: Specifies Artifactory repo name; jf constructs the full gems API URL from server config (no need to pass full URLs)
  • Ghost Frog integration: gem/bundle aliases route through jf ruby <tool>
  • Help documentation: Usage examples including --repo shorthand
  • Integration tests: Version passthrough, help bypass, unsupported tool errors, no-args error, --repo stripping

Usage examples

# Bundle install (auto-discovers source from Gemfile)
jf ruby bundle install

# Gem install with --repo (URL constructed from server config)
jf ruby gem install rake --repo gems-virtual

# Gem push with --repo
jf ruby gem push my.gem --repo gems-local --build-name=build --build-number=1

# Explicit --source (traditional way still works)
jf ruby gem install rake --source https://my.jfrog.io/artifactory/api/gems/gems-virtual/

# With explicit server selection
jf ruby bundle install --server-id my-rt --repo gems-virtual

Test plan

  • go build ./... - compiles with local replaces
  • Integration tests pass (go test -run TestRuby)
  • End-to-end with live Artifactory gems repos

Wires the native RubyGems/Bundler support into the JFrog CLI:

- Register `jf ruby` command in buildtools/cli.go with SkipFlagParsing
- RubyCmd handler: extracts native tool, server-id, build details, delegates
  to RubyCommand via ExecWithPackageManager
- Add Ruby flag set (BuildName, BuildNumber, module, Project, serverId)
- Add docs/buildtools/rubycommand/help.go with usage examples
- Route gem/bundle through `jf ruby` in packagealias/dispatch.go (Ghost Frog)
- Add 5 integration tests (version passthrough, help bypass, error handling)

Note: go.mod contains local replace directives for build-info-go and
jfrog-cli-artifactory (development only, to be replaced at merge time).

Co-authored-by: Cursor <cursoragent@cursor.com>
@agrasth agrasth changed the title Add jf ruby command for native RubyGems/Bundler support RTECO-1536 - Add jf ruby command for native RubyGems/Bundler support Jun 29, 2026
The --repo flag specifies an Artifactory repository name and lets jf
construct the full gems API URL from the server config, so users do not
need to pass full Artifactory URLs for gem install/push commands.

Also updates help text with --repo examples and adds integration test.

Co-authored-by: Cursor <cursoragent@cursor.com>
Integration tests for gem install/fetch/push, bundle install, build-info
capture, checksums, scope classification, and round-trip flows.
All tests auto-skip unless explicitly enabled with -test.ruby=true,
so CI remains unaffected.

Co-authored-by: Cursor <cursoragent@cursor.com>
Adds rubyTests.yml following the same pattern as nixTests/uvTests:
- Sets up Ruby 3.2 via ruby/setup-ruby
- Spins up local Artifactory
- Runs `go test --test.ruby`
- Supports external Artifactory via workflow_dispatch inputs

Co-authored-by: Cursor <cursoragent@cursor.com>
…tive-support

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	go.sum
#	main_test.go
#	utils/tests/consts.go
#	utils/tests/utils.go
Points build-info-go and jfrog-cli-artifactory replace directives to
their feature branch commits on GitHub, so CI can resolve dependencies
without local checkouts.

Co-authored-by: Cursor <cursoragent@cursor.com>
- ruby_integration_test.go: suppress G703 path traversal on test-only
  WriteFile (path always comes from CreateTempDir)
- buildtools/cli.go: rewrite if-else chain to switch in
  extractRubyRepoFromArgs to satisfy gocritic

Co-authored-by: Cursor <cursoragent@cursor.com>
Required by the CI static analysis check that verifies all registered
commands expose AI-consumable descriptions via ResolveDescription.

Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 4 commits July 16, 2026 02:36
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Integration tests now call prepareHomeDir(t) via initRubyTest to
ensure the JFrog server config is available (fixes "Invalid uri scheme"
errors from missing ArtifactoryUrl). Also updates jfrog-cli-artifactory
dependency to include the reference token auth fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Integration tests now call prepareHomeDir(t) via initRubyTest to
ensure the JFrog server config is available (fixes "Invalid uri scheme"
errors from missing ArtifactoryUrl). Also updates jfrog-cli-artifactory
dependency to include the reference token auth fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 2 commits July 16, 2026 03:18
Bundler lockfile fixtures caused "unreadable lockfile" errors in CI
due to version mismatches and unpatched placeholder URLs. Removing
them lets bundler generate a fresh lockfile during tests.

Also updates jfrog-cli-artifactory dep to include the fix that
errors on invalid --server-id instead of silently falling through.

Co-authored-by: Cursor <cursoragent@cursor.com>
Bundler lockfile fixtures caused "unreadable lockfile" errors in CI
due to version mismatches and unpatched placeholder URLs. Removing
them lets bundler generate a fresh lockfile during tests.

Also updates jfrog-cli-artifactory dep to include the fix that
errors on invalid --server-id instead of silently falling through.

Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 2 commits July 16, 2026 03:28
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 2 commits July 16, 2026 03:36
Bundler env var credential matching varies across versions and port
handling. Embedding credentials directly in the source URL is the
most reliable approach for CI, matching how gem install works.

Co-authored-by: Cursor <cursoragent@cursor.com>
Bundler env var credential matching varies across versions and port
handling. Embedding credentials directly in the source URL is the
most reliable approach for CI, matching how gem install works.

Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 2 commits July 16, 2026 18:18
When using access tokens, serverDetails.User is empty. Fall back to
the test framework default user (admin) for embedded URL credentials
in the Gemfile, matching how Artifactory expects basic auth.

Co-authored-by: Cursor <cursoragent@cursor.com>
When using access tokens, serverDetails.User is empty. Fall back to
the test framework default user (admin) for embedded URL credentials
in the Gemfile, matching how Artifactory expects basic auth.

Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 2 commits July 16, 2026 18:27
Artifactory generates specs.4.8.gz (needed by Bundler) only after
at least one gem is cached via the remote. Add a gem fetch warm-up
step before bundle tests to prime the virtual repo index.

Co-authored-by: Cursor <cursoragent@cursor.com>
Artifactory generates specs.4.8.gz (needed by Bundler) only after
at least one gem is cached via the remote. Add a gem fetch warm-up
step before bundle tests to prime the virtual repo index.

Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 2 commits July 16, 2026 18:44
The gem fetch approach doesn't generate specs.4.8.gz on the virtual.
Instead, build and deploy a minimal gem to the local repo via
jf rt upload, which triggers Artifactory index generation.

Co-authored-by: Cursor <cursoragent@cursor.com>
The gem fetch approach doesn't generate specs.4.8.gz on the virtual.
Instead, build and deploy a minimal gem to the local repo via
jf rt upload, which triggers Artifactory index generation.

Co-authored-by: Cursor <cursoragent@cursor.com>
agrasth and others added 2 commits July 16, 2026 20:56
Generic jf rt upload doesn't trigger Artifactory gem index generation.
Use jf ruby gem push which hits the RubyGems API endpoint (POST
/api/gems/<repo>) and properly triggers specs.4.8.gz creation.

Co-authored-by: Cursor <cursoragent@cursor.com>
Generic jf rt upload doesn't trigger Artifactory gem index generation.
Use jf ruby gem push which hits the RubyGems API endpoint (POST
/api/gems/<repo>) and properly triggers specs.4.8.gz creation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

👍 Frogbot scanned this pull request and did not find any new security issues.


agrasth and others added 5 commits July 16, 2026 22:47
Artifactory generates specs.4.8.gz asynchronously after gem push API
call. Add a wait to give it time to complete before bundle tests
request the index.

Co-authored-by: Cursor <cursoragent@cursor.com>
The virtual repo's specs.4.8.gz depends on both the local repo
(gem push) AND the remote repo (lazy sync from rubygems.org).
Replace the fixed 10s sleep with polling (up to 60s, 5s intervals)
that verifies the index is actually available before proceeding
with bundle tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
1. warmUpRubyVirtualRepo now uses sync.Once so the expensive polling
   (push gem + poll specs.4.8.gz) runs only once across all tests.
   Increased timeout to 120s for slow CI Artifactory instances.

2. TestRubyBuildFlags: name-only and number-only cases now correctly
   expect an error (CLI rejects partial build-name/build-number).

Co-authored-by: Cursor <cursoragent@cursor.com>
The CI Artifactory instance does not generate specs.4.8.gz for
virtual repos (confirmed after multiple attempts with polling up to
120s). This is an infrastructure limitation, not a code bug.

Fix: Bundle tests now use the LOCAL repo directly with a self-contained
'warmup' gem. The local repo generates specs immediately on gem push.
gem install/fetch tests still use the virtual repo (which works fine
for individual gem operations that don't need specs.4.8.gz).

Co-authored-by: Cursor <cursoragent@cursor.com>
…tive-support

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	ruby_integration_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant