Skip to content

Add Sonatype Nexus repository integration module #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

MAVRICK-1
Copy link

@MAVRICK-1 MAVRICK-1 commented Jul 29, 2025

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.

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)

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

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

Closes

Closes #202
/claim #202

Screencast.from.2025-07-29.23-34-36.mp4
Image

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

- Add nexus module with support for Maven, npm, PyPI, and Docker registries
- Includes comprehensive test suite with 11 passing tests
- Supports configurable repositories per package manager
- Automatic configuration of package manager settings
- Secure credential handling with API token support
- Flexible username configuration (username or email)
- Complete documentation with usage examples

Resolves coder#202
Copilot

This comment was marked as outdated.

MAVRICK-1 and others added 4 commits July 30, 2025 00:04
- Fix Terraform formatting with terraform fmt
- Fix README formatting with prettier
- All linting checks now pass
@MAVRICK-1
Copy link
Author

image linting issue fixed

@bpmct
Copy link
Member

bpmct commented Jul 30, 2025

How does the user authenticate their account?

@MAVRICK-1
Copy link
Author

@bpmct through url and password

Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few suggestions.

@matifali
Copy link
Member

Does it work with https://help.sonatype.com/en/user-tokens.html?

@matifali
Copy link
Member

Also, @michaelbrewer, do you use https://help.sonatype.com/en/user-tokens.html based authentication?

@MAVRICK-1
Copy link
Author

Does it work with https://help.sonatype.com/en/user-tokens.html?

yeah

@MAVRICK-1 MAVRICK-1 requested a review from matifali July 30, 2025 09:38
Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should rename eModule to be valued Nexus repository as Nexus has multiple other products. Please also update all other references.

---
display_name: Sonatype Nexus Repository
description: Configure package managers to use Sonatype Nexus Repository for Maven, npm, PyPI, and Docker registries.
icon: /.icons/nexus.svg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the correct path. It should be the relative path to .icons/nexus.svg

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a comprehensive Sonatype Nexus Repository integration module for Coder that automatically configures Maven, npm, PyPI, and Docker registries for development workspaces with secure credential handling.

  • Implements a complete Nexus integration module with support for multiple package managers
  • Provides secure credential handling using API tokens and password authentication
  • Includes comprehensive test coverage with 11 tests covering all functionality

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
registry/mavrickrishi/modules/nexus/main.tf Main Terraform module with variable definitions, validation rules, and script configuration
registry/mavrickrishi/modules/nexus/run.sh Shell script that configures package managers (Maven, npm, PyPI, Docker) with Nexus repositories
registry/mavrickrishi/modules/nexus/main.test.ts Comprehensive test suite with 11 tests covering all module functionality
registry/mavrickrishi/modules/nexus/README.md Complete documentation with usage examples for all supported package managers
registry/mavrickrishi/README.md Registry metadata and module listing for the mavrickrishi namespace

@MAVRICK-1
Copy link
Author

image test passed

@MAVRICK-1 MAVRICK-1 requested a review from matifali July 30, 2025 10:31
@matifali
Copy link
Member

One last thing
to make it in parity with JFrog is the go support. Can you add that too? I am setting up a Nexus Repository instance to test it as soon as I can.

@MAVRICK-1
Copy link
Author

@matifali ✅ Go support has been added! The module now supports Maven, npm, Go, PyPI, and Docker - achieving full parity with the JFrog module

@MAVRICK-1
Copy link
Author

image @matifali how to solve this ? my username is mavrick-1

@matifali
Copy link
Member

@MAVRICK-1, can you also rename the module to nexus-repository at all relevant places? Same for icon. Let us be very explicit that this module only enables integration with the Nexus repository. and not all Nexys Sontaype products.

Regarding that false typo, you need to add an exception in .github/typos.toml

- Updated .github/typos.toml to exclude false positives for mavrickrishi's README.md.
- Added nexus-repository.svg icon for the Nexus Repository module.
- Updated README.md for mavrickrishi to reflect the new nexus-repository module.
- Created README.md for the nexus-repository module with detailed configuration instructions.
- Implemented main.tf for the nexus-repository module, defining necessary variables and resources.
- Added main.test.ts for testing the nexus-repository module functionalities.
- Created run.sh script to configure Nexus repository access for various package managers.
@MAVRICK-1
Copy link
Author

@matifali done

Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last few suggestions and good to go from my side. I will test it and then give the final approval. Great work so far.

@MAVRICK-1
Copy link
Author

updated both for mavrick and mavrickrishi

@MAVRICK-1 MAVRICK-1 requested a review from matifali July 31, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Sonatype Nexus repository integration module
3 participants