Skip to content

Setup .NET template#68

Merged
NgocAnhDo26 merged 10 commits into
features/sprint4-backend-templates-db-injectionfrom
users/hph/impl/template-dotnet
Apr 18, 2026
Merged

Setup .NET template#68
NgocAnhDo26 merged 10 commits into
features/sprint4-backend-templates-db-injectionfrom
users/hph/impl/template-dotnet

Conversation

@PhuocHoan
Copy link
Copy Markdown
Collaborator

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added evidence that prove my fix is effective or that my feature works
  • I have added unit tests for new feature
  • Existing unit tests pass locally with my changes
  • Prettier and linting checks pass (Backstage)
  • resolved Create .NET (C#) Web API Backstage Template #56

Copilot AI review requested due to automatic review settings April 12, 2026 13:53
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 12, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 587e9f9f-3781-4b53-ab89-9f41c7dbe664

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch users/hph/impl/template-dotnet

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

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

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_PASSWORD to DOCKER_TOKEN across Taskfile + prereq scripts + .env.example.
  • Update operator database controller tests to expect Postgres image tag 18 and adjust CORS origin config to include 127.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.

Comment on lines +31 to +44
}

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")
}));
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
}
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" }));

Copilot uses AI. Check for mistakes.
Comment on lines +211 to +212
if container.Image != "postgres:18" {
t.Errorf("Expected image %q, got %q", "postgres:18", container.Image)
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment on lines 349 to 353
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: "postgres", Image: "postgres:15"}},
Containers: []corev1.Container{{Name: "postgres", Image: "postgres:18"}},
},
},
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
- db

db:
image: postgres:18-alpine
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
image: postgres:18-alpine
image: postgres:16-alpine

Copilot uses AI. Check for mistakes.
@NgocAnhDo26
Copy link
Copy Markdown
Contributor

Can you resolve the conflicts?

@NgocAnhDo26
Copy link
Copy Markdown
Contributor

Also, can you provide screenshots to prove that the new template can be created, CI/CD pipeline run and deployed successfully?

@PhuocHoan
Copy link
Copy Markdown
Collaborator Author

These are screenshots that prove the template is working appropriately.

screencapture-127-0-0-1-8080-applications-argocd-pr68-dotnet-api-argocd-2026-04-15-22_19_39 screencapture-localhost-3000-catalog-default-component-pr68-dotnet-api-database-2026-04-15-22_19_17 screencapture-localhost-3000-catalog-default-component-pr68-dotnet-api-kubernetes-2026-04-15-22_18_20 screencapture-localhost-3000-catalog-default-component-pr68-dotnet-api-argo-cd-2026-04-15-22_18_02 screencapture-localhost-3000-catalog-default-component-pr68-dotnet-api-2026-04-15-22_16_41 screencapture-localhost-3000-catalog-default-component-pr68-dotnet-api-ci-cd-2026-04-15-22_17_08 screencapture-127-0-0-1-3030-helios-platform-pr68-dotnet-api-gitops-commits-branch-main-2026-04-15-22_16_28 screencapture-127-0-0-1-3030-helios-platform-pr68-dotnet-api-git-2026-04-15-22_16_19 Screenshot 2026-04-15 221609

@NgocAnhDo26 NgocAnhDo26 linked an issue Apr 18, 2026 that may be closed by this pull request
5 tasks
@NgocAnhDo26 NgocAnhDo26 merged commit c30b5b9 into features/sprint4-backend-templates-db-injection Apr 18, 2026
5 checks passed
@NgocAnhDo26 NgocAnhDo26 deleted the users/hph/impl/template-dotnet branch April 18, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create .NET (C#) Web API Backstage Template

3 participants