-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The nr-wrf project uses GitHub Actions for continuous integration and continuous deployment to OpenShift. The pipeline is designed to seamlessly move code from development through testing to production with appropriate approval gates.
At a high level:
- Creating a PR will deploy that code to the delivery environment. Any further commits to that PR will migrate those commits to the dev environment.
- Merging the PR into main will trigger deployment requests to test and production (each of which must be manually approved)
When a developer creates a pull request:
- PR Greeting - An automated greeting is posted to the PR itself with links to the deployment environment
-
Build Phase - The pipeline builds container images for both backend and frontend components
- Images are tagged with the PR number (e.g.,
bcgov/nr-wrf/backend:123) - Images are pushed to GitHub Container Registry (GHCR)
- Images are tagged with the PR number (e.g.,
-
Deploy to Dev - Automatic deployment to the development environment
- Note that each PR creates its own deployment environment with its own URL. Once a PR is merged into main, the deployment environment is removed. This allows multiple instances to run in dev at the same time, each isolated from the other (thus the need for unique URLs)
- Components deployed: backend, frontend, init (can be used for automated database migrations, if a database is added in the future)
- Available at URLs like:
https://wrf-{pr-number}-frontend.apps.silver.devops.gov.bc.ca/
When the PR is merged to main:
- Cleanup - Non-merged PRs trigger cleanup of dev environment artifacts
-
Image Promotion - If merged successfully, images are promoted from PR-tagged to
testtag- This prepares images for the next phases
After merge to main, the merge-main workflow executes:
-
TEST Deployment (requires
testenvironment approval)- Automatic trigger: Runs immediately when merge-main workflow executes
- Requires approval: Uses GitHub environment secrets
- Deploys with
ZONE=test, indicating the environment the application is deployed to. - Promotes images from PR registry to test environment
- Components deployed: backend, frontend, init
After test deployment succeeds:
-
PROD Deployment (requires
prodenvironment approval)- Gated deployment: Only runs after test succeeds
- Requires approval: Uses GitHub environment secrets for prod
- Deploys with
ZONE=prod - Promotes images from test to prod registry
- Components deployed: backend, frontend, init
-
Image Promotion to PROD
- Final step promotes container images from test tag to prod tag in GHCR
Once a PR is merged into main, designated approvers can approve migrations to test, and then to production. PRs that are awaiting an approval are designated on the actions screen with a "time" icon:

Clicking on the action will display a button that approvers must click to promote the application to test and/or prod:
| Environment | Trigger | Approval Required | Purpose |
|---|---|---|---|
| Dev | PR created | None | Developer testing, ephemeral |
| Test | Main merge | Yes (test) | QA and integration testing |
| Prod | Main merge | Yes (prod) | Production workloads |
The project uses OpenShift Template objects with parameterized YAML files:
-
Backend:
backend/openshift.deploy.yml -
Frontend:
frontend/openshift.deploy.yml -
Init (Setup):
common/openshift.init.yml
All secrets are configured at the GitHub repository level and are consumed by the GitHub Actions workflows.
These secrets are required for both PR and main branch workflows:
| Secret | Purpose | Example |
|---|---|---|
OC_TOKEN |
OpenShift authentication token | Kubernetes service account token |
OC_SERVER |
OpenShift API server URL | https://api.silver.devops.gov.bc.ca:6443 |
OC_NAMESPACE |
OpenShift project namespace | {project-prefix}-{env} |
GITHUB_TOKEN |
GitHub token for GHCR access | Automatically provided by GitHub Actions |
Additional environment secrets can be configured in GitHub for test and prod environments to override repository secrets if needed.
Note: The same OC_TOKEN, OC_SERVER, and OC_NAMESPACE are used across all environments (dev, test, prod). The ZONE parameter in the deployment templates distinguishes between environments.
-
- Triggers on: Pull request creation/update
- Jobs: PR greeting, builds (backend/frontend), deployment to dev
-
.github/workflows/pr-close.yml
- Triggers on: Pull request closure
- Jobs: Dev cleanup, image promotion to test (if merged)
-
.github/workflows/merge-main.yml
- Triggers on: Push to main branch
- Jobs: Test deployment, prod deployment (gated), image promotion to prod
Common parameters across deployment templates:
- NAME: wrf (project name)
- COMPONENT: backend | frontend (component name)
- ZONE: dev | test | prod (environment identifier)
- IMAGE_TAG: latest (or specific version)
- CPU_REQUEST: 25m
- MEMORY_REQUEST: 50Mi
- CPU_LIMIT: 75m
- MEMORY_LIMIT: 150Mi
- MIN_REPLICAS: 1-3 (HPA minimum)
- MAX_REPLICAS: 2-5 (HPA maximum)
- REGISTRY: ghcr.io (container registry)
- PROMOTE: bcgov/nr-wrf/{component}:{source-tag}
- DOMAIN: apps.silver.devops.gov.bc.ca-
Dev deployments:
-p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - Test/Prod deployments: Uses default values (3 minimum, 5 maximum replicas)
Developer Push
↓
PR Created → Dev Build & Deploy (bcgov/nr-wrf/{component}:{pr-number})
↓
PR Merged to Main
↓
Image Promotion: {pr-number} → test
↓
Main Merge Workflow Triggered
├→ Test Deploy (gated) - images from test tag
├→ Prod Deploy (gated) - after test succeeds
└→ Image Promotion: test → prod
- Concurrency Control: Workflows use concurrency groups to cancel in-progress runs when new pushes occur
- Docker Registry: GHCR for all images, with tag-based versioning
-
Horizontal Pod Autoscaling: Configured via
MIN_REPLICASandMAX_REPLICASparameters - Network Policies: OpenShift NetworkPolicy objects created via init template
- Storage: Frontend uses NetApp file storage for persistent volumes