Skip to content

Latest commit

 

History

History
150 lines (105 loc) · 13.1 KB

README.md

File metadata and controls

150 lines (105 loc) · 13.1 KB

Testing

Overview

The registry repository (flamingo-stack/registry) is a lean, non-application repository: its core content is a declarative image-sync manifest, regsync-config.yaml, and the GitHub Actions workflows that operate on it. The repository graph records no runtime dependencies and no downstream consumers: it publishes no artifact that another repository pins, and no repository is recorded consuming it. This means "testing" here is almost entirely about CI-enforced checks on configuration and workflow files, not about unit or integration test suites for application code.

Note: The ecosystem index coverage for this repository is partial. An empty consumer or dependency list does not prove nothing depends on this repository; one repository in the organization is not currently visible in the graph.

Because there is no package.json, no pom.xml, and no CLI/shell/Docker Compose bootstrap recorded for this repository, there is no conventional test runner (npm test, mvn test, pytest, go test) to document here. What exists instead is a set of active code-review rules that are mechanically applied to pull requests touching regsync-config.yaml and the workflow files under .github/workflows/. Treat these rules as the repository's test suite: they are the checks a change must pass before it is considered correct.

Test Structure And Organization

There is no test/ or tests/ directory in this repository's material. Instead, correctness is organized around two kinds of artifacts:

Artifact What It Governs Enforced By
regsync-config.yaml Which upstream container images are mirrored to GHCR, at which tag ranges REGISTRY-00x code-review rules
.github/workflows/regsync-images-to-ghcr.yml How and when the sync runs in CI REGISTRY-006 through REGISTRY-010-2 rules
.github/workflows/lint.yml PR hygiene (title format, assignee) GitHub Actions job lint
.github/workflows/code-documentation.yml The documentation pipeline's own stages N/A (not application code)
.github/workflows/flamingo-code-review.yml The automated code-review pipeline itself N/A (not application code)

Because the repository's "logic" is a YAML manifest consumed by the regsync CLI, there is no business logic to unit-test in the traditional sense. The equivalent of writing a test here is writing or editing a sync: entry in regsync-config.yaml in a way that satisfies the review rules, and the equivalent of running tests is letting the automated code-review workflow evaluate your pull request.

registry/
├── .github/
│   ├── workflows/
│   │   ├── code-documentation.yml        # doc pipeline (stages 0-3)
│   │   ├── flamingo-code-review.yml       # automated PR review
│   │   ├── lint.yml                       # PR title / assignee checks
│   │   └── regsync-images-to-ghcr.yml     # the image-sync job
│   └── CODEOWNERS
└── regsync-config.yaml                    # the sync manifest itself

Running Tests

PR Title Lint

The closest thing to an always-on automated test in this repository is the lint job defined in .github/workflows/lint.yml. It runs on pull_request events (opened, edited, reopened, synchronize) and checks that the PR title matches the conventional-commit-style pattern:

^(feat|fix|perf|refactor|docs|test|build|ci|chore|style|revert)(\(.+\))?!?: .+$

For example, fix(armor): exclude billing action passes; a title without a recognized type prefix fails the job with an explicit error message. The job also auto-assigns the PR to its author when opened by a human user (github.event.pull_request.user.type == 'User').

There is no local equivalent command to run this check before opening a PR beyond reading the regex yourself; the job calls gh pr view ... --json title -q .title | grep -qE "..." against the live PR title, so the fastest local approximation is running that same grep -qE pattern against your intended title.

Automated Code Review

Every pull request is evaluated by .github/workflows/flamingo-code-review.yml ("🦩 Flamingo Code Review"). This is dispatched by the Flamingo hub and runs the organization's active review rules against the diff. For this repository those rules are concentrated on regsync-config.yaml and the workflow files (see "Coverage Requirements" below for the specific rule set). A reviewer can also explicitly request a pass by commenting @flamingo-review (or @flamingo-review full to re-read the whole cumulative diff) on an open pull request, or by adding the flamingo-review label.

