Skip to content

Latest commit

 

History

History
120 lines (85 loc) · 11.2 KB

guidelines.md

File metadata and controls

120 lines (85 loc) · 11.2 KB

Contributing Guidelines

This document explains how to propose, format, and get a change reviewed in the flamingo-stack/registry repository. Registry mirrors a curated set of upstream container images into GitHub Container Registry (GHCR) via regsync, and carries the shared Flamingo CI workflows (documentation and code review) used across the organization's repositories.

No GitHub Issues or Discussions. This repository does not use GitHub Issues or GitHub Discussions for planning or support. Coordination happens in the OpenMSP Slack community (https://www.openmsp.ai/). Pull requests remain the only mechanism for proposing and tracking code changes here.

Before You Start

Read these first if you have not already:

What This Repository Contains

Registry's primary configuration surface is regsync-config.yaml, read by the scheduled Sync Images to GHCR workflow (.github/workflows/regsync-images-to-ghcr.yml). That workflow runs regsync on a weekly cron (0 2 * * 0) or on manual dispatch, authenticates to GHCR with GITHUB_TOKEN, and syncs each configured upstream image into ghcr.io/<repository>.

Beyond the sync configuration, the repository carries the fleet-standard CI workflows:

  • .github/workflows/code-documentation.yml — the Flamingo documentation pipeline (code graph, reference docs, tutorials, repository docs).
  • .github/workflows/flamingo-code-review.yml — the Flamingo code review pipeline (on-demand and label-triggered PR reviews).
  • .github/workflows/lint.yml — PR title/lint checks.
  • .github/CODEOWNERS — ownership routing for review requests.

Per the ecosystem graph, this repository currently publishes no artifact pinned by another repository and has no recorded downstream consumers; coverage is partial, so an empty consumer list does not prove nothing depends on it elsewhere.

Code Style and Conventions

regsync-config.yaml

Because the bulk of hand-authored content in this repository is the sync manifest, most of its conventions are enforced by active review rules bound to that file:

  • Group entries under banner comments. Every logical group of images must be preceded by a # ===...=== banner, a category title, a short description, and an # Includes: line listing the images in the group. Ungrouped entries are rejected.
  • Declare a semverRange floor on every entry. Each sync block (under tags or within each tagSets item) needs at least one lower-bound constraint (for example >=1.2.0). Relying on allow regex alone pulls unbounded historical tags and risks syncing EOL images; the only accepted exception is when the allow pattern is itself tightly bounded (for example a single pinned snapshot tag).
  • Match versioned, immutable tags only. allow patterns should use semver-style regexes ([0-9]+\.[0-9]+\.[0-9]+, v[0-9]+\.[0-9]+\.[0-9]+), -alpine-suffixed variants, or -debian-N-rN-suffixed variants. Do not add latest to an allow list without an inline comment justifying it.
  • Keep Alpine variants pure. When syncing an Alpine build of an image, the allow regex must end in -alpine and must not also admit non-Alpine tags in the same block.
  • target must mirror source and use ${TARGET_REGISTRY}. Every target field begins with ${TARGET_REGISTRY}/, never a hardcoded hostname — TARGET_REGISTRY is substituted at runtime via envsubst in the sync workflow. The path suffix after that prefix must mirror the source registry path: a vendor-namespaced image (for example docker.io/bitnamilegacy/kafka) keeps its namespace in the target (${TARGET_REGISTRY}/bitnamilegacy/kafka); a Docker Hub library image (docker.io/library/postgres) drops the library/ segment in the target (${TARGET_REGISTRY}/postgres). Remapping to a different path is only acceptable when the source registry itself uses a non-standard namespace, and must stay consistent across every image in that group.
  • Every entry uses type: repository. Tag-level sync types are not used in this repository, since they would bypass the semverRange and allow filtering that enforces the version-floor policy.
  • Bitnami images come from docker.io/bitnamilegacy/. The legacy docker.io/bitnami/ namespace must not be used as a source; this repository has already migrated every Bitnami entry to the new namespace.

Workflow files (.github/workflows/*.yml)

  • Never pin a fetched script's hash in workflow YAML. Any script a workflow downloads from the Flamingo hub (/api/ci/scripts or its deprecated alias /api/doc-orchestrator/scripts) must go exclusively through the shared download_and_verify function after load_script_manifest, which checks the SHA-256 against the hub's own manifest.json. HASH_* environment variables and hand-rolled verification are retired and will be rejected; curl | bash and running a script before it is verified are both forbidden.
  • Checkout steps in review/doc jobs set persist-credentials: false. Any actions/checkout step inside a job that processes untrusted pull request content must disable credential persistence.
  • pull_request-triggered jobs gate on draft, bot, and fork status together. A job's if: must simultaneously check that the PR is not a draft, the actor is not a bot, and the PR's head repository matches github.repository. All three conditions must appear together — omitting any one of them is treated as a security gap.
  • Validate HUB_BASE_URL before the first hub call. Any workflow that talks to the Flamingo hub validates the base URL as its first run step: fail loudly with exit 1 and an ::error:: annotation if it is empty, and strip a trailing slash by rewriting it to $GITHUB_ENV.
  • In flamingo-code-review.yml, the report script downloads first. code-review-report.sh and its helper workflow-helpers.sh must be downloaded and hash-verified before checkout, cache restore, or any other script download, so the run can still report its status even if a later step fails.

General style

  • Follow the formatting and structure already present in regsync-config.yaml and the workflow files rather than introducing a new style; these files are shared infrastructure reused across the Flamingo fleet, and unexplained drift from the established pattern is flagged in review.
  • Keep comments that explain why a constraint exists (for example a tight semverRange to avoid upstream rate-limiting) next to the entry it applies to.

Branch Naming and PR Process

  1. Branch from the default branch. Create a feature branch for your change; there is no enforced naming prefix recorded in this repository's workflows beyond the reserved prefixes the documentation and review pipelines treat specially (ai-fix/, setup/, code-documentation/ are used by automation and should not be reused for manual branches).
  2. Open a pull request against the default branch. flamingo-code-review.yml and code-documentation.yml both run pull_request jobs that key off this.
  3. Request a review when ready. The code review workflow is triggered on request, not automatically on every push:
    • Add the flamingo-review label to a PR to ask for a (first or repeat) review pass.
    • Comment @flamingo-review on the PR to ask for an incremental pass, or @flamingo-review full to force a full re-read of the cumulative diff.
    • Checking the checkbox in the bot's invitation/summary comment also starts a review; it is the same mechanism as the comment command, surfaced as a clickable task.
    • The flamingo-review-always label subscribes a PR to review on every push (synchronize), intended for larger or riskier changes.
  4. Keep the PR from a same-repository branch. Workflows gate credentialed jobs on the PR's head repository matching this repository; a fork-based PR will not trigger the full automation.
  5. Merge once checks pass and review is resolved. The merge_group trigger in flamingo-code-review.yml means a repository with a required "tests-and-checks" ruleset gets a status report even on a queued merge.

Commit Message Format

PR titles (which become the commit message on squash-merge) are enforced by .github/workflows/lint.yml. The title must match:

type(scope): summary

Where type is one of:

feat | fix | perf | refactor | docs | test | build | ci | chore | style | revert

The (scope) is optional, and a trailing ! before the colon is allowed (for a breaking change). Examples that pass the check:

fix(regsync): pin semverRange floor for postgres image
ci: validate HUB_BASE_URL before first hub call
docs(contributing): document regsync-config.yaml conventions

An invalid title fails lint with:

Expected 'type(scope): summary', e.g. 'fix(armor): exclude billing action'; fix the title and re-run

Since the check reads the PR title live, editing the title and letting lint re-run is enough to fix a failure — no force-push required.

Review Checklist

Before requesting review, confirm:

  • PR title follows type(scope): summary with an allowed type.
  • regsync-config.yaml changes, if any:
    • The entry sits under an existing or new # ===...=== banner with a category title, description, and # Includes: line.
    • A semverRange floor is present (or the exception is explicitly justified in a comment).
    • allow patterns match only versioned, immutable tags; latest is not used without a justifying comment; Alpine blocks only admit -alpine tags.
    • type: repository is set.
    • target begins with ${TARGET_REGISTRY}/ and mirrors the source namespace (vendor namespace kept, library/ dropped for Docker Hub official images).
    • Bitnami images source from docker.io/bitnamilegacy/, not docker.io/bitnami/.
  • Workflow changes, if any:
    • Any newly fetched script goes through download_and_verify / load_script_manifest; no hash pinned directly in YAML.
    • actions/checkout steps in PR-processing jobs set persist-credentials: false.
    • pull_request-triggered jobs guard on non-draft, non-bot, same-repo together.
    • HUB_BASE_URL is validated and trailing-slash-stripped before any hub call.
  • CODEOWNERS still routes the touched paths correctly — .github/CODEOWNERS currently assigns the whole tree, and .github/CODEOWNERS itself, to @flamingo-stack/devops-engineers (last-match-wins, so a more specific override should sit below the wildcard).
  • The change does not duplicate a constant, list, or piece of logic that a single source of truth already owns elsewhere in the shared workflow files.
  • No GitHub Issue or Discussion was opened for this change — tracking happens in OpenMSP Slack and in the PR itself.

For environment setup needed to test a change locally, see Environment Setup and Local Development. For how this repository's pieces relate to one another, see Architecture Overview. For security-sensitive changes, also check Security, and for anything touching test scripts, see Testing.