Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
MAVRICK-1 wants to merge28 commits intocoder:main
base:main
Choose a base branch
Loading
fromMAVRICK-1:feat/nexus-repository-module
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
28 commits
Select commitHold shift + click to select a range
e32a0b7
feat: add Sonatype Nexus repository integration module
MAVRICK-1Jul 29, 2025
e2d8aad
Update registry/mavrickrishi/modules/nexus/main.tf
MAVRICK-1Jul 29, 2025
2a892ad
Update registry/mavrickrishi/modules/nexus/main.tf
MAVRICK-1Jul 29, 2025
20e9a32
Update registry/mavrickrishi/modules/nexus/main.tf
MAVRICK-1Jul 29, 2025
af94e5b
fix: apply code formatting
MAVRICK-1Jul 29, 2025
db7afc8
fixed changes
MAVRICK-1Jul 30, 2025
09905c3
Update registry/mavrickrishi/modules/nexus/README.md
MAVRICK-1Jul 30, 2025
56f5990
Update registry/mavrickrishi/modules/nexus/main.tf
MAVRICK-1Jul 30, 2025
3c890d0
Update registry/mavrickrishi/modules/nexus/main.tf
MAVRICK-1Jul 30, 2025
88f8284
fix: update Nexus module configurations and README details
MAVRICK-1Jul 30, 2025
f375e5f
feat: add support for Go package manager in Nexus module and update R…
MAVRICK-1Jul 30, 2025
97d144b
feat: add test for configuring Go module proxy in Nexus module
MAVRICK-1Jul 30, 2025
1bd0085
feat: Add Nexus Repository module and related configurations
MAVRICK-1Jul 30, 2025
1b01b37
Merge branch 'main' into feat/nexus-repository-module
MAVRICK-1Jul 30, 2025
5534564
Delete .icons/nexus.svg
MAVRICK-1Jul 30, 2025
0854c5e
fix: remove false positive entries from typos.toml and adjust usernam…
MAVRICK-1Jul 30, 2025
c520a19
fix: correct username entry for mavrickrishi in typos.toml
MAVRICK-1Jul 30, 2025
f42da8f
Merge branch 'main' into feat/nexus-repository-module
MAVRICK-1Aug 1, 2025
9f2fe38
Merge branch 'main' into feat/nexus-repository-module
MAVRICK-1Aug 4, 2025
0a10b4d
Merge branch 'main' into feat/nexus-repository-module
MAVRICK-1Aug 4, 2025
8de8da8
Merge branch 'main' into feat/nexus-repository-module
DevelopmentCatsAug 8, 2025
0fd038a
Merge branch 'main' into feat/nexus-repository-module
DevelopmentCatsAug 13, 2025
9f2f3a4
Update registry/mavrickrishi/modules/nexus-repository/README.md
MAVRICK-1Aug 13, 2025
4a45f09
Merge branch 'main' into feat/nexus-repository-module
MAVRICK-1Aug 26, 2025
3bdcac7
chore: remove trailing newline from README.md
MAVRICK-1Aug 26, 2025
b25317a
Merge branch 'main' into feat/nexus-repository-module
MAVRICK-1Oct 7, 2025
013f756
fix: ensure consistent formatting in nexus repository tests and scripts
MAVRICK-1Oct 7, 2025
5367304
Merge branch 'main' into feat/nexus-repository-module
DevelopmentCatsOct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions.icons/nexus-repository.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionsregistry/mavrickrishi/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,4 +19,5 @@ participating in LFX CNCF programs, and helping the developer community grow.
## Modules

- **aws-ami-snapshot**: Create and manage AMI snapshots for Coder workspaces with restore capabilities
- [nexus-repository](./modules/nexus-repository/) - Configure package managers to use Sonatype Nexus Repository
- [auto-start-dev-server](modules/auto-start-dev-server/README.md) - Automatically detect and start development servers for various project types
149 changes: 149 additions & 0 deletionsregistry/mavrickrishi/modules/nexus-repository/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
---
display_name: Nexus Repository
description: Configure package managers to use Sonatype Nexus Repository for Maven, npm, PyPI, and Docker registries.
icon: ../../../../.icons/nexus-repository.svg
verified: true
tags: [integration, nexus-repository, maven, npm, pypi, docker]
---

# Sonatype Nexus Repository

