Skip to content

Commit d4b5e14

Browse files
Copilotneilime
andcommitted
docs: add methodology best practices section
Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
1 parent ff56ba4 commit d4b5e14

File tree

6 files changed

+129
-0
lines changed

6 files changed

+129
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# DevX Coding Rules
6+
7+
Shared commit, branch, and pull request habits keep Hoverkraft repositories releasable and automation-friendly.
8+
9+
## Conventional commits as the contract
10+
11+
- Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) prefixes (`feat:`, `fix:`, `chore:`, `docs:`, `refactor:`, `build:`, `ci:`).
12+
- Enforce the convention at PR time with the [`semantic-pull-request` workflow](../../../projects/ci-github-common/github/workflows/semantic-pull-request) or the workflow validation steps from the [Docker base images golden path](../golden-paths/docker-base-images/03-workflows-setup.md#workflow-overview).
13+
- Keep PR titles aligned with the conventional prefix to feed release automation and change logs.
14+
15+
## Atomic, reviewable changes
16+
17+
- Prefer **one change per pull request**: new feature, bug fix, refactor, or documentation update—avoid mixing concerns.
18+
- Keep PRs small and scoped so automated checks (lint, tests, previews) finish quickly and reviewers can focus on signal.
19+
- Update or add tests alongside code changes; if a behavior changes, document it in the PR body.
20+
21+
## Semantic-release friendly history
22+
23+
- Semantic version bumps flow from commit intent (`feat` → minor, `fix` → patch, `!` or `BREAKING CHANGE` → major). See the release walkthrough in the [Docker base images golden path](../golden-paths/docker-base-images/04-release-publishing.md#release-workflow-overview).
24+
- Tag releases from CI, not locally. Let automation publish release notes to keep provenance and SBOMs consistent.
25+
- Avoid squashing after approval if it would merge unrelated scopes—prefer merge strategies that preserve the meaningful prefixes used by release automation.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
# Dockerfile + BuildKit / Buildx
6+
7+
Guidance for fast, reproducible image builds with security baked in.
8+
9+
## Write Dockerfiles for reuse
10+
11+
- Use multi-stage builds with explicit `ci` and `prod` targets as shown in the [application repository scaffold](../golden-paths/application/02-repo-scaffold.md#dockerfile).
12+
- Keep base images small and pinned; avoid `latest`. Set `USER` and use `--chown` when copying sources to prevent root-owned artifacts.
13+
- Externalize config via `ARG`/`ENV` and prefer `COPY` over `ADD`. Keep build arguments minimal and validated in CI.
14+
15+
## Build with BuildKit and Buildx
16+
17+
- Enable BuildKit features such as `RUN --mount=type=cache` for dependency caches and `--mount=type=secret` for one-off credentials. See the cache configuration in the [docker build workflow](../../../projects/ci-github-container/github/workflows/docker-build-images#workflow-call-inputs).
18+
- Export inline cache and provenance (`BUILDKIT_INLINE_CACHE=1`, `--provenance=true`) so downstream jobs can reuse layers and attach SBOMs, as done in the [release workflow](../../../projects/docker-base-images/github/workflows/release#usage).
19+
- Build multi-platform images with `docker buildx build --platform linux/amd64,linux/arm64` and push by digest; avoid rebuilding the same target in multiple jobs.
20+
21+
## Secure the build
22+
23+
- Do not bake secrets into images; inject at runtime via environment or secret stores. Prefer `cosign` or similar signing after build—see the [sign-images action](../../../projects/ci-github-container/actions/docker/sign-images/).
24+
- Run scanners (Trivy, Grype) on built images and fail on critical findings. Keep the Dockerfile linted with Hadolint rules mirrored in CI.
25+
- Keep a single source of truth for image names and tags; the [application hygiene checklist](../golden-paths/application/05-hygiene.md#operating-principles) shows how to keep Dockerfiles, CI, and Helm values aligned.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# GitHub Actions & Workflow Practices
6+
7+
Opinionated guardrails for reliable, secure, and maintainable workflows across Hoverkraft projects.
8+
9+
## Design for reuse and clarity
10+
11+
- Prefer reusable workflows (`workflow_call`) for common flows (lint, build, release); see the [`ci-github-*` workflow catalog](../../../projects/ci-github-common/) and the [application golden path](../golden-paths/application/ci-cd/github/index.md#shared-ci-__shared-ciyml).
12+
- Keep jobs single-responsibility (lint, test, package, deploy) and gate merges on the smallest necessary set of required checks.
13+
- Use matrices for platform/runtime coverage and [`needs`] to make dependencies explicit.
14+
15+
## Security by default
16+
17+
- Pin actions by commit SHA and scope the `permissions` block to the minimum needed per job.
18+
- Prefer OIDC + short-lived cloud credentials over long-lived secrets; avoid passing tokens into containers unless required.
19+
- Run `npm ci`/`pip install --no-cache-dir` inside build steps instead of reusing host caches that may contain untrusted files.
20+
21+
## Performance and determinism
22+
23+
- Cache dependencies and build outputs via `actions/cache` with explicit keys; reuse the cache hints from the [Docker build workflows](../../../projects/ci-github-container/github/workflows/docker-build-images#workflow-call-inputs) when building images.
24+
- Avoid duplicated work: promote artifacts between jobs (e.g., build once, test with the artifact) and use concurrency controls (`concurrency` group with `cancel-in-progress: true`) for branches.
25+
- Keep workflow inputs typed and validated; prefer small composite actions for repeated snippets instead of inlining large bash blocks.
26+
27+
## Observability and recovery
28+
29+
- Always upload failing logs, test reports, and artifacts needed for triage. The [release workflows](../golden-paths/docker-base-images/04-release-publishing.md#release-workflow-overview) show the pattern for publishing SBOMs and provenance alongside images.
30+
- Emit clear step names and link back to the documentation page for the workflow being used so contributors know the source of truth.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
sidebar_position: 4
3+
---
4+
5+
# Helm Chart Practices
6+
7+
Patterns for reliable, upgrade-friendly charts that stay in sync with built images.
8+
9+
## Structure and values hygiene
10+
11+
- Keep a single chart per deployable service; for multi-service repos, use an umbrella chart plus per-service subcharts as in the [application golden path scaffold](../golden-paths/application/02-repo-scaffold.md#helm-chart).
12+
- Treat `values.yaml` as defaults and keep environment overlays small; prefer typed inputs with `values.schema.json` to fail fast on unknown keys.
13+
- Version charts with the same cadence as application releases; surface the image tag (digest when possible) in values to make rollbacks deterministic.
14+
15+
## Templates and security
16+
17+
- Keep templates minimal and parameterized—avoid hard-coded hostnames, storage classes, or secret names.
18+
- Run containers as non-root, set resource requests/limits, and enable liveness/readiness probes. Mirror the container security posture defined in your Dockerfile.
19+
- Keep ingress, network policy, and service account definitions optional but documented with sensible defaults.
20+
21+
## CI/CD alignment
22+
23+
- Render and lint charts in CI (`helm lint`, `helm template`) before publishing. The [verification checklist](../golden-paths/application/04-verify.md#what-success-looks-like) shows the validation flow used in golden paths.
24+
- Publish charts from CI alongside the image build that produced the referenced tag; avoid manual `helm package` from workstations.
25+
- Document deployment workflows (e.g., Argo CD dispatch in [ci-github-publish](../../../projects/ci-github-publish/github/workflows/deploy-chart)) and link them from the chart README to avoid drift.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
# Best Practices
6+
7+
Hoverkraft best practices centralize the opinionated guidance that shows up across our templates, reusable workflows, and golden paths. Use this section to align teams on shared defaults and to avoid duplicating recommendations in multiple docs.
8+
9+
## How to use this section
10+
11+
1. **Start here** to understand the recommended defaults.
12+
2. **Follow the links** to the detailed implementations in golden paths and reusable workflow docs.
13+
3. **Reference instead of duplicating**: when you document a best practice elsewhere, point back to this section.
14+
15+
## Topics
16+
17+
- **[DevX coding rules](./devx-coding-rules.md)** — Conventional commits, atomic changes, and semantic releases
18+
- **[GitHub Actions & workflow practices](./github-actions.md)** — Secure, maintainable, and cache-aware workflows
19+
- **[Dockerfile + BuildKit/Buildx](./docker-buildkit-buildx.md)** — Fast, reproducible image builds with caching and security defaults
20+
- **[Helm charts](./helm-chart.md)** — Chart structure, values hygiene, and release discipline

application/docs/methodology/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Step-by-step golden paths for creating new repositories using Hoverkraft's reusa
3535
- **[Golden Paths Overview](./golden-paths/)**: Opinionated journeys for bootstrapping new projects
3636
- **[Docker Base Images Golden Path](./golden-paths/docker-base-images/)**: Create your own Docker base images repository with automated builds and semantic versioning
3737

38+
### Best Practices
39+
40+
- **[Best Practices](./best-practices/)**: Centralized guidance for coding standards, workflows, container builds, and Helm charts to keep recommendations consistent across repositories.
41+
3842
## Key Principles
3943

4044
### 1. Infrastructure as Code

0 commit comments

Comments
 (0)