The DevOps Quickstart is a fully functional set of pipeline workflows and a starter application stack intended to help Agile DevOps teams hit the ground running. Currently OpenShift is supported with plans for AWS (Amazon Web Services). Pipelines are run using GitHub Actions.
Features:
Runs on pull request submission.
Runs on pull request close or merge.
Runs on merge to main branch.
* excludes database changes
Runs on pull request submission or merge to main.
The starter stack includes a (React, MUI, Vite, Caddy) frontend, Pluggable backend(Nest/Node, Quarkus/Java On Native, FastAPI/Python, Fiber/Golang) and postgres database. See subfolder for source, including Dockerfiles and OpenShift templates.
Features:
Postgres is default. Switch to PostGIS by copying the appropriate Dockerfile to ./database
:
cp ./database/postgis/Dockerfile ./database
Initial setup is intended to take four hours or less. This depends greatly on intended complexity, features selected/excluded and outside cooperation.
The following are required:
Create a new repository using this repository as a template.
Variables and secrets are consumed by workflows. Environments provide their own sets of secrets and variables, overriding default sets.
Repository secrets and variables are available to all workflows, except pull requests triggered by Dependabot.
Secrets are hidden from logs and outputs, while variables are visible. Using secrets exclusively can make troubeshooting more difficult.
Click Settings > Secrets and Variables > Actions > Secrets > New repository secret
Click Settings > Secrets and Variables > Actions > Variables > New repository variable
Environments are groups of secrets and variables that can be gatekept. This includes limting access to certain users or requiring manual approval before a requesting workflow can run. Environment values override any default values.
Click Settings > Environments > New environment
Environments provide a number of features, including:
GITHUB_TOKEN
Default token. Replaced every workflow run, available to all workflows.
{{ secrets.GITHUB_TOKEN }}
OC_TOKEN
OpenShift token, different for every project/namespace. This guide assumes your OpenShift platform team has provisioned a pipeline account.
{{ secrets.OC_TOKEN }}
Locate an OpenShift pipeline token:
pipeline-token-...
or a similarly privileged tokentoken
OC_TOKEN
(see above)SONAR_TOKEN and Other Sonar Tokens
If SonarCloud is being used each application will have its own token. Single-application repositories typically use ${{ secrets.SONAR_TOKEN }}
, but monoreposities will have multiple, like ${{ secrets.SONAR_TOKEN_BACKEND }}
and ${{ secrets.SONAR_TOKEN_FRONTEND }}
.
BC Government employees can request SonarCloud projects from bcdevops/devops-requests by creating a SonarCloud request/issue. This template expects a monorepo, so please ask for that and provide component names (e.g. backend, frontend).
OC_SERVER
OpenShift server address.
{{ vars.OC_SERVER }}
https://api.gold.devops.gov.bc.ca:6443
or https://api.silver.devops.gov.bc.ca:6443
OC_NAMESPACE
OpenShift project/namespace. Provided by your OpenShift platform team.
{{ vars.OC_NAMESPACE }}
abc123-dev | test | prod
Squash merging is recommended for simplified history and ease of rollback. Cleaning up merged branches is recommended for your DevOps Specialist's fragile sanity.
Click Settings > General (selected automatically)
Pull Requests:
[uncheck] Allow merge commits
[check] Allow squash merging
Default to pull request title
[uncheck] Allow rebase merging
[check] Always suggest updating pull request branches
[uncheck] Allow auto-merge
[check] Automatically delete head branches
Packages are available from your repository (link on right). All should have visibility set to public for the workflows to run successfully.
E.g. https://github.com/bcgov/nr-fop/packages
This is required to prevent direct pushes and merges to the default branch. These steps must be run after one full pull request pipeline has been run.
Add Rule
or edit an existing ruleProtect matching branches
specify the following:
main
[check] Require a pull request before merging
[check] Require approvals
(default = 1)[check] Dismiss stale pull request approvals when new commits are pushed
[check] Require review from Code Owners
[check] Require status checks to pass before merging
[check] Require branches to be up to date before merging
Status checks that are required
:
[check] Require conversation resolution before merging
[check] Include administrators
(optional)Don't forget to add your team members!
Add people
or Add teams
Members of the BC Government's Natural Resource minisistries are strongly recommended to follow the recommendations in their Kickstarter Guide. The linked document is generated from Confluence, so some links may be internal-only (sorry!).
Natural Resources Kickstarter Guide
The quickstart comes with several pluggable backend components. Please delete the extra backends and remove them from any related workflows.
Currently, the unit testing and integration testing is done in the same stage. Please make sure the database container is up and running. please run this command from the root of the repository if the DB container is not running.
docker compose up -d database
# or
podman compose up -d database
The database documentation are auto generated by SchemaSpy and deployed to GitHub pages, it is available here.
Please update the pages in the repo settings as per the screenshot.
Please contribute your ideas! Issues and Pull Requests are appreciated.
This Action is provided courtesy of the Forestry Suite of Applications, part of the Government of British Columbia.