feat(api): add download-rpc package endpoints - #1279
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical release filtering and three moderate correctness issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds authenticated RPC package download endpoints with GitHub/local release resolution, configuration generation, token packaging, ZIP creation, API routes, and tests.
Changes:
- Adds packaging, archive, token, GitHub, and configuration logic.
- Adds DTOs, HTTP/OpenAPI routes, validation, and Postman coverage.
- Adds package configuration and semantic-version support.
Review findings:
- Critical: Release filtering excludes the currently published
rpc-gomajor version. - Moderate: Merged releases can exceed the five-release limit.
- Moderate: Token-mode packages fail under OIDC authentication.
- Moderate: Missing local versions return 500 instead of 404.
| File | Description |
|---|---|
internal/usecase/packaging/token.go |
Token generation |
internal/usecase/packaging/token_test.go |
Token tests |
internal/usecase/packaging/scheme_test.go |
Scheme tests |
internal/usecase/packaging/packaging.go |
Packaging workflow |
internal/usecase/packaging/packaging_test.go |
Packaging tests |
internal/usecase/packaging/interface.go |
Packaging interfaces |
internal/usecase/packaging/github.go |
GitHub release resolution |
internal/usecase/packaging/github_test.go |
GitHub tests |
internal/usecase/packaging/config.go |
Generated configuration |
internal/usecase/packaging/config_test.go |
Configuration tests |
internal/usecase/packaging/archive.go |
ZIP archive creation |
internal/usecase/packaging/archive_test.go |
Archive tests |
internal/entity/github/release.go |
GitHub download URL |
internal/entity/dto/v1/package.go |
Package DTOs |
internal/entity/dto/v1/package_test.go |
DTO validation tests |
internal/controller/openapi/package.go |
OpenAPI declarations |
internal/controller/openapi/adapter.go |
OpenAPI route registration |
internal/controller/httpapi/v1/package.go |
Package HTTP handlers |
internal/controller/httpapi/v1/package_test.go |
Handler tests |
internal/controller/httpapi/v1/error.go |
Packaging error mappings |
internal/controller/httpapi/router.go |
Package route registration |
integration-test/collections/console_rps_apis.postman_collection.json |
Package API requests |
go.mod |
Semantic-version dependency |
config/config.yml |
Package defaults |
config/config.go |
Package settings and validation |
config/config_test.go |
Configuration validation tests |
.env.example |
Package environment documentation |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1279 +/- ##
==========================================
+ Coverage 60.73% 61.48% +0.75%
==========================================
Files 151 158 +7
Lines 12632 12975 +343
==========================================
+ Hits 7672 7978 +306
- Misses 4959 4996 +37
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Groundwork for Download RPC; nothing calls it yet. - List v3+ rpc-go releases from GitHub (newest five) or from a local <dir>/<version>/ cache, sorted newest first - Match rpc-go's published builds, rpc_linux_<arch>.tar.gz and rpc_windows_<arch>.exe - Take the binary from the bare .exe or the tarball's single entry, capped at 200 MiB - Assemble the download zip holding the binaries and config.yaml - Add the package request/release DTOs and the asset download URL
Builds the Download RPC zip; not yet exposed over HTTP. - Resolve the requested build from GitHub, falling back to package.local_dir - package.disable_fetch serves builds from local_dir only; with fetching on, GitHub releases list first, then local-only versions - Render rpc-go's config.yaml for activate or deactivate with token, userpass, or no embedded credentials, scoped to the caller's tenant - Mint the auth token with a requested lifetime capped by package.max_token_ttl; no token is minted when auth is disabled - Point rpc-go at the request's serverUrl or the listener address, and skip cert checks when the listener serves a generated certificate - Package the Windows and Linux builds together for os "both"
- GET /api/package/rpc-versions lists the rpc-go releases available to package - POST /api/package returns a zip with the rpc-go binary and a config.yaml pointing at this Console - Map missing assets to 404 and unsafe versions and out-of-range token lifetimes to 400 - Declare both routes in OpenAPI and add Postman requests
6228113 to
4c348a1
Compare
|
🎉 This PR is included in version 1.43.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |


Server Side Packaging of RPC Go
UI: device-management-toolkit/sample-web-ui#3572 (depends on this PR).