127 lines
8.0 KiB
Markdown
127 lines
8.0 KiB
Markdown
# Making a change
|
|
|
|
Read this before starting a branch, committing, filing an issue or opening a pull request.
|
|
|
|
Every rule below gives its reason and how it is held: by a control (a named hook or check), by
|
|
review, or aspirational (checked by nothing and nobody). Links between the contributor docs are
|
|
held by review until an offline link check exists. Rules for roles are in
|
|
[roles/AGENTS.md](../../roles/AGENTS.md); rules for working with an agent, including commit
|
|
trailers, are in [ai-assistance.md](ai-assistance.md).
|
|
|
|
## Branches and pull requests
|
|
|
|
- **Work on a branch of your own and open a pull request against `main`; never push to `main`.**
|
|
*Reason:* every change reaches `main` through the Lint and Build checks and a reviewer.
|
|
*Held by:* control: branch protection on `main`.
|
|
- **Do not push to someone else's branch or to a bot's branch; put your change in a pull request of
|
|
your own.** Updating a branch from `main` with Gitea's update button is allowed.
|
|
*Reason:* a push changes a head its author already reviewed or scheduled to merge, and a hand-made
|
|
commit on a `renovate/` branch makes Renovate stop rebasing it.
|
|
*Held by:* aspirational.
|
|
- **File an issue or open a pull request with the headings of the matching template in `.gitea/`,
|
|
also when you file through the API, `tea` or an MCP server.**
|
|
*Reason:* those routes skip the templates, and an agent's built-in body leaves out what review needs.
|
|
*Held by:* review.
|
|
- **A pull request says under *Verified* what you ran (commands, linked CI runs) and under *Not
|
|
verified* what you did not.**
|
|
*Reason:* a reviewer can only judge a change by what was actually checked.
|
|
*Held by:* review.
|
|
|
|
## Commits
|
|
|
|
- **Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)** (`feat:`,
|
|
`fix:`, `docs:`, `ci:` ...).
|
|
*Reason:* the type tells a reviewer and the changelog what kind of change it is.
|
|
*Held by:* control: the `conventional-pre-commit` commit-msg hook, and the Lint check on every commit
|
|
of a pull request.
|
|
- **Never commit credentials, tokens or key material.**
|
|
*Reason:* a pushed secret has leaked, whatever later commits do.
|
|
*Held by:* control: the `gitleaks` hook, and the Lint check's scan of a pull request's commits.
|
|
|
|
## Changelog, versions and dependencies
|
|
|
|
- **A change a consumer can see needs a changelog fragment in `changelogs/fragments/`**: an
|
|
antsibull-changelog YAML file with one section. A pure CI or docs change needs none, or a `trivial:`
|
|
one. Pick the section by the release it calls for:
|
|
- major: `breaking_changes`, `removed_features`;
|
|
- minor: `minor_changes`, `deprecated_features`;
|
|
- patch: `bugfixes`, `security_fixes`, `known_issues`;
|
|
- never `major_changes` (its title reads like a major release; use `breaking_changes` or
|
|
`minor_changes`).
|
|
|
|
*Reason:* the changelog is built from the fragments, and the next version follows from their sections.
|
|
*Held by:* control for the format (the `antsibull-changelog-lint` hook); review for whether one is
|
|
needed and which section.
|
|
- **Write a fragment, never the version.** The maintainer sets `version` in `galaxy.yml` and tags
|
|
the release.
|
|
*Reason:* the version follows from all fragments since the last release, not from one change.
|
|
*Held by:* review (`galaxy.yml` is under `CODEOWNERS`).
|
|
- **A new Collection dependency states its reason in the pull request and has a version floor.**
|
|
*Reason:* every consumer has to install it, and without a floor an old version nobody tested
|
|
satisfies it.
|
|
*Held by:* review (`galaxy.yml` is under `CODEOWNERS`).
|
|
|
|
## Third-party material
|
|
|
|
- **Third-party material carries an SPDX header, a `REUSE.toml` annotation (which overrides file
|
|
headers) and an entry in `NOTICE`.**
|
|
*Reason:* the Collection is GPL-licensed and REUSE-compliant, so each file's licence and origin must
|
|
be recorded.
|
|
*Held by:* review, prompted by the pull request template's checkbox; the `reuse-lint` hook catches
|
|
a file with no licence at all.
|
|
|
|
## Content from other repositories
|
|
|
|
- **No tracked file, issue or pull request text or comment, release note or job output refers to
|
|
another repository of the maintainer's, its documents, hosts, network or namespaces, or states host
|
|
sizing.** This instruction has no expiry.
|
|
*Reason:* this repository is public and stands alone; a reader without an account must not learn
|
|
the private environment from it.
|
|
*Held by:* aspirational (no check is cheap for issue text or job logs).
|
|
- **When you bring content in from another repository, search the incoming diff before committing**
|
|
for mentions of the source repository, its documents, hostnames, addresses, account namespaces and
|
|
sibling paths; rewrite comments so they stand alone; say in the pull request what you searched for.
|
|
*Reason:* copied comments and paths are where private references slip in.
|
|
*Held by:* review.
|
|
|
|
## Dependency and image updates
|
|
|
|
Interim section: it moves to `images/AGENTS.md` and `scripts/AGENTS.md`.
|
|
|
|
- **A pin in `requirements-dev.txt` changes together with its lock `requirements-dev.lock`.** Renovate
|
|
does both; by hand, run `scripts/lock-requirements.sh` (`--upgrade` also moves transitive packages;
|
|
it needs PyPI and the Python of `.python-version`) and commit the lock in the same pull request.
|
|
*Reason:* installs use `pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt`,
|
|
which refuses an unhashed package and any disagreement between the two files.
|
|
*Held by:* control: the Lint and Build checks install that way when a pin file changes.
|
|
- **Hook repositories in `.pre-commit-config.yaml` are pinned by commit SHA, with the release in a
|
|
`# frozen: vX.Y.Z` comment.** Find the SHA with
|
|
`git ls-remote <repo> "refs/tags/<tag>" "refs/tags/<tag>^{}"` (the `^{}` line, when there is one).
|
|
*Reason:* a tag can be moved; a commit SHA cannot.
|
|
*Held by:* review (`.pre-commit-config.yaml` is under `CODEOWNERS`).
|
|
- **A pull request that changes an image input (`requirements-dev.txt`, `requirements-dev.lock`,
|
|
`requirements.yml`, `.pre-commit-config.yaml`, `images/**`) raises that image's `version:` in
|
|
`.gitea/workflows/image.yml`** (`python3 scripts/bump_image_versions.py` makes the edit).
|
|
*Reason:* a published image version is never rebuilt, so a changed input needs a new version.
|
|
*Held by:* control: the Lint check's `Check image versions were bumped` step.
|
|
- **After the merge builds the image on `main`, a second pull request moves the
|
|
`image:<version>@sha256:<digest>` pins in `lint.yml`, `build.yml`, `molecule.yml` and
|
|
`gitea-release-key.yml` to the printed digest.** It touches no `image.yml` trigger path, so it rebuilds nothing.
|
|
*Reason:* consumers run exactly the digest a reviewer saw.
|
|
*Held by:* review; Renovate opens these pull requests for the repository's own images.
|
|
- These tooling files are in `galaxy.yml` `build_ignore`, so their bumps change neither the
|
|
Collection nor its version.
|
|
- **A pull request from a `renovate/` branch changes only version, tag, digest and pin lines.**
|
|
*Reason:* the bot's pull requests automerge, so they must not be able to change anything else.
|
|
*Held by:* control: `scripts/check_bot_pr_diff.py` in the Lint check, run from `main`'s copy.
|
|
- **Workflows never mention the image namespace this repository's CI must not use** (the string is in
|
|
`scripts/check_image_versions.py`).
|
|
*Reason:* this repository's images are built and pulled only under its own organisation's namespace.
|
|
*Held by:* control: the Lint check's `Check image pins` step.
|
|
- `renovate.json` configures the bumps (minor and patch automerge, majors by hand). Renovate runs in
|
|
`.gitea/workflows/renovate.yml` (daily cron on this repository's runner, as a bot user of this
|
|
repository only). Test a config change before the merge with `renovate --platform=local` (the version
|
|
in `renovate.yml`), which reads your checkout; a dry run in Actions (Run workflow with `dry_run=true`)
|
|
reads `renovate.json` from `main` and proves reads only. Open item: no live run has yet shown that
|
|
the bot can push and open a pull request, and that its pull requests get the Lint and Build checks.
|