Skip to content

Conversation

@joshrotenberg
Copy link
Collaborator

Summary

This PR adds three new commands to support Redis Enterprise 8.x custom module development workflows:

1. module validate - Validate module.json

Validates module metadata against the RE8 schema before packaging or upload.

# Basic validation
redisctl enterprise module validate ./module.json

# Output:
# Validating: ./module.json
#
#   v module_name: jmespath
#   v version: 300
#   v semantic_version: 0.3.0
#   v min_redis_version: 7.0.0
#   v compatible_redis_version: 8.0.0
#   v commands: 2 commands defined
#   v capabilities: 4 capabilities
#
# v Module metadata is valid for Redis Enterprise 8.x

# Strict mode (requires all recommended fields)
redisctl enterprise module validate ./module.json --strict

Features:

  • Checks required fields (module_name)
  • Warns about recommended fields (version, semantic_version, min_redis_version)
  • Highlights missing compatible_redis_version (required for RE8 upgrade tests)
  • Strict mode requires all recommended fields
  • JSON output format supported (-o json)

2. module inspect - Inspect packaged modules

Inspects a module zip package to verify structure and contents.

# Basic inspection
redisctl enterprise module inspect ./redis-jmespath.Linux-x86_64.0.3.0.zip

# Output:
# Package: redis-jmespath.Linux-x86_64.0.3.0.zip
#
# Files:
#   module.json (729 bytes)
#   jmespath.so (6.5 MB)
#
# Metadata:
#   Name: jmespath
#   Display: JMESPath
#   Version: 0.3.0 (300)
#   Min Redis: 7.0.0
#   Compatible: 8.0.0
#   Commands: 33
#   Capabilities: types, replica_of, clustering, backup_restore
#
# v Package structure is valid for RE8 user_defined_modules

# Show all commands
redisctl enterprise module inspect ./module.zip --full

Features:

  • Shows package contents with file sizes
  • Parses and displays module.json metadata
  • Validates RE8-compatible structure (flat zip, files at root)
  • Full mode shows all command definitions with arity, key positions, flags
  • Detects common packaging errors

3. module package - Create RE8-compatible zip

Packages a module binary and metadata into an RE8-compatible zip file.

redisctl enterprise module package \
  --module ./libredis_jmespath.so \
  --metadata ./module.json \
  --out ./dist/redis-jmespath.Linux-x86_64.0.3.0.zip

# With validation before packaging
redisctl enterprise module package \
  --module ./module.so \
  --metadata ./module.json \
  --out ./package.zip \
  --validate

Features:

  • Creates flat zip structure (files at root, no subdirectories)
  • Optional metadata validation before packaging (--validate)
  • Uses deflate compression
  • Proper structure for user_defined_modules bootstrap

Why These Tools?

Redis Enterprise 8.x uses a new native module packaging format:

  • Old way (RAMP): Required Python, git, ramp-packer, manifest.yml
  • New way (RE8): Simple zip with module.json + module.so at root

These tools help catch errors early:

  • Missing compatible_redis_version (causes RE8 upgrade test failures)
  • Subdirectories in zip (causes "module.json missing" errors)
  • Invalid JSON in module.json
  • Missing required fields

Testing

  • All existing tests pass
  • Manually tested all three commands with various inputs
  • Tested error cases (missing files, invalid JSON, strict mode failures)

Files Changed

  • crates/redisctl/src/commands/enterprise/module.rs - Added command definitions
  • crates/redisctl/src/commands/enterprise/module_impl.rs - Added implementations
  • crates/redisctl/Cargo.toml - Added zip dependency

Add three new commands for Redis Enterprise 8.x module development:

module validate - Validate module.json against RE8 schema
- Checks required fields (module_name)
- Warns about recommended fields (version, semantic_version, min_redis_version)
- Highlights missing compatible_redis_version (important for RE8 upgrade tests)
- Strict mode (--strict) requires all recommended fields
- JSON output format supported

module inspect - Inspect packaged module zip files
- Shows package contents with file sizes
- Parses and displays module.json metadata
- Validates RE8-compatible structure (flat zip, module.json + .so at root)
- Full mode (--full) shows all command definitions
- Detects common packaging errors (subdirectories, missing files)

module package - Create RE8-compatible module zip
- Packages module binary + module.json into flat zip structure
- Optional validation before packaging (--validate)
- Creates proper structure for user_defined_modules bootstrap

These tools support the RE8 native module packaging format which replaced
the older RAMP-based packaging. The new format is a simple zip with
module.json and the .so file at the root level.

Examples:
  redisctl enterprise module validate ./module.json
  redisctl enterprise module validate ./module.json --strict
  redisctl enterprise module inspect ./package.zip
  redisctl enterprise module inspect ./package.zip --full
  redisctl enterprise module package --module ./mod.so --metadata ./module.json --out ./pkg.zip
- Fix useless format! macro in module_impl.rs
- Collapse nested if statement using let-chains
- Add bzip2-1.0.6 license to allowed licenses (used by zip crate)
- Document --name flag for module get command
- Document --module flag for database create command
- Add Custom Module Development section for RE8+
- Document validate, inspect, and package commands
- Add module.json format reference
@joshrotenberg joshrotenberg merged commit dcbaf12 into main Dec 17, 2025
27 checks passed
@joshrotenberg joshrotenberg deleted the feat/module-workflow-tools branch December 17, 2025 21:33
This was referenced Dec 17, 2025
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.

2 participants