Setup .NET template#68
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new Backstage software template to scaffold a .NET Web API service (with GitOps manifests and DB env wiring), and updates local platform tooling/config to support the new template and registry auth changes.
Changes:
- Introduce
apps/portal/examples/dotnet-template(template definition, source skeleton, and GitOps manifests) and register it in Backstage catalog locations. - Switch Docker registry credentials from
DOCKER_PASSWORDtoDOCKER_TOKENacross Taskfile + prereq scripts +.env.example. - Update operator database controller tests to expect Postgres image tag
18and adjust CORS origin config to include127.0.0.1.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Taskfile.yml | Uses DOCKER_TOKEN instead of DOCKER_PASSWORD when creating docker-registry secret. |
| scripts/check-prereqs.sh | Requires DOCKER_TOKEN in .env checks. |
| scripts/check-prereqs.bat | Requires DOCKER_TOKEN and adds optional env-var checking helpers. |
| apps/portal/examples/nestjs-prisma-template/template.yaml | Updates template description text. |
| apps/portal/examples/dotnet-template/template.yaml | New Backstage scaffolder template for .NET Web API + GitOps + webhook/secret steps. |
| apps/portal/examples/dotnet-template/README.md | New documentation for the .NET template contents. |
| apps/portal/examples/dotnet-template/content/source/README.md | New generated service README for local dev and DB env vars. |
| apps/portal/examples/dotnet-template/content/source/Properties/launchSettings.json | New launch profile for local development with templated port. |
| apps/portal/examples/dotnet-template/content/source/Program.cs | New minimal ASP.NET Core app wiring env-based DB connection string + endpoints. |
| apps/portal/examples/dotnet-template/content/source/DotNetApi.csproj | New .NET Web API project targeting net10.0 with Swagger dependency. |
| apps/portal/examples/dotnet-template/content/source/Dockerfile | New multi-stage Dockerfile for build/publish and runtime. |
| apps/portal/examples/dotnet-template/content/source/docker-compose.yml | New compose stack for API + Postgres for local development. |
| apps/portal/examples/dotnet-template/content/source/Controllers/WeatherForecastController.cs | New sample controller and model. |
| apps/portal/examples/dotnet-template/content/source/catalog-info.yaml | New Backstage catalog descriptor for generated service. |
| apps/portal/examples/dotnet-template/content/source/appsettings.json | New appsettings with connection string template placeholders. |
| apps/portal/examples/dotnet-template/content/source/appsettings.Development.json | New dev logging overrides. |
| apps/portal/examples/dotnet-template/content/source/.gitignore | New ignore rules for .NET build/IDE artifacts. |
| apps/portal/examples/dotnet-template/content/source/.env.example | New example env file for DB and port values. |
| apps/portal/examples/dotnet-template/content/source/.dockerignore | New dockerignore for .NET artifacts and IDE files. |
| apps/portal/examples/dotnet-template/content/gitops/helios-app.yaml | New HeliosApp manifest template including service + database trait. |
| apps/portal/app-config.yaml | Adds dotnet template to catalog locations and expands CORS origins list. |
| apps/operator/internal/controller/database/resources_test.go | Updates expected Postgres image tag in StatefulSet generation test. |
| apps/operator/internal/controller/database/reconciler_test.go | Updates expected Postgres image tag in reconciliation tests. |
| .env.example | Renames docker registry credential from DOCKER_PASSWORD to DOCKER_TOKEN. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| app.UseHttpsRedirection(); | ||
| app.MapControllers(); | ||
|
|
||
| app.MapGet("/health", () => Results.Ok(new { status = "ok" })); | ||
| app.MapGet("/database/config", ([FromServices] IConfiguration config) => | ||
| Results.Ok(new | ||
| { | ||
| Host = dbHost, | ||
| User = dbUser, | ||
| Database = dbName, | ||
| ConnectionString = config.GetConnectionString("DefaultConnection") | ||
| })); |
There was a problem hiding this comment.
The /database/config endpoint returns the resolved ConnectionString, which includes the database password. This leaks credentials to any caller and should be removed or restricted (e.g., only enabled in Development and never include secrets in responses).
| } | |
| app.UseHttpsRedirection(); | |
| app.MapControllers(); | |
| app.MapGet("/health", () => Results.Ok(new { status = "ok" })); | |
| app.MapGet("/database/config", ([FromServices] IConfiguration config) => | |
| Results.Ok(new | |
| { | |
| Host = dbHost, | |
| User = dbUser, | |
| Database = dbName, | |
| ConnectionString = config.GetConnectionString("DefaultConnection") | |
| })); | |
| app.MapGet("/database/config", () => | |
| Results.Ok(new | |
| { | |
| Host = dbHost, | |
| User = dbUser, | |
| Database = dbName | |
| })); | |
| } | |
| app.UseHttpsRedirection(); | |
| app.MapControllers(); | |
| app.MapGet("/health", () => Results.Ok(new { status = "ok" })); |
| if container.Image != "postgres:18" { | ||
| t.Errorf("Expected image %q, got %q", "postgres:18", container.Image) |
There was a problem hiding this comment.
This test passes version "16" into GenerateDatabaseStatefulSet(...) but asserts the image is postgres:18. Since the image is generated from the provided version, this expectation will fail unless the input version (or the generator) is updated consistently.
| if container.Image != "postgres:18" { | |
| t.Errorf("Expected image %q, got %q", "postgres:18", container.Image) | |
| if container.Image != "postgres:16" { | |
| t.Errorf("Expected image %q, got %q", "postgres:16", container.Image) |
| Template: corev1.PodTemplateSpec{ | ||
| Spec: corev1.PodSpec{ | ||
| Containers: []corev1.Container{{Name: "postgres", Image: "postgres:15"}}, | ||
| Containers: []corev1.Container{{Name: "postgres", Image: "postgres:18"}}, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
ReconcileInstances uses the database trait version ("16" in this test app) to set the StatefulSet image, but this test expects postgres:18. Align the expected image (and the existingSts seed image) with the trait version, or update the trait version if the default is being bumped.
| - db | ||
|
|
||
| db: | ||
| image: postgres:18-alpine |
There was a problem hiding this comment.
Local docker-compose uses postgres:18-alpine, but the operator's default Postgres version is 16 (apps/operator/internal/controller/database/traits.go:19). Consider aligning the local dev image tag with the platform default (or parameterizing it) to avoid version drift between local and cluster environments.
| image: postgres:18-alpine | |
| image: postgres:16-alpine |
|
Can you resolve the conflicts? |
|
Also, can you provide screenshots to prove that the new template can be created, CI/CD pipeline run and deployed successfully? |
c30b5b9
into
features/sprint4-backend-templates-db-injection









Type of change
Checklist