4.3 KiB
CI/CD Standards and Practices for Roleypoly
This document outlines the standards for CI/CD for Roleypoly. All Roleypoly repos must follow this document, and serves as a checklist for onboarding new services.
Checklist
- CI
- CD
Definitions
Branching Strategy
Branches should be named as follows:
master
is production code.develop
is actively developed code and is automatically deployed to staging.feat/
is any feature, branched fromdevelop
.fix/
is any fix targeted for next release, branched fromdevelop
.hotfix/
is any fix targeted for current release, branched frommaster
.ci/
is any CI-focussed branchchore/
is any other work not mentioned above.
Code Testing
Code should be tested where able. Discord interfaces can be very difficult to test properly, and are exempt; but code can preferrably be structured in a way that's able to both use Discord and test shims if possible.
Visual UI code must have a Storybook mock of it. Storybooks of develop
branch are available at https://ui.roleypoly.com via Vercel/Now.
Code Style
Go code must follow go fmt
rules.
JS/TS code must follow prettier
rules as defined in https://github.com/roleypoly/ui/blob/develop/.prettierrc.js
Styles must follow stylelint
rules as defined in https://github.com/roleypoly/ui/blob/develop/.stylelintrc
Failing these rules should fail PR checks and builds.
Docker Build
Services will be packaged and deployed with Docker. A GitHub Action for using buildkit/buildx is available at roleypoly/actions/dxt
Please follow best practices when creating Dockerfiles. Output images must be as small as genuinely possible.
Docker Tagging
Docker tags must always be the current commit hash, as well as the following mapping:
master
=>latest
develop
=>next
ci/testing.*
=>scratch
Services may define other mappings on top of this.
A GitHub Action is available for retagging images at roleypoly/actions/retag accompanied with a .retag.yml
(example)
Container Structure Testing
All Docker containers must be validated with a Container Structure Test. These are meant to define desired states to ensure it builds to the original specifications. One of these tests does not need to be deeply perfect, just a loose indictator of success and required parts.
Deployment Trigger
All services must utilize the GitOps automation workflow trigger provided by the GitHub Action roleypoly/actions/deploy. This will automatically ensure infrastructure is in the new desired state.
Dependabot
All services may optionally use Dependabot. Please define its configuration in code. Automerging is preferred, but please make sure tests will catch potential issues. Broken staging is better than broken production 😁
Deployment Runner and Config
roleypoly/devops defines an action that gets triggered by roleypoly/actions/deploy that updates terraform/app/tags.auto.tfvars.json
. Please add your service to that file alongside any other Kubernetes configurations it needs.
Terraform & Kubernetes
roleypoly/devops defines the Kubernetes cluster as well as the app cluster itself, too. Please adjust the cluster as necessary. Changes are not automatically applied, except for app staging; please contact core maintainers for help.