Configure package managers (Maven, npm, Go, PyPI, Docker) to use [Sonatype Nexus Repository](https://help.sonatype.com/en/sonatype-nexus-repository.html) with API token authentication. This module provides secure credential handling, multiple repository support per package manager, and flexible username configuration.

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

## Requirements

- Nexus Repository Manager 3.x
- Valid API token or user credentials
- Package managers installed on the workspace (Maven, npm, Go, pip, Docker as needed)

> [!NOTE]
> This module configures package managers but does not install them. You need to handle the installation of Maven, npm, Go, Python pip, and Docker yourself.

## Examples

### Configure Maven to use Nexus repositories

```tf
module "nexus_repository" {
source = "registry.coder.com/mavrickrishi/nexus-repository/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
nexus_url = "https://nexus.example.com"
nexus_password = var.nexus_api_token
package_managers = {
maven = ["maven-public", "maven-releases", "maven-snapshots"]
}
}
```

### Configure npm with scoped packages

```tf
module "nexus_repository" {
source = "registry.coder.com/mavrickrishi/nexus-repository/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
nexus_url = "https://nexus.example.com"
nexus_password = var.nexus_api_token
package_managers = {
npm = ["npm-public", "@mycompany:npm-private"]
}
}
```

### Configure Go module proxy

```tf
module "nexus_repository" {
source = "registry.coder.com/mavrickrishi/nexus-repository/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
nexus_url = "https://nexus.example.com"
nexus_password = var.nexus_api_token
package_managers = {
go = ["go-public", "go-private"]
}
}
```

### Configure Python PyPI repositories

```tf
module "nexus_repository" {
source = "registry.coder.com/mavrickrishi/nexus-repository/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
nexus_url = "https://nexus.example.com"
nexus_password = var.nexus_api_token
package_managers = {
pypi = ["pypi-public", "pypi-private"]
}
}
```

### Configure Docker registries

```tf
module "nexus_repository" {
source = "registry.coder.com/mavrickrishi/nexus-repository/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
nexus_url = "https://nexus.example.com"
nexus_password = var.nexus_api_token
package_managers = {
docker = ["docker-public", "docker-private"]
}
}
```

### Use custom username

```tf
module "nexus_repository" {
source = "registry.coder.com/mavrickrishi/nexus-repository/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
nexus_url = "https://nexus.example.com"
nexus_username = "custom-user"
nexus_password = var.nexus_api_token
package_managers = {
maven = ["maven-public"]
}
}
```

### Complete configuration for all package managers

```tf
module "nexus_repository" {
source = "registry.coder.com/mavrickrishi/nexus-repository/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
nexus_url = "https://nexus.example.com"
nexus_password = var.nexus_api_token
package_managers = {
maven = ["maven-public", "maven-releases"]
npm = ["npm-public", "@company:npm-private"]
go = ["go-public", "go-private"]
pypi = ["pypi-public", "pypi-private"]
docker = ["docker-public", "docker-private"]
}
}
```
147 changes: 147 additions & 0 deletionsregistry/mavrickrishi/modules/nexus-repository/main.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
import { describe, expect, it } from "bun:test";
import {
executeScriptInContainer,
runTerraformApply,
runTerraformInit,
testRequiredVariables,
} from "~test";

describe("nexus-repository", async () => {
await runTerraformInit(import.meta.dir);

testRequiredVariables(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-password",
});

it("configures Maven settings", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-token",
package_managers: JSON.stringify({
maven: ["maven-public"],
}),
});

const output = await executeScriptInContainer(state, "ubuntu:20.04");
expect(output.stdout.join("\n")).toContain("☕ Configuring Maven...");
expect(output.stdout.join("\n")).toContain("🥳 Configuration complete!");
});

it("configures npm registry", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-token",
package_managers: JSON.stringify({
npm: ["npm-public"],
}),
});

const output = await executeScriptInContainer(state, "ubuntu:20.04");
expect(output.stdout.join("\n")).toContain("📦 Configuring npm...");
expect(output.stdout.join("\n")).toContain("🥳 Configuration complete!");
});

it("configures PyPI repository", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-token",
package_managers: JSON.stringify({
pypi: ["pypi-public"],
}),
});

const output = await executeScriptInContainer(state, "ubuntu:20.04");
expect(output.stdout.join("\n")).toContain("🐍 Configuring pip...");
expect(output.stdout.join("\n")).toContain("🥳 Configuration complete!");
});

it("configures multiple package managers", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-token",
package_managers: JSON.stringify({
maven: ["maven-public"],
npm: ["npm-public"],
pypi: ["pypi-public"],
}),
});

const output = await executeScriptInContainer(state, "ubuntu:20.04");
expect(output.stdout.join("\n")).toContain("☕ Configuring Maven...");
expect(output.stdout.join("\n")).toContain("📦 Configuring npm...");
expect(output.stdout.join("\n")).toContain("🐍 Configuring pip...");
expect(output.stdout.join("\n")).toContain(
"✅ Nexus repository configuration completed!",
);
});

it("handles empty package managers", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-token",
package_managers: JSON.stringify({}),
});

const output = await executeScriptInContainer(state, "ubuntu:20.04");
expect(output.stdout.join("\n")).toContain(
"🤔 no maven repository is set, skipping maven configuration.",
);
expect(output.stdout.join("\n")).toContain(
"🤔 no npm repository is set, skipping npm configuration.",
);
expect(output.stdout.join("\n")).toContain(
"🤔 no pypi repository is set, skipping pypi configuration.",
);
expect(output.stdout.join("\n")).toContain(
"🤔 no docker repository is set, skipping docker configuration.",
);
});

it("configures Go module proxy", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-token",
package_managers: JSON.stringify({
go: ["go-public", "go-private"],
}),
});

const output = await executeScriptInContainer(state, "ubuntu:20.04");
expect(output.stdout.join("\n")).toContain("🐹 Configuring Go...");
expect(output.stdout.join("\n")).toContain(
"Go proxy configured via GOPROXY environment variable",
);
expect(output.stdout.join("\n")).toContain("🥳 Configuration complete!");
});

it("validates nexus_url format", async () => {
await expect(
runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "invalid-url",
nexus_password: "test-token",
package_managers: JSON.stringify({}),
}),
).rejects.toThrow();
});

it("validates username_field values", async () => {
await expect(
runTerraformApply(import.meta.dir, {
agent_id: "test-agent",
nexus_url: "https://nexus.example.com",
nexus_password: "test-token",
username_field: "invalid",
package_managers: JSON.stringify({}),
}),
).rejects.toThrow();
});
});
Loading

[8]ページ先頭

©2009-2025 Movatter.jp