Skip to content

Add CI/CD workflow with release versioning and GitOps frontend/backend deployments#5

Open
Copilot wants to merge 4 commits intomainfrom
copilot/create-github-workflow-for-docker-images
Open

Add CI/CD workflow with release versioning and GitOps frontend/backend deployments#5
Copilot wants to merge 4 commits intomainfrom
copilot/create-github-workflow-for-docker-images

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

Adds a GitHub Actions pipeline to test, build, and push Docker images to GHCR, plus the missing frontend Kubernetes deployment. On release, Docker images are tagged with the release version and GitOps manifests are automatically updated via kustomize.

CI/CD Workflow (.github/workflows/ci.yml)

  • test-backend: dotnet build + test (unit & integration)
  • test-frontend: npm run build (vue-tsc type-check + vite build)
  • build-and-push (main branch push or release, after tests pass): builds and pushes two images to ghcr.io:
    • ghcr.io/jwraats/wizard-rpg-api (backend)
    • ghcr.io/jwraats/wizard-rpg-frontend (frontend)
    • Tagged with latest + git SHA on push to main; additionally tagged with the release version (e.g., v1.0.0) on release
  • update-gitops (release only): installs kustomize, runs kustomize edit set image to update both image tags in kustomization.yaml, and commits/pushes to main so ArgoCD auto-syncs the new version

GitOps Updates

  • deployment.yaml: image → ghcr.io/jwraats/wizard-rpg-api:latest (overridden by kustomize images transformer on release)
  • New frontend-deployment.yaml: nginx container with ConfigMap volume mount, health probes, resource limits
  • New frontend-service.yaml: ClusterIP on port 80
  • New frontend-nginx-configmap.yaml: nginx config that proxies /api/ and /hubs/ to the wizard-rpg backend service
  • ingress.yaml: routes to wizard-rpg-frontend (frontend proxies API traffic to backend)
  • kustomization.yaml: includes new frontend resources; images transformer is auto-updated with version tags on release

Request flow

Ingress → wizard-rpg-frontend (nginx:80) → static SPA
                                          → /api/  → wizard-rpg:80 (backend:8080)
                                          → /hubs/ → wizard-rpg:80 (backend:8080)

Integration test fix

Fixed 6 failing integration tests caused by Guid.NewGuid() being evaluated inside the AddDbContext options lambda, which created a separate in-memory database per HTTP request. Moved the guid evaluation outside the lambda so all requests within a test share the same database.

Validated with kustomize build — all manifests render correctly with proper label isolation between frontend and backend selectors.

Copilot AI and others added 2 commits March 31, 2026 22:02
- Create .github/workflows/ci.yml with test, build, and Docker push jobs
- Update backend deployment image to ghcr.io/jwraats/wizard-rpg-api:latest
- Add frontend GitOps resources (deployment, service, nginx ConfigMap)
- Update ingress to route through frontend (which proxies API calls to backend)
- Update kustomization to include new frontend resources

Agent-Logs-Url: https://github.com/jwraats/Wizard-RPG/sessions/0d412dbc-f7fc-45c8-ab7d-8b7beec9cf90

Co-authored-by: jwraats <3438726+jwraats@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub workflow for testing and building Docker images Add CI/CD workflow and GitOps frontend/backend deployments Mar 31, 2026
Copilot AI requested a review from jwraats March 31, 2026 22:06
- name: wizard-rpg
# Update this image reference once the Docker image is built and pushed.
image: ghcr.io/jwraats/wizard-rpg:latest
image: ghcr.io/jwraats/wizard-rpg-api:latest
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Would like to use version tags. (so on release)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in 9a64245. The workflow now triggers on release: [published] and tags Docker images with the release tag name (e.g., v1.0.0). The base deployment keeps :latest as the default, but the update-gitops job uses kustomize edit set image to add an images transformer to kustomization.yaml that overrides the tag with the release version.

spec:
containers:
- name: wizard-rpg-frontend
image: ghcr.io/jwraats/wizard-rpg-frontend:latest
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Version tags.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as backend — on release, the frontend image gets tagged with the version and kustomize overrides the tag via the images transformer in kustomization.yaml. See 9a64245.

Comment thread .github/workflows/ci.yml
@@ -0,0 +1,114 @@
name: CI/CD
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Something with pushing the version tag to the gitops when the docker image is pushed maybe with kustomize?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added an update-gitops job in 9a64245. On release, after images are pushed, it checks out main, runs kustomize edit set image to set both image tags to the release version in kustomization.yaml, then commits and pushes. ArgoCD will pick up the change automatically.

@jwraats
Copy link
Copy Markdown
Owner

jwraats commented Mar 31, 2026

@copilot Resolve the PR comments

…x integration tests

- CI workflow: add release trigger, version-tagged Docker images, update-gitops job
- Fix integration tests: move Guid.NewGuid() outside AddDbContext lambda to share
  in-memory DB across requests (fixes 6/10 test failures)

Agent-Logs-Url: https://github.com/jwraats/Wizard-RPG/sessions/b51228a4-19e9-4a19-a58c-90d8c8d0a944

Co-authored-by: jwraats <3438726+jwraats@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot Resolve the PR comments

All three comments addressed in 9a64245. Also fixed the 6 failing integration tests — the root cause was Guid.NewGuid() inside the AddDbContext options lambda, which created a new in-memory database per HTTP request instead of sharing one across the test. All 10 tests pass now.

Copilot AI changed the title Add CI/CD workflow and GitOps frontend/backend deployments Add CI/CD workflow with release versioning and GitOps frontend/backend deployments Mar 31, 2026
Copilot AI requested a review from jwraats March 31, 2026 22:24
@jwraats jwraats marked this pull request as ready for review April 1, 2026 07:54
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.

2 participants