There is no separate "run tests locally" step for this repository's own code, because the repository has no application runtime to execute. Validating a change to regsync-config.yaml means:

  1. Confirming the YAML parses (any YAML-aware editor or yamllint works, though neither is wired into this repository's CI as a dedicated job in the material available).
  2. Confirming each new or changed sync: entry satisfies the structural rules described below.
  3. Opening the PR and letting flamingo-code-review and lint run.

Image-Sync Job Itself

The sync-images job in regsync-images-to-ghcr.yml is the operational "integration test" of the manifest: it actually exercises regsync-config.yaml against the real upstream registries. It is not triggered on every push; it runs only on:

  • schedule (cron: '0 2 * * 0', weekly)
  • workflow_dispatch (manual run)

The job's own if: condition restricts execution to exactly those two event types, per rule REGISTRY-008. Concretely, the job:

  1. Checks out the repository with actions/checkout@v4.
  2. Logs into ghcr.io with docker/login-action@v3.
  3. Installs regsync at a pinned version (REGSYNC_VERSION: v0.10.0) by downloading the regsync-linux-amd64 release binary.
  4. Substitutes ${TARGET_REGISTRY} into a copy of the manifest with envsubst < regsync-config.yaml > regsync-config-tmp.yaml.
  5. Runs regsync once -c regsync-config-tmp.yaml.

If you want to validate a manifest change end-to-end before merging, the safest option recorded in this repository is to trigger this workflow manually via workflow_dispatch (for example from the GitHub Actions UI at https://github.com/flamingo-stack/registry/actions) rather than waiting for the weekly schedule.

Writing New Tests

Since this repository's "tests" are review rules applied to configuration, "writing a new test" in practice means one of two things: adding a new sync: entry that already conforms to the existing rules, or — if you are extending the workflow itself — keeping new workflow steps consistent with the security and reliability rules already enforced on .github/workflows/regsync-images-to-ghcr.yml.

Adding A New Image Sync Entry

When adding a new block to regsync-config.yaml, follow the established, rule-enforced shape:

# =============================================================================
# <Category Name>
# <one-line description of what this group covers>
# Includes: image-a, image-b
# =============================================================================
- source: docker.io/<org>/<image>
  target: ${TARGET_REGISTRY}/<org>/<image>
  type: repository
  tags:
    allow: '^v?[0-9]+\.[0-9]+\.[0-9]+(-alpine)?$'
    semverRange: '>=X.Y.Z'

Checklist derived from the active rules on regsync-config.yaml:

  • semverRange floor is mandatory (REGISTRY-001, REGISTRY-001-2): every sync block must declare a lower-bound semverRange (e.g. >=1.2.0) under tags or inside each tagSets item, unless the allow pattern is already tightly bounded (for example a single pinned snapshot tag). An entry that relies only on an allow regex with no floor pulls unbounded historical tags.
  • type: repository only (REGISTRY-005): tag-level sync types are not used, because they bypass the semverRange/allow filtering.
  • target must stay prefixed with ${TARGET_REGISTRY} (REGISTRY-004-2): never hardcode a registry hostname like ghcr.io/flamingo-stack directly; the variable is injected at runtime by envsubst in the workflow.
  • target must mirror the source path (REGISTRY-003, REGISTRY-005-2): preserve the upstream org/image segment exactly, e.g. docker.io/bitnamilegacy/kafka → ${TARGET_REGISTRY}/bitnamilegacy/kafka. Docker Hub official library images (no org prefix, e.g. docker.io/library/postgres) drop the library/ segment on both sides: ${TARGET_REGISTRY}/postgres.
  • Bitnami images must come from bitnamilegacy, not bitnami (REGISTRY-010): all Bitnami-origin sources use docker.io/bitnamilegacy/<image>.
  • Alpine-variant blocks must only allow -alpine tags (REGISTRY-002): don't mix Alpine and non-Alpine patterns in the same block.
  • No bare latest in allow patterns (REGISTRY-002-2) unless the entry carries an inline comment justifying the exception. Standard patterns are semver regexes ([0-9]+\.[0-9]+\.[0-9]+, v[0-9]+\.[0-9]+\.[0-9]+), optionally suffixed -alpine or -debian-N-rN.
  • Every group needs a banner comment (REGISTRY-003-2, REGISTRY-004): a # ===...=== header, a category title, a one-line description, and an # Includes: line. Entries outside any banner are not permitted. Non-obvious configuration (e.g. an unusually tight semverRange to dodge rate limiting) should carry its own inline comment.

Changing The Sync Workflow

If you touch .github/workflows/regsync-images-to-ghcr.yml itself, the following rules from the active catalog bind that file specifically:

  • envsubst output must go to a -tmp.yaml file before being handed to regsync (REGISTRY-006) — never substitute in place over regsync-config.yaml.
  • Any script downloaded at CI runtime from the Flamingo hub must go through the shared download_and_verify helper against the hub's manifest digest, never a hash pinned in the workflow YAML (REGISTRY-006-2).
  • The regsync binary version must be pinned through a step-level env block (REGSYNC_VERSION: vX.Y.Z), referenced as ${REGSYNC_VERSION} — not hardcoded into the curl URL and never latest (REGISTRY-007).
  • The job's if: must keep execution limited to workflow_dispatch and schedule (REGISTRY-008).
  • Any actions/checkout step in a job that processes untrusted PR content must set persist-credentials: false (REGISTRY-008-2).
  • Jobs triggered by pull_request must gate on non-draft, non-bot, same-repo PRs simultaneously (REGISTRY-009-2).
  • Any workflow calling the Flamingo hub must validate and normalize HUB_BASE_URL as its first run step, failing loudly if empty and stripping a trailing slash (REGISTRY-010-2).

Fork-Specific Edits

If a change to a file that originates from an upstream fork (the broad **/*.go, **/*.yaml, **/*.tpl glob under rule FLEETMDM-001, which also matches regsync-config.yaml) needs to diverge from upstream behavior, wrap the diverging lines in sentinel comments:

# >>> OPENFRAME(<slug>): <why> — openframe/docs/<doc>.md
...changed lines...
# <<< OPENFRAME(<slug>)

This lets upstream syncs locate and re-apply fork-specific logic later.

Coverage Requirements

This repository has no statement/branch coverage percentage target, because there is no test runner producing a coverage report in the material available (no package.json, no pom.xml, no CLI/shell/Docker Compose setup recorded). "Coverage" here means rule coverage: every change to regsync-config.yaml or the sync workflow is expected to satisfy the full set of active REGISTRY-* rules listed above, plus the broader FLEETMDM-001 sentinel-comment rule where it applies.

The active rule catalog for this repository currently totals 40 rules across several languages and scopes (YAML, Go, Java, TypeScript, C++, Rust, Terraform, Makefile, Shell) — most of those rules target other repositories' file patterns and simply do not match anything here; the ones that actually apply to flamingo-stack/registry's own files are the REGISTRY-* series and the matching entries of FLEETMDM-001 and RENOVATE-003 shown above. Before merging a change:

  1. Confirm every new or edited sync: block includes a semverRange floor.
  2. Confirm type: repository is set.
  3. Confirm the target field keeps the ${TARGET_REGISTRY} prefix and mirrors the source path.
  4. Confirm the group sits under a # === banner with a description and # Includes: line.
  5. Confirm Bitnami sources use bitnamilegacy, not bitnami.
  6. Let .github/workflows/lint.yml validate the PR title, and let .github/workflows/flamingo-code-review.yml evaluate the diff against the rules above — treat a passing review as the acceptance bar for this repository, since there is no numeric coverage percentage to target.

If you are unsure whether a particular rule applies to a file you are about to touch, the organization's review tooling can be asked directly for the rules currently scoped to that path before you open the PR.

For broader repository setup and how this repository fits the documentation and review pipelines shared across the organization, see the development overview.