Add Sonatype Nexus Repository Integration Module

Summary

Implements a Coder module for Sonatype Nexus Repository Manager integration that automatically configures Maven, npm, PyPI, and Docker registries for development workspaces.

Demo Video & Screenshots

https://github.com/user-attachments/assets/2c51f229-d34d-483b-a0e9-f4e0d79332c2

Nexus Repository Integration

Features

  • Maven Support: Automatic settings.xml configuration
  • npm Support: Automatic .npmrc configuration with scoped packages
  • PyPI Support: Automatic pip.conf configuration
  • Docker Support: Registry authentication setup
  • Flexible Configuration: Support for multiple repositories per package manager
  • Secure Credentials: API token and password support
  • Username Options: Configurable username field (username or email)

Nexus Repository Manager Requirements

Version Requirements

Yes, this module requires Nexus Repository Manager Pro version for full functionality, though basic features work with the Community Edition (OSS).

Supported Authentication Methods

This module supports 4 authentication methods:

  1. User Token Authentication (Recommended - Pro only)

    • Enhanced security with two-part tokens
    • Ideal for CI/CD and automated environments
    • Requires nx-usertoken-current privilege
  2. API Token Authentication (Pro only)

    • Single-use access tokens via REST API
    • Programmatic token generation and management
  3. Basic Authentication (OSS & Pro)

    • Standard HTTP Basic Auth with username/password
    • Works with both OSS and Pro versions
  4. Base64 Encoded Credentials (OSS & Pro)

    • Base64 encoded username:password format
    • Compatible with npm and other package managers

Testing Instructions

Prerequisites

  • Nexus Repository Manager instance (OSS or Pro)
  • Admin access to configure repositories
  • Test repositories for each package manager you want to test

Setup Test Environment

  1. Create Test Repositories in your Nexus instance:

    • Maven: maven-public, maven-releases
    • npm: npm-public, @company:npm-private
    • PyPI: pypi-public, pypi-private
    • Docker: docker-public, docker-private
  2. Configure Authentication:

    • For Pro: Generate user tokens via UI (User menu → User Token)
    • For OSS: Use username/password or base64 encoded credentials
    • Set up appropriate permissions for test repositories
  3. Test the Module:

    module "nexus" {
    source = "registry.coder.com/mavrickrishi/nexus/coder"
    version = "1.0.0"
    agent_id = coder_agent.main.id
    nexus_url = "https://your-nexus-instance.com"
    nexus_password = var.nexus_api_token # or password
    package_managers = {
    maven = ["maven-public", "maven-releases"]
    npm = ["npm-public", "@company:npm-private"]
    pypi = ["pypi-public", "pypi-private"]
    docker = ["docker-public", "docker-private"]
    }
    }
  4. Verify Configuration:

    • Check generated config files in workspace
    • Test package installation from configured repositories
    • Verify authentication works for each package manager

EC2 Deployment Testing

Tested by deploying on EC2 instance with:

  • Ubuntu 22.04 LTS
  • Nexus Repository Manager Pro
  • All package managers (Maven, npm, PyPI, Docker)
  • Both token and basic authentication methods

Usage Example

module "nexus" {
source = "registry.coder.com/mavrickrishi/nexus/coder"
version = "1.0.0"
agent_id = coder_agent.main.id
nexus_url = "https://nexus.company.com"
nexus_password = var.nexus_api_token
package_managers = {
maven = ["maven-public", "maven-releases"]
npm = ["npm-public", "@company:npm-private"]
pypi = ["pypi-public", "pypi-private"]
docker = ["docker-public", "docker-private"]
}
}

Testing

  • ✅ 11 comprehensive tests covering all functionality
  • ✅ Variable validation tests
  • ✅ Package manager configuration tests
  • ✅ Error handling tests
  • ✅ All tests passing
  • ✅ EC2 deployment tested

Files Added

  • registry/mavrickrishi/modules/nexus/main.tf - Main module configuration
  • registry/mavrickrishi/modules/nexus/README.md - Complete documentation
  • registry/mavrickrishi/modules/nexus/main.test.ts - Test suite

Checklist

  • Module follows existing patterns and conventions
  • Comprehensive test coverage (11 tests)
  • Complete documentation with examples
  • Input validation and error handling
  • Secure credential handling
  • All tests passing
  • Demo video included
  • Screenshots added
  • Testing instructions provided
  • Authentication methods documented
  • EC2 deployment tested

Closes #202 /claim #202

Claim

Total prize pool $150
Total paid $150
Status Approved
Submitted July 29, 2025
Last updated August 04, 2025

Contributors

RI

Rishi Mondal

@MAVRICK-1

100%

Sponsors

CO

Coder

@coder

$150 paid