Compare commits
37
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
067e0e4b3e | ||
|
|
cb78edff6f | ||
|
|
7cb99de32d | ||
|
|
6a35c7407e | ||
|
|
ddfb1c6d0a | ||
|
|
b2d29df657 | ||
|
|
2f2d980ef7 | ||
|
|
3b91a40db1 | ||
|
|
fbdee5f778 | ||
|
|
26d7b4914c | ||
|
|
6432eb52b0 | ||
|
|
fac7ed47be | ||
|
|
b2e547edd5 | ||
|
|
6c80ab7772 | ||
|
|
d6037df6e4 | ||
|
|
2c9221ef45 | ||
|
|
fc62e2e110 | ||
|
|
9fb3cbd4fd | ||
|
|
076546f91b | ||
|
|
936e253af0 | ||
|
|
763ec5dfd3 | ||
|
|
d1db4fb0db | ||
|
|
5a130f143f | ||
|
|
cce3e54e7f | ||
|
|
33f4ee960e | ||
|
|
6d054b0f8b | ||
|
|
9dba48a30d | ||
|
|
2b0326801f | ||
|
|
1e95d8cbdd | ||
|
|
47641ae01d | ||
|
|
c617bee02a | ||
|
|
f7da80b326 | ||
|
|
1029d8ecce | ||
|
|
535926b36e | ||
|
|
595f517b49 | ||
|
|
d732ac0a71 | ||
|
|
f62097a748 |
No files matched your search
@@ -6,6 +6,7 @@ profile: production
|
|||||||
exclude_paths:
|
exclude_paths:
|
||||||
- .gitea
|
- .gitea
|
||||||
- .venv
|
- .venv
|
||||||
|
- .venv-dev
|
||||||
- apm_modules
|
- apm_modules
|
||||||
- apm.lock.yaml
|
- apm.lock.yaml
|
||||||
- changelogs
|
- changelogs
|
||||||
|
|||||||
+32
-14
@@ -39,35 +39,51 @@ issue.
|
|||||||
while a content check must see the content it is given. *Held:* review (`CODEOWNERS`).
|
while a content check must see the content it is given. *Held:* review (`CODEOWNERS`).
|
||||||
- **A pull request from a `renovate/` branch changes only version, tag, digest and pin lines**
|
- **A pull request from a `renovate/` branch changes only version, tag, digest and pin lines**
|
||||||
(tool pins with their lock entries and hashes, hook `rev:` lines, Dockerfile `FROM` tags and
|
(tool pins with their lock entries and hashes, hook `rev:` lines, Dockerfile `FROM` tags and
|
||||||
digests, `job_image:` pins, consumer image pins).
|
digests, `job_image:` pins, consumer image pins, and the tag and digest of the Renovate image
|
||||||
|
line of `renovate.yml` and of its copy in `lint.yml`). In `pyproject.toml` only a pin's version
|
||||||
|
moves; in `uv.lock` only apm-cli moves, to that pin, with its files from PyPI by sha256, and
|
||||||
|
every other package stays as it is.
|
||||||
*Why:* the bot's minor and patch pull requests automerge, so they must not be able to change
|
*Why:* the bot's minor and patch pull requests automerge, so they must not be able to change
|
||||||
anything else. *Held:* control: the Lint check's "Check a bot pull request only moves pins"
|
anything else; uv installs whatever `uv.lock` names, so it is parsed, not read line by line.
|
||||||
step, `scripts/check_bot_pr_diff.py` run from `main`'s copy. The branch name is chosen by the
|
*Held:* control: the Lint check's "Check a bot pull request only moves pins" step,
|
||||||
pusher, so this constrains only the bot's own pull requests.
|
`scripts/check_bot_pr_diff.py` with `scripts/check_uv_lock.py`, run from `main`'s copy. The
|
||||||
|
branch name is chosen by the pusher, so this constrains only the bot's own pull requests.
|
||||||
- **Workflows never mention the image namespace this repository's CI must not use** (the string
|
- **Workflows never mention the image namespace this repository's CI must not use** (the string
|
||||||
is in `scripts/check_image_versions.py`). *Why:* this repository's images are built and pulled
|
is in `scripts/check_image_versions.py`). *Why:* this repository's images are built and pulled
|
||||||
only under its own organisation's namespace. *Held:* control: the Lint check's "Check image
|
only under its own organisation's namespace. *Held:* control: the `check-image-pins` hook,
|
||||||
pins" step.
|
run by the Lint check.
|
||||||
|
|
||||||
## Lint and Build
|
## Lint and Build
|
||||||
|
|
||||||
- **Lint and Build run in the pinned `ci` image and compare the pin files with the checksums
|
- **Lint and Build run in the pinned `ci` image and compare the pin files with the checksums
|
||||||
baked into it (`/opt/ci-pins.sha256`).** A pull request that changes `requirements-dev.txt`,
|
baked into it (`/opt/ci-pins.sha256`)**, except Lint's `renovate-config` job (below). A pull request that changes `requirements-dev.txt`,
|
||||||
`requirements-dev.lock`, `requirements.yml` or `.pre-commit-config.yaml` takes the slow path,
|
`requirements-dev.lock`, `requirements.yml` or `.pre-commit-config.yaml` takes the slow path,
|
||||||
which installs the pinned tools and collections.
|
which installs the pinned tools and collections.
|
||||||
*Why:* a pull request is tested on its own pins, and an unchanged one starts in seconds.
|
*Why:* a pull request is tested on its own pins, and an unchanged one starts in seconds.
|
||||||
*Held:* control: the "Check the baked tooling against the pins" step.
|
*Held:* control: the "Check the baked tooling against the pins" step.
|
||||||
- **On the fast path the network is cut by environment**: `PIP_NO_INDEX=1`, the proxy variables
|
- **On the fast path the network is cut by environment**: `PIP_NO_INDEX=1`, the proxy variables
|
||||||
set to a dead local port and `no_proxy` empty, for every later step except "Test the repository
|
set to a dead local port and `no_proxy` empty, for every later step; the slow path keeps
|
||||||
scripts", which unsets them for its fake registry on loopback; the slow path keeps network.
|
network. The script tests set `no_proxy` to `127.0.0.1` for their fake registry on loopback.
|
||||||
*Why:* a runtime download is a bake-in defect and must fail the job, not silently slow it.
|
*Why:* a runtime download is a bake-in defect and must fail the job, not silently slow it.
|
||||||
*Held:* control, set by the "Check the baked tooling against the pins" step, for pip, curl, git
|
*Held:* control, set by the "Check the baked tooling against the pins" step, for pip, curl, git
|
||||||
over HTTPS and Python's urllib or requests (anything honouring `PIP_NO_INDEX` or the proxy
|
over HTTPS and Python's urllib or requests (anything honouring `PIP_NO_INDEX` or the proxy
|
||||||
variables); review for a raw socket or a tool that ignores the proxy variables, and for the
|
variables); review for a raw socket or a tool that ignores the proxy variables.
|
||||||
script tests.
|
|
||||||
- **Triggers:** both run on pull requests to `main` and on manual dispatch; Build also runs on
|
- **Triggers:** both run on pull requests to `main` and on manual dispatch; Build also runs on
|
||||||
`v*` tags, where it checks the tag against `galaxy.yml`. *Why:* the tag is what consumers
|
`v*` tags, where it checks the tag against `galaxy.yml`. *Why:* the tag is what consumers
|
||||||
install. *Held:* review.
|
install. *Held:* review.
|
||||||
|
- **Lint's `renovate-config` job runs `renovate-config-validator --strict --no-global` on
|
||||||
|
`renovate.json`, in the same Renovate image as `renovate.yml`, on every run with no `if:`.**
|
||||||
|
Renovate moves both pins in one pull request. *Why:* the config is checked by the Renovate
|
||||||
|
that runs it, and a check that always reports can be required. *Held:* control:
|
||||||
|
`test_the_renovate_image_pins_are_the_same` in `tests/scripts/test_check_bot_pr_diff.py` for
|
||||||
|
the equal pins; review for the job.
|
||||||
|
|
||||||
|
## Renovate
|
||||||
|
|
||||||
|
- **Triggers:** a push to `main`, the daily schedule and a successful Images run are live; a
|
||||||
|
manual dispatch is a dry run unless its input says otherwise. Runs share the `renovate`
|
||||||
|
group without cancelling. *Why:* a run after each merge rebases the next bot pull request,
|
||||||
|
and an Images run's pin pull request opens within minutes. *Held:* review.
|
||||||
|
|
||||||
## Molecule
|
## Molecule
|
||||||
|
|
||||||
@@ -99,9 +115,11 @@ issue.
|
|||||||
scenario for any other file, `requirements-molecule.*` included; `requirements-dev.*`, and
|
scenario for any other file, `requirements-molecule.*` included; `requirements-dev.*`, and
|
||||||
`lint.yml` and `build.yml` with their `ci` pins, are on IGNORED. *Why:* a full run takes the
|
`lint.yml` and `build.yml` with their `ci` pins, are on IGNORED. *Why:* a full run takes the
|
||||||
single runner slot for a long time. *Held:* control: the selector and its tests.
|
single runner slot for a long time. *Held:* control: the selector and its tests.
|
||||||
- **A role named in an include, import, play `roles:` entry or meta dependency is written out in
|
- **A role named in an include, import or play `roles:` entry is written out in full**, never
|
||||||
full**, never bare or templated. *Why:* the selector finds dependent roles by their FQCN.
|
bare or templated, and no role declares `meta/main.yml` `dependencies`
|
||||||
*Held:* control: a selector test fails a bare or templated name.
|
([roles/AGENTS.md](../../roles/AGENTS.md)). *Why:* the selector finds dependent roles by their
|
||||||
|
FQCN. *Held:* control: a selector test fails a bare or templated name and a non-empty
|
||||||
|
`dependencies`.
|
||||||
- **Scenarios load `mortis.kamino` from the checkout, never from an installed copy, so
|
- **Scenarios load `mortis.kamino` from the checkout, never from an installed copy, so
|
||||||
`galaxy.yml` is on IGNORED.** *Why:* the checkout is first on `ANSIBLE_COLLECTIONS_PATH` and the
|
`galaxy.yml` is on IGNORED.** *Why:* the checkout is first on `ANSIBLE_COLLECTIONS_PATH` and the
|
||||||
shared base config `.config/molecule/config.yml` turns off molecule's install of the collection
|
shared base config `.config/molecule/config.yml` turns off molecule's install of the collection
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
# The ci image (images/ci, built by image.yml): tag for the release, digest enforced.
|
# The ci image (images/ci, built by image.yml): tag for the release, digest enforced.
|
||||||
container:
|
container:
|
||||||
image: git.rkdr.net/mortis/ci:0.2.53@sha256:a106bd35c649fd15f027d4a4e81aa27d60b3c0377bbb6abfd73faf180f8c6f84
|
image: git.rkdr.net/mortis/ci:0.2.55@sha256:a20f7e4154aaba15a3dd5b2d42e5e84b307bab1128c9dc4cd4e54d55d6b64d60
|
||||||
env:
|
env:
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
||||||
steps:
|
steps:
|
||||||
@@ -94,13 +94,13 @@ jobs:
|
|||||||
# ansible-galaxy dereferences symlinks when it builds, so a symlink in the source tree
|
# ansible-galaxy dereferences symlinks when it builds, so a symlink in the source tree
|
||||||
# reaches the archive as a regular file with the target's content, where
|
# reaches the archive as a regular file with the target's content, where
|
||||||
# scripts/check_tarball.py cannot see it. Refuse them in the tree instead: this step
|
# scripts/check_tarball.py cannot see it. Refuse them in the tree instead: this step
|
||||||
# is the only guard against a file symlink. The two -prune paths below (./.venv,
|
# is the only guard against a file symlink. The -prune paths below (./.git, ./.venv,
|
||||||
# ./.git) are skipped only because the build skips them too (galaxy.yml build_ignore,
|
# ./.venv-dev) are skipped only because the build skips them too (galaxy.yml build_ignore,
|
||||||
# and ansible-galaxy's own .git exclusion): the two lists must stay in step, and
|
# and ansible-galaxy's own .git exclusion): the two lists must stay in step, and
|
||||||
# tests/scripts/test_check_tarball.py fails when a pruned directory is not ignored.
|
# tests/scripts/test_check_tarball.py fails when a pruned directory is not ignored.
|
||||||
- name: Refuse symlinks in the source tree
|
- name: Refuse symlinks in the source tree
|
||||||
run: |
|
run: |
|
||||||
links="$(find . -path ./.git -prune -o -path ./.venv -prune -o -type l -print)"
|
links="$(find . -path ./.git -prune -o -path ./.venv -prune -o -path ./.venv-dev -prune -o -type l -print)"
|
||||||
if [ -n "$links" ]; then
|
if [ -n "$links" ]; then
|
||||||
echo "::error::symlinks in the source tree would be dereferenced into the Collection archive:"
|
echo "::error::symlinks in the source tree would be dereferenced into the Collection archive:"
|
||||||
echo "$links"
|
echo "$links"
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
# The ci image (images/ci, built by image.yml), at the pin of lint.yml: tag for the
|
# The ci image (images/ci, built by image.yml), at the pin of lint.yml: tag for the
|
||||||
# release, digest enforced. Only its /opt/venv Python (with PyYAML) is used here.
|
# release, digest enforced. Only its /opt/venv Python (with PyYAML) is used here.
|
||||||
container:
|
container:
|
||||||
image: git.rkdr.net/mortis/ci:0.2.53@sha256:a106bd35c649fd15f027d4a4e81aa27d60b3c0377bbb6abfd73faf180f8c6f84
|
image: git.rkdr.net/mortis/ci:0.2.55@sha256:a20f7e4154aaba15a3dd5b2d42e5e84b307bab1128c9dc4cd4e54d55d6b64d60
|
||||||
steps:
|
steps:
|
||||||
# The container has no Node, so JavaScript actions such as actions/checkout
|
# The container has no Node, so JavaScript actions such as actions/checkout
|
||||||
# cannot run; clone with git and the job token.
|
# cannot run; clone with git and the job token.
|
||||||
|
|||||||
+38
-14
@@ -3,7 +3,7 @@ name: Lint
|
|||||||
# Runs only on the Collection's own runner (label kamino-docker, scoped to the mortis org).
|
# Runs only on the Collection's own runner (label kamino-docker, scoped to the mortis org).
|
||||||
# No org secret is used: the only credential is the
|
# No org secret is used: the only credential is the
|
||||||
# job token (secrets.GITHUB_TOKEN), which is read-only for a fork pull request. No pull_request_target.
|
# job token (secrets.GITHUB_TOKEN), which is read-only for a fork pull request. No pull_request_target.
|
||||||
# The tools come from the ci image (images/ci, built by image.yml): the pinned Python
|
# The lint job's tools come from the ci image (images/ci, built by image.yml): the pinned Python
|
||||||
# tools of requirements-dev.txt, the collections of requirements.yml and the hook
|
# tools of requirements-dev.txt, the collections of requirements.yml and the hook
|
||||||
# environments of .pre-commit-config.yaml are baked in. When a PR changes one of those
|
# environments of .pre-commit-config.yaml are baked in. When a PR changes one of those
|
||||||
# files the checksum check below fails and the job installs the pinned tools and
|
# files the checksum check below fails and the job installs the pinned tools and
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
# The tag says which release, the digest is what is enforced (bump both together
|
# The tag says which release, the digest is what is enforced (bump both together
|
||||||
# when image.yml publishes a new version).
|
# when image.yml publishes a new version).
|
||||||
container:
|
container:
|
||||||
image: git.rkdr.net/mortis/ci:0.2.53@sha256:a106bd35c649fd15f027d4a4e81aa27d60b3c0377bbb6abfd73faf180f8c6f84
|
image: git.rkdr.net/mortis/ci:0.2.55@sha256:a20f7e4154aaba15a3dd5b2d42e5e84b307bab1128c9dc4cd4e54d55d6b64d60
|
||||||
env:
|
env:
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
||||||
PRE_COMMIT_HOME: /opt/pre-commit
|
PRE_COMMIT_HOME: /opt/pre-commit
|
||||||
@@ -78,14 +78,6 @@ jobs:
|
|||||||
export PATH="/opt/venv/bin:$PATH"
|
export PATH="/opt/venv/bin:$PATH"
|
||||||
pre-commit run --all-files --show-diff-on-failure
|
pre-commit run --all-files --show-diff-on-failure
|
||||||
|
|
||||||
# Image pins (scripts/check_image_versions.py): a pin in a workflow must name an
|
|
||||||
# image of the matrix. Not a pre-commit hook: a change to .pre-commit-config.yaml
|
|
||||||
# is itself an input of the ci image and would force an image rebuild.
|
|
||||||
- name: Check image pins
|
|
||||||
run: |
|
|
||||||
export PATH="/opt/venv/bin:$PATH"
|
|
||||||
python3 scripts/check_image_versions.py pins
|
|
||||||
|
|
||||||
# A pull request from a renovate/ branch may only move version, tag, digest and pin
|
# A pull request from a renovate/ branch may only move version, tag, digest and pin
|
||||||
# lines (scripts/check_bot_pr_diff.py), so the bot's automerge cannot change workflow
|
# lines (scripts/check_bot_pr_diff.py), so the bot's automerge cannot change workflow
|
||||||
# logic or reach the org secrets. The branch name is attacker-controlled: this only
|
# logic or reach the org secrets. The branch name is attacker-controlled: this only
|
||||||
@@ -113,12 +105,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
python3 -E -s "$guard" "$HEAD_REF" "$BASE_REF"
|
python3 -E -s "$guard" "$HEAD_REF" "$BASE_REF"
|
||||||
|
|
||||||
# Without the guard: an empty no_proxy would send the fake registry on 127.0.0.1 to the dead proxy.
|
# The script tests are a pre-push hook (they take minutes), so --all-files above skips them.
|
||||||
- name: Test the repository scripts
|
- name: Run the script tests hook
|
||||||
run: |
|
run: |
|
||||||
unset PIP_NO_INDEX http_proxy https_proxy HTTP_PROXY HTTPS_PROXY
|
|
||||||
export PATH="/opt/venv/bin:$PATH"
|
export PATH="/opt/venv/bin:$PATH"
|
||||||
python3 -m unittest discover -s tests/scripts
|
pre-commit run --hook-stage pre-push script-tests --all-files --show-diff-on-failure
|
||||||
|
|
||||||
# The gitleaks hook scans --staged only, which is empty in a clean checkout,
|
# The gitleaks hook scans --staged only, which is empty in a clean checkout,
|
||||||
# so scan the PR's commits explicitly with the binary pre-commit built.
|
# so scan the PR's commits explicitly with the binary pre-commit built.
|
||||||
@@ -148,3 +139,36 @@ jobs:
|
|||||||
echo "Checking $sha"
|
echo "Checking $sha"
|
||||||
pre-commit run --hook-stage commit-msg --commit-msg-filename "$MSG_FILE"
|
pre-commit run --hook-stage commit-msg --commit-msg-filename "$MSG_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# renovate.json checked by the validator of the Renovate that runs it. The image is a copy of
|
||||||
|
# renovate.yml's pin (test_the_renovate_image_pins_are_the_same); the ci image has no Node.
|
||||||
|
renovate-config:
|
||||||
|
runs-on: kamino-docker
|
||||||
|
# Ceiling only: it includes a cold pull of the large -full image after a bump.
|
||||||
|
timeout-minutes: 15
|
||||||
|
container:
|
||||||
|
image: renovate/renovate:44.161.0-full@sha256:ddbf02e44b542343c9df696b88fd953f04cc3ee5f771221805ff8efb26595416
|
||||||
|
steps:
|
||||||
|
# The image runs as a non-root user, so the clone goes to the runner's temp directory.
|
||||||
|
- name: Checkout the commit under test
|
||||||
|
env:
|
||||||
|
GIT_CONFIG_COUNT: "1"
|
||||||
|
GIT_CONFIG_KEY_0: http.extraheader
|
||||||
|
GIT_CONFIG_VALUE_0: "AUTHORIZATION: bearer ${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||||
|
REF: ${{ github.ref }}
|
||||||
|
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
src="${RUNNER_TEMP:-/tmp}/renovate-config"
|
||||||
|
git clone "$REPO_URL" "$src"
|
||||||
|
cd "$src"
|
||||||
|
git checkout "$SHA" || { git fetch origin "$REF" && git checkout "$SHA"; }
|
||||||
|
echo "Checked out $(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
# A step of its own, so the clone credential (http.extraheader) is not in the environment
|
||||||
|
# that reads renovate.json.
|
||||||
|
# --no-global: renovate.json is a repository config, not the bot's global one.
|
||||||
|
- name: Validate renovate.json
|
||||||
|
run: |
|
||||||
|
cd "${RUNNER_TEMP:-/tmp}/renovate-config"
|
||||||
|
renovate-config-validator --strict --no-global renovate.json
|
||||||
@@ -5,18 +5,21 @@ name: Renovate
|
|||||||
# The credential is the token of a Kamino-only bot user, held as
|
# The credential is the token of a Kamino-only bot user, held as
|
||||||
# the repository secret RENOVATE_BOT_TOKEN (not an org secret: only image.yml may reference those).
|
# the repository secret RENOVATE_BOT_TOKEN (not an org secret: only image.yml may reference those).
|
||||||
# The job token cannot be used: Renovate filters every pull request lookup by its own username,
|
# The job token cannot be used: Renovate filters every pull request lookup by its own username,
|
||||||
# which is the virtual user gitea-actions with the job token, and Gitea answers 400 "user does not
|
# which is the virtual user gitea-actions with the job token, and Gitea refuses that user.
|
||||||
# exist" (dry run 2445). No GitHub token exists (no RENOVATE_GITHUB_COM_TOKEN): the github-tags
|
# No GitHub token exists, so the pre-commit hooks are looked up with git ls-remote instead
|
||||||
# datasource then skips every pre-commit hook (skipReason github-token-required, dry run 3880), and
|
# (renovate.json, git-tags), which needs RENOVATE_GITHUB_TOKEN_WARN=false below.
|
||||||
# unauthenticated GitHub API lookups are refused at once (403 rate limit). The hooks are looked up
|
|
||||||
# with git ls-remote instead (renovate.json, packageRule overrideDatasource git-tags), which needs
|
|
||||||
# RENOVATE_GITHUB_TOKEN_WARN=false below: the token check runs before package rules apply.
|
|
||||||
#
|
#
|
||||||
# Dry run: Actions > Renovate > Run workflow, dry_run=true (the default for a manual run), then
|
# Dry run: Actions > Renovate > Run workflow, dry_run=true (the default for a manual run), then
|
||||||
# read the debug log. The schedule runs live, and so does a successful Images run's completion, so
|
# read the debug log. Every other trigger runs live: a push to main rebases the next bot pull
|
||||||
# the pin pull request for a new image version opens within minutes of its push. Gitea starts a
|
# request, and an Images run's completion opens the pin pull request for a new image version.
|
||||||
# workflow_run only for a run a person triggered, and its event carries no input or credential.
|
# Gitea starts a workflow_run only for a run a person triggered, and its event carries no input
|
||||||
|
# or credential.
|
||||||
on: # yamllint disable-line rule:truthy
|
on: # yamllint disable-line rule:truthy
|
||||||
|
# Only one bot pull request merges per run when main must be up to date; a run after each merge
|
||||||
|
# rebases the next one.
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
# Images runs only on main (push, dispatch), and this job reads nothing from its run but the conclusion.
|
# Images runs only on main (push, dispatch), and this job reads nothing from its run but the conclusion.
|
||||||
workflow_run: # zizmor: ignore[dangerous-triggers]
|
workflow_run: # zizmor: ignore[dangerous-triggers]
|
||||||
workflows: [Images]
|
workflows: [Images]
|
||||||
@@ -50,15 +53,17 @@ jobs:
|
|||||||
(github.repository == 'mortis/kamino' || github.repository == 'Mortis/Kamino') &&
|
(github.repository == 'mortis/kamino' || github.repository == 'Mortis/Kamino') &&
|
||||||
(github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')
|
(github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')
|
||||||
runs-on: kamino-docker
|
runs-on: kamino-docker
|
||||||
timeout-minutes: 30
|
# A run takes seconds to about two minutes.
|
||||||
|
timeout-minutes: 10
|
||||||
# Docker Hub image, pinned by digest. The -full flavour ships python3 for the report check
|
# Docker Hub image, pinned by digest. The -full flavour ships python3 for the report check
|
||||||
# below and pip-compile for lock refreshes. Hand-bumped: renovate.json
|
# below and pip-compile for lock refreshes. Renovate proposes its own bump weekly, never
|
||||||
# disables updates for this file. The image sets RENOVATE_BINARY_SOURCE=global, so pip-compile
|
# automerged (renovate.json), and moves lint.yml's copy of this pin in the same pull request.
|
||||||
# runs on the image's own python (3.14.8 in 44.161.0) and ignores the Python that Renovate
|
# The image sets RENOVATE_BINARY_SOURCE=global, so pip-compile runs on the image's own python
|
||||||
# reads from the lock header: that python's minor version must equal .python-version, or a lock
|
# and ignores the Python that Renovate reads from the lock header: that python's minor version
|
||||||
# refresh rewrites the header (check_image_versions.py pins then fails the pull request). When
|
# must equal .python-version, or a lock refresh rewrites the header (check_image_versions.py
|
||||||
# bumping this image, check its python first; RENOVATE_BINARY_SOURCE=install would make Renovate
|
# pins then fails the pull request). Check the image's python before merging a bump;
|
||||||
# install the header's python, but it also downloads tools at run time (pip-tools included).
|
# RENOVATE_BINARY_SOURCE=install would make Renovate install the header's python, but it also
|
||||||
|
# downloads tools at run time (pip-tools included).
|
||||||
container:
|
container:
|
||||||
image: renovate/renovate:44.161.0-full@sha256:ddbf02e44b542343c9df696b88fd953f04cc3ee5f771221805ff8efb26595416
|
image: renovate/renovate:44.161.0-full@sha256:ddbf02e44b542343c9df696b88fd953f04cc3ee5f771221805ff8efb26595416
|
||||||
steps:
|
steps:
|
||||||
@@ -74,14 +79,17 @@ jobs:
|
|||||||
# No GitHub token exists, and the hooks go through git-tags (see the header). Without this
|
# No GitHub token exists, and the hooks go through git-tags (see the header). Without this
|
||||||
# Renovate marks every github-tags dependency as skipped before the package rule applies.
|
# Renovate marks every github-tags dependency as skipped before the package rule applies.
|
||||||
RENOVATE_GITHUB_TOKEN_WARN: "false"
|
RENOVATE_GITHUB_TOKEN_WARN: "false"
|
||||||
|
# Docker Hub refuses anonymous paging past page 10; at more pages renovate/renovate gets
|
||||||
|
# no release timestamps, so its minimumReleaseAge would not apply.
|
||||||
|
RENOVATE_DOCKER_MAX_PAGES: "10"
|
||||||
# Renovate exits 0 when a repository run fails (e.g. the clone): with this it exits with
|
# Renovate exits 0 when a repository run fails (e.g. the clone): with this it exits with
|
||||||
# an error-specific code instead (7 for an external host error such as a failed clone).
|
# an error-specific code instead (7 for an external host error such as a failed clone).
|
||||||
RENOVATE_EXIT_CODE_FOR_ERRORS: "true"
|
RENOVATE_EXIT_CODE_FOR_ERRORS: "true"
|
||||||
# The JSON report is checked after the run (see below).
|
# The JSON report is checked after the run (see below).
|
||||||
RENOVATE_REPORT_TYPE: file
|
RENOVATE_REPORT_TYPE: file
|
||||||
LOG_LEVEL: ${{ github.event_name == 'workflow_dispatch' && 'debug' || 'info' }}
|
LOG_LEVEL: ${{ github.event_name == 'workflow_dispatch' && 'debug' || 'info' }}
|
||||||
# Fail safe: only the schedule and workflow_run are live. A manual dispatch is a dry run unless
|
# Fail safe: a manual dispatch is a dry run unless the input is exactly the string "false"
|
||||||
# the input is exactly the string "false" (an empty input from an API or CLI dispatch stays one).
|
# (an empty input from an API or CLI dispatch stays one); every other trigger is live.
|
||||||
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run != 'false' && 'true' || 'false' }}
|
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run != 'false' && 'true' || 'false' }}
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$RENOVATE_TOKEN" ]; then
|
if [ -z "$RENOVATE_TOKEN" ]; then
|
||||||
@@ -90,7 +98,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
# Git over HTTPS with the bot token. Renovate's own rewrite puts the token in the URL
|
# Git over HTTPS with the bot token. Renovate's own rewrite puts the token in the URL
|
||||||
# (https://<token>@host/...), which git drops when the server redirects, and Gitea
|
# (https://<token>@host/...), which git drops when the server redirects, and Gitea
|
||||||
# redirected the clone (dry run 2439). The header is sent on every request to the host,
|
# redirects the clone. The header is sent on every request to the host,
|
||||||
# as lint.yml does with its token. Renovate does not pass GIT_CONFIG_* from its environment to git
|
# as lint.yml does with its token. Renovate does not pass GIT_CONFIG_* from its environment to git
|
||||||
# (only an allowlist, util/exec/env.js), but it does pass HOME, so a global git config
|
# (only an allowlist, util/exec/env.js), but it does pass HOME, so a global git config
|
||||||
# is the path that reaches its git children. The token is read from the environment.
|
# is the path that reaches its git children. The token is read from the environment.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Built collection archives and local tooling
|
# Built collection archives and local tooling
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
/.venv/
|
/.venv/
|
||||||
|
/.venv-dev/
|
||||||
/venv/
|
/venv/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: check-toml
|
- id: check-toml
|
||||||
stages: ['pre-commit']
|
stages: ['pre-commit']
|
||||||
|
- id: check-json
|
||||||
|
stages: ['pre-commit']
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
stages: ['pre-commit']
|
stages: ['pre-commit']
|
||||||
|
|
||||||
@@ -114,6 +116,27 @@ repos:
|
|||||||
require_serial: true
|
require_serial: true
|
||||||
stages: ['pre-push']
|
stages: ['pre-push']
|
||||||
|
|
||||||
|
# Pre-push only: the suite takes minutes. Lint runs it by id. The uncreatable GIT_DIR makes a
|
||||||
|
# git fixture that keeps the caller's GIT_* fail instead of writing to this repository.
|
||||||
|
- id: script-tests
|
||||||
|
name: A script change passes its tests in tests/scripts (scripts/AGENTS.md)
|
||||||
|
description: python3 -m unittest discover -s tests/scripts
|
||||||
|
entry: env GIT_DIR=/dev/null/not-a-repo python3 -m unittest discover -s tests/scripts
|
||||||
|
language: system
|
||||||
|
files: ^(scripts/|tests/scripts/|roles/[^/]+/meta/)
|
||||||
|
pass_filenames: false
|
||||||
|
stages: ['pre-push']
|
||||||
|
|
||||||
|
# always_run: its inputs span workflows, Dockerfiles and docs/images, and it fails on a missing one.
|
||||||
|
- id: check-image-pins
|
||||||
|
name: Image pins name an image of the image.yml matrix, which has its job image, labels and docs (images/AGENTS.md)
|
||||||
|
description: python3 scripts/check_image_versions.py pins
|
||||||
|
entry: python3 scripts/check_image_versions.py pins
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
always_run: true
|
||||||
|
stages: ['pre-commit']
|
||||||
|
|
||||||
# SECURITY.md's accepted risks rest on the Collection shipping roles only. It sits before
|
# SECURITY.md's accepted risks rest on the Collection shipping roles only. It sits before
|
||||||
# ansible-lint, whose fail_fast would otherwise hide this message.
|
# ansible-lint, whose fail_fast would otherwise hide this message.
|
||||||
- id: refuse-plugins
|
- id: refuse-plugins
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ extends: default
|
|||||||
|
|
||||||
ignore: |
|
ignore: |
|
||||||
.venv/**
|
.venv/**
|
||||||
|
.venv-dev/**
|
||||||
apm_modules/**
|
apm_modules/**
|
||||||
# Generated by apm install; its list indentation fails the rules below.
|
# Generated by apm install; its list indentation fails the rules below.
|
||||||
apm.lock.yaml
|
apm.lock.yaml
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ held: by a control (a named hook or check), by review, or aspirational (checked
|
|||||||
Lint re-runs the commit-stage hooks, the commit-msg check and gitleaks).
|
Lint re-runs the commit-stage hooks, the commit-msg check and gitleaks).
|
||||||
- `pre-commit run --all-files`: the commit-stage hooks on every file.
|
- `pre-commit run --all-files`: the commit-stage hooks on every file.
|
||||||
- `python3 -m unittest discover -s tests/scripts`: when a script changed.
|
- `python3 -m unittest discover -s tests/scripts`: when a script changed.
|
||||||
- `git push` runs `ansible-test sanity` on HEAD (the pre-push hook).
|
- `git push` runs `ansible-test sanity` on HEAD, and the script tests when `scripts/`, `tests/scripts/`
|
||||||
|
or a role's `meta/` changed (the pre-push hooks).
|
||||||
- Molecule runs only in CI.
|
- Molecule runs only in CI.
|
||||||
|
|
||||||
## Repository structure
|
## Repository structure
|
||||||
@@ -107,5 +108,6 @@ renovate.json dependency automation
|
|||||||
- Changing a workflow: read [.gitea/workflows/AGENTS.md](.gitea/workflows/AGENTS.md) first.
|
- Changing a workflow: read [.gitea/workflows/AGENTS.md](.gitea/workflows/AGENTS.md) first.
|
||||||
- Changing an image or an image-smoke scenario: read [images/AGENTS.md](images/AGENTS.md) first.
|
- Changing an image or an image-smoke scenario: read [images/AGENTS.md](images/AGENTS.md) first.
|
||||||
- Before writing an ADR: read [docs/adr/AGENTS.md](docs/adr/AGENTS.md) first.
|
- Before writing an ADR: read [docs/adr/AGENTS.md](docs/adr/AGENTS.md) first.
|
||||||
- Before changing `renovate.json`: read its rule descriptions, and test with `renovate --platform=local`
|
- Before changing `renovate.json`: read its rule descriptions. Lint's `renovate-config` job checks
|
||||||
at the version in `.gitea/workflows/renovate.yml`.
|
its syntax; test a behaviour change with `renovate --platform=local` at the version in
|
||||||
|
`.gitea/workflows/renovate.yml`.
|
||||||
@@ -4,6 +4,19 @@ mortis.kamino Release Notes
|
|||||||
|
|
||||||
.. contents:: Topics
|
.. contents:: Topics
|
||||||
|
|
||||||
|
v3.5.0
|
||||||
|
======
|
||||||
|
|
||||||
|
Minor Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- ufw - New input ``ufw_mask_nftables`` (default ``true``) and tag ``ufw_nftables``. Set the input to ``false`` on a host that loads its own ruleset through ``nftables.service``; the role never unmasks the unit.
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- ufw - An upgrade of the ``nftables`` package no longer deletes the firewall rules on hosts where ``nftables.service`` is enabled. The package's postinst restarts that unit, whose stock ``/etc/nftables.conf`` begins with ``flush ruleset``, so the rules ufw and Docker loaded were gone until they reloaded. The role now masks ``nftables.service`` without stopping it whenever ``ufw_enabled`` is true, also when the unit or the package is absent, so the first run reports ``changed`` once. A host that loads its own ruleset through ``nftables.service`` (NAT tables or sets, for example) would lose it at the next reboot without a warning, because a masked unit does not start: set ``ufw_mask_nftables: false`` on such a host before upgrading.
|
||||||
|
|
||||||
v3.4.0
|
v3.4.0
|
||||||
======
|
======
|
||||||
|
|
||||||
|
|||||||
@@ -34,4 +34,6 @@ GLOSSARY\\.md @Defame1297
|
|||||||
\\.claude/.* @Defame1297
|
\\.claude/.* @Defame1297
|
||||||
apm\\.yml @Defame1297
|
apm\\.yml @Defame1297
|
||||||
apm\\.lock\\.yaml @Defame1297
|
apm\\.lock\\.yaml @Defame1297
|
||||||
|
pyproject\\.toml @Defame1297
|
||||||
|
uv\\.lock @Defame1297
|
||||||
\\.mcp\\.json @Defame1297
|
\\.mcp\\.json @Defame1297
|
||||||
@@ -5,7 +5,7 @@ An Ansible Collection of reusable, hardened roles for a self-hosted home lab:
|
|||||||
`nfs_client`, `pihole`, `pve_lxc`, `pve_vm`, `sshd`, `system_baseline`, `systemd_hardening`, `tailscale`, `traefik`,
|
`nfs_client`, `pihole`, `pve_lxc`, `pve_vm`, `sshd`, `system_baseline`, `systemd_hardening`, `tailscale`, `traefik`,
|
||||||
`ufw` and `user_management`, plus the internal `_binary_update`. Roles still to come are listed under [Roadmap](#roadmap).
|
`ufw` and `user_management`, plus the internal `_binary_update`. Roles still to come are listed under [Roadmap](#roadmap).
|
||||||
|
|
||||||
Status: roles arrive in waves. Release 3.4.0 holds the `cloudflared`, `docker`, `fail2ban`, `gitea`, `gitea_runner`, `network_interfaces`, `nfs_client`, `pihole`, `pve_lxc`, `pve_vm`, `sshd`, `system_baseline`, `systemd_hardening`, `tailscale`, `traefik`, `ufw` and `user_management` roles (and the internal `_binary_update`, which `cloudflared`, `gitea`, `gitea_runner` and `traefik` call).
|
Status: roles arrive in waves. Release 3.5.0 holds the `cloudflared`, `docker`, `fail2ban`, `gitea`, `gitea_runner`, `network_interfaces`, `nfs_client`, `pihole`, `pve_lxc`, `pve_vm`, `sshd`, `system_baseline`, `systemd_hardening`, `tailscale`, `traefik`, `ufw` and `user_management` roles (and the internal `_binary_update`, which `cloudflared`, `gitea`, `gitea_runner` and `traefik` call).
|
||||||
|
|
||||||
## Consuming
|
## Consuming
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ name (FQCN) only, `mortis.kamino.<role>`:
|
|||||||
collections:
|
collections:
|
||||||
- name: https://git.rkdr.net/mortis/kamino.git
|
- name: https://git.rkdr.net/mortis/kamino.git
|
||||||
type: git
|
type: git
|
||||||
version: v3.4.0
|
version: v3.5.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Its dependencies (`community.general`, `ansible.posix`, `community.proxmox`) are declared in `galaxy.yml`, so
|
Its dependencies (`community.general`, `ansible.posix`, `community.proxmox`) are declared in `galaxy.yml`, so
|
||||||
@@ -42,6 +42,7 @@ when its own prerequisites (tests, a safe cutover wherever the role already runs
|
|||||||
Still to come:
|
Still to come:
|
||||||
|
|
||||||
- Wave 3: `rke2`, `proxmox_host`.
|
- Wave 3: `rke2`, `proxmox_host`.
|
||||||
|
- Not yet in a wave: `openbao`.
|
||||||
|
|
||||||
Will not be extracted (they serve one lab or install that lab's own tool pins):
|
Will not be extracted (they serve one lab or install that lab's own tool pins):
|
||||||
`k8s_manage`, `k8s_localhost`, `k8s_lint_tools`, `minecraft_server`, `dragonwilds_server`,
|
`k8s_manage`, `k8s_localhost`, `k8s_lint_tools`, `minecraft_server`, `dragonwilds_server`,
|
||||||
|
|||||||
+10
@@ -126,3 +126,13 @@ reduction. A later decision that accepts a risk adds an entry here.
|
|||||||
- **Trigger:** the pull request that moves `molecule.yml` to a new `molecule-controller` image
|
- **Trigger:** the pull request that moves `molecule.yml` to a new `molecule-controller` image
|
||||||
fails Molecule because of a changed image input.
|
fails Molecule because of a changed image input.
|
||||||
- **Planned reduction:** none for now.
|
- **Planned reduction:** none for now.
|
||||||
|
|
||||||
|
### Unseal keys in vaulted inventory
|
||||||
|
|
||||||
|
- **Risk:** the planned `openbao` role can unseal a Shamir-sealed OpenBao from unseal keys the
|
||||||
|
consumer keeps in vaulted inventory (`openbao_unseal_keys`), so whoever holds the Ansible
|
||||||
|
vault password can unseal alone. This weakens the split knowledge Shamir's scheme gives.
|
||||||
|
- **Why accepted:** it keeps restarts and updates unattended, and the Collection already keeps
|
||||||
|
secrets in vaulted inventory. The keys are optional: without them the role leaves the node
|
||||||
|
sealed and warns.
|
||||||
|
- **Trigger and planned reduction:** auto-unseal, tracked in #529.
|
||||||
+6
-6
@@ -1,6 +1,6 @@
|
|||||||
lockfile_version: '4'
|
lockfile_version: '4'
|
||||||
generated_at: '2026-11-29T13:12:37.842657+00:00'
|
generated_at: '2026-12-04T21:33:07.493501+00:00'
|
||||||
apm_version: 0.38.1
|
apm_version: 0.39.3
|
||||||
manifest_targets:
|
manifest_targets:
|
||||||
- claude
|
- claude
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -220,8 +220,8 @@ dependencies:
|
|||||||
.claude/agents/plan-researcher.md: sha256:eda0457d2007cf0c6cb4745383a0369d03a26ed252d7251a1f5250003a89ef85
|
.claude/agents/plan-researcher.md: sha256:eda0457d2007cf0c6cb4745383a0369d03a26ed252d7251a1f5250003a89ef85
|
||||||
.claude/agents/plan-validator.md: sha256:a56e7a710fd9e7a9dd9e2601f1f2701b98fd229f3e014bba4bda4dfe5977ecae
|
.claude/agents/plan-validator.md: sha256:a56e7a710fd9e7a9dd9e2601f1f2701b98fd229f3e014bba4bda4dfe5977ecae
|
||||||
.claude/commands/next.md: sha256:8e16330ec0f16dbbc86d44fca94699e33e393c9a8af76f45d3f3bd2b9c8bfa1f
|
.claude/commands/next.md: sha256:8e16330ec0f16dbbc86d44fca94699e33e393c9a8af76f45d3f3bd2b9c8bfa1f
|
||||||
.claude/commands/plan.md: sha256:2538b3dbb3860ebe93a39cad95cd5a1adcbeded19f404a84201b3e8aa7ce91c7
|
.claude/commands/plan.md: sha256:c5216fb6c443ca9de45ad5cb69351a4e3193bcb5ffca4d59567495fcb5d7ec71
|
||||||
.claude/commands/ship.md: sha256:f108f73e60a884f46285955027fba47d6309fed6a89812948f577e27be180af8
|
.claude/commands/ship.md: sha256:c3c9f516b9b01cb7f879d7d331187b12f697f73104b0eafdc813d64b73091284
|
||||||
.claude/skills/plan-track/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
.claude/skills/plan-track/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||||
.claude/skills/plan-track/SKILL.md: sha256:fee5062c8c63b49f66368b290c8ebd8cfff744137670d0c037da1a49c455c047
|
.claude/skills/plan-track/SKILL.md: sha256:fee5062c8c63b49f66368b290c8ebd8cfff744137670d0c037da1a49c455c047
|
||||||
.claude/skills/research-docs/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
.claude/skills/research-docs/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||||
@@ -843,7 +843,7 @@ deployments:
|
|||||||
owners:
|
owners:
|
||||||
- git.rkdr.net/Mortis/Holocron/plugins/plan
|
- git.rkdr.net/Mortis/Holocron/plugins/plan
|
||||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
|
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
|
||||||
content_hash: sha256:2538b3dbb3860ebe93a39cad95cd5a1adcbeded19f404a84201b3e8aa7ce91c7
|
content_hash: sha256:c5216fb6c443ca9de45ad5cb69351a4e3193bcb5ffca4d59567495fcb5d7ec71
|
||||||
- kind: project-relative
|
- kind: project-relative
|
||||||
target: claude
|
target: claude
|
||||||
value: .claude/commands/ship.md
|
value: .claude/commands/ship.md
|
||||||
@@ -852,7 +852,7 @@ deployments:
|
|||||||
owners:
|
owners:
|
||||||
- git.rkdr.net/Mortis/Holocron/plugins/plan
|
- git.rkdr.net/Mortis/Holocron/plugins/plan
|
||||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
|
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
|
||||||
content_hash: sha256:f108f73e60a884f46285955027fba47d6309fed6a89812948f577e27be180af8
|
content_hash: sha256:c3c9f516b9b01cb7f879d7d331187b12f697f73104b0eafdc813d64b73091284
|
||||||
- kind: project-relative
|
- kind: project-relative
|
||||||
target: claude
|
target: claude
|
||||||
value: .claude/skills/code-review
|
value: .claude/skills/code-review
|
||||||
|
|||||||
@@ -93,4 +93,4 @@ plugins:
|
|||||||
strategy: {}
|
strategy: {}
|
||||||
test: {}
|
test: {}
|
||||||
vars: {}
|
vars: {}
|
||||||
version: 3.4.0
|
version: 3.5.0
|
||||||
@@ -599,3 +599,24 @@ releases:
|
|||||||
- 511-system-baseline-icmp-redirects.yml
|
- 511-system-baseline-icmp-redirects.yml
|
||||||
- 511-system-baseline-sysctl-wildcard.yml
|
- 511-system-baseline-sysctl-wildcard.yml
|
||||||
release_date: '2026-12-03'
|
release_date: '2026-12-03'
|
||||||
|
3.5.0:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- 'ufw - An upgrade of the ``nftables`` package no longer deletes the firewall
|
||||||
|
rules on hosts where ``nftables.service`` is enabled. The package''s postinst
|
||||||
|
restarts that unit, whose stock ``/etc/nftables.conf`` begins with ``flush
|
||||||
|
ruleset``, so the rules ufw and Docker loaded were gone until they reloaded.
|
||||||
|
The role now masks ``nftables.service`` without stopping it whenever ``ufw_enabled``
|
||||||
|
is true, also when the unit or the package is absent, so the first run reports
|
||||||
|
``changed`` once. A host that loads its own ruleset through ``nftables.service``
|
||||||
|
(NAT tables or sets, for example) would lose it at the next reboot without
|
||||||
|
a warning, because a masked unit does not start: set ``ufw_mask_nftables:
|
||||||
|
false`` on such a host before upgrading.'
|
||||||
|
minor_changes:
|
||||||
|
- ufw - New input ``ufw_mask_nftables`` (default ``true``) and tag ``ufw_nftables``.
|
||||||
|
Set the input to ``false`` on a host that loads its own ruleset through ``nftables.service``;
|
||||||
|
the role never unmasks the unit.
|
||||||
|
fragments:
|
||||||
|
- ufw-mask-nftables-input.yml
|
||||||
|
- ufw-mask-nftables.yml
|
||||||
|
release_date: '2026-12-06'
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
breaking_changes:
|
||||||
|
- >-
|
||||||
|
pihole - A non-empty ``config.webserver.api.app_password`` is now refused, and ``app_pwhash``
|
||||||
|
always renders empty, which disables app passwords. Released pihole-FTL upgrades a
|
||||||
|
legacy-hashed app password on login by writing the new hash into the main ``pwhash``, so one
|
||||||
|
login with the app password replaced the web password. Remove
|
||||||
|
``config.webserver.api.app_password`` from ``pihole_overrides``; the first run after upgrading
|
||||||
|
re-renders ``pihole.toml`` and reconfigures Pi-hole.
|
||||||
@@ -107,8 +107,18 @@ limit), [.gitea/workflows/AGENTS.md](../../.gitea/workflows/AGENTS.md) (workflow
|
|||||||
bot-diff check `scripts/check_bot_pr_diff.py`) and [docs/adr/AGENTS.md](../adr/AGENTS.md) (decision
|
bot-diff check `scripts/check_bot_pr_diff.py`) and [docs/adr/AGENTS.md](../adr/AGENTS.md) (decision
|
||||||
records).
|
records).
|
||||||
|
|
||||||
- **Test a change to `renovate.json` before the merge with `renovate --platform=local`** (the version
|
- **Test a change to how Renovate behaves before the merge with `renovate --platform=local`** (the
|
||||||
in `.gitea/workflows/renovate.yml`), which reads your checkout.
|
version in `.gitea/workflows/renovate.yml`), which reads your checkout. Syntax needs no local run.
|
||||||
*Reason:* a dry run in Actions (Run workflow with `dry_run=true`) reads `renovate.json` from `main`,
|
*Reason:* a dry run in Actions (Run workflow with `dry_run=true`) reads `renovate.json` from `main`,
|
||||||
so it cannot test a pull request's change.
|
so it cannot test a pull request's change.
|
||||||
*Held by:* review (`renovate.json` is under `CODEOWNERS`).
|
*Held by:* for the syntax, Lint's `renovate-config` job (`renovate-config-validator --strict
|
||||||
|
--no-global renovate.json`): a control once `Lint / renovate-config` is a required check, review
|
||||||
|
until then; review for the behaviour (`renovate.json` is under `CODEOWNERS`).
|
||||||
|
- **Every description in `renovate.json` is at most two short sentences: why the rule exists, plus
|
||||||
|
how it works when that is not obvious.** Investigation notes stay in the pull request.
|
||||||
|
*Reason:* the descriptions are read on every change to the config, and notes age into noise.
|
||||||
|
*Held by:* review.
|
||||||
|
- **A broken unattended merge is fixed with a test or a check; an automerge exception is added only
|
||||||
|
when no test can catch it, and its description names the failure it prevents.**
|
||||||
|
*Reason:* an exception costs a manual review on every later update, a test does not.
|
||||||
|
*Held by:* review.
|
||||||
@@ -9,7 +9,7 @@ held by review until an offline link check exists.
|
|||||||
## The clone
|
## The clone
|
||||||
|
|
||||||
- **Run `scripts/dev-setup.sh` once per clone, and again after a change to `requirements-dev.txt`, its
|
- **Run `scripts/dev-setup.sh` once per clone, and again after a change to `requirements-dev.txt`, its
|
||||||
lock `requirements-dev.lock`, `requirements.yml` or the hook types.** It creates `.venv` with the
|
lock `requirements-dev.lock`, `requirements.yml` or the hook types.** It creates `.venv-dev` with the
|
||||||
pinned tools on the Python named in `.python-version`, installs the collections of `requirements.yml`
|
pinned tools on the Python named in `.python-version`, installs the collections of `requirements.yml`
|
||||||
into `.ansible/collections`, and installs the git hooks (pre-commit, commit-msg, pre-push) with the
|
into `.ansible/collections`, and installs the git hooks (pre-commit, commit-msg, pre-push) with the
|
||||||
virtualenv first on their `PATH`.
|
virtualenv first on their `PATH`.
|
||||||
@@ -63,6 +63,12 @@ held by review until an offline link check exists.
|
|||||||
pushed on an unmerged branch lets that branch's commands run without a prompt before anyone has
|
pushed on an unmerged branch lets that branch's commands run without a prompt before anyone has
|
||||||
reviewed it, while a `deny` or `ask` rule can only add prompts.
|
reviewed it, while a `deny` or `ask` rule can only add prompts.
|
||||||
*Held by:* review (`.claude/` is under `CODEOWNERS`).
|
*Held by:* review (`.claude/` is under `CODEOWNERS`).
|
||||||
|
- **Install [uv](https://docs.astral.sh/uv/getting-started/installation/), run `uv sync --frozen` once per
|
||||||
|
clone and again after a change to `uv.lock`, and run apm only as `uv run --frozen apm ...`** (for example
|
||||||
|
`uv run --frozen apm install`). uv keeps apm in `.venv`, apart from the tools in `.venv-dev`.
|
||||||
|
*Reason:* a bare `apm` is whatever version your machine has, and versions differ in which
|
||||||
|
`apm.lock.yaml` they accept and in what they deploy.
|
||||||
|
*Held by:* aspirational.
|
||||||
- **Every hook in the tracked `.claude/settings.json` arrives through apm; personal hooks go in
|
- **Every hook in the tracked `.claude/settings.json` arrives through apm; personal hooks go in
|
||||||
`.claude/settings.local.json`.**
|
`.claude/settings.local.json`.**
|
||||||
*Reason:* a hook nobody owns is checked by nothing.
|
*Reason:* a hook nobody owns is checked by nothing.
|
||||||
|
|||||||
+3
-3
@@ -11,7 +11,7 @@ Ubuntu 26.04 with:
|
|||||||
|
|
||||||
- **Python tools** in `/opt/venv` (on `PATH`; it runs on Python 3.14, the version of `.python-version`, from the baked copy and not from the distribution's `python3`), from `requirements-dev.lock` (the hashed lock of `requirements-dev.txt`, installed with `pip install --require-hashes`): `ansible-core`,
|
- **Python tools** in `/opt/venv` (on `PATH`; it runs on Python 3.14, the version of `.python-version`, from the baked copy and not from the distribution's `python3`), from `requirements-dev.lock` (the hashed lock of `requirements-dev.txt`, installed with `pip install --require-hashes`): `ansible-core`,
|
||||||
`ansible-lint`, `pre-commit`, `antsibull-changelog`, `galaxy-importer`, `reuse`, `molecule`
|
`ansible-lint`, `pre-commit`, `antsibull-changelog`, `galaxy-importer`, `reuse`, `molecule`
|
||||||
(without its Docker driver: Lint's "Test the repository scripts" step runs the tests that import it), and
|
(without its Docker driver: Lint's run of the `script-tests` hook runs the tests that import it), and
|
||||||
`proxmoxer`, the controller-side library the modules of `community.proxmox` import.
|
`proxmoxer`, the controller-side library the modules of `community.proxmox` import.
|
||||||
- **The collections the roles call** in `/opt/collections` (`ANSIBLE_COLLECTIONS_PATH` is set to it), from
|
- **The collections the roles call** in `/opt/collections` (`ANSIBLE_COLLECTIONS_PATH` is set to it), from
|
||||||
`requirements.yml`: `community.general`, `ansible.posix` and `community.proxmox` at the exact versions CI tests against, so
|
`requirements.yml`: `community.general`, `ansible.posix` and `community.proxmox` at the exact versions CI tests against, so
|
||||||
@@ -20,7 +20,7 @@ Ubuntu 26.04 with:
|
|||||||
(`PRE_COMMIT_HOME`): conventional-pre-commit, gitleaks, yamllint, ruff, shellcheck-py, pre-commit-hooks, actionlint and zizmor. The Go
|
(`PRE_COMMIT_HOME`): conventional-pre-commit, gitleaks, yamllint, ruff, shellcheck-py, pre-commit-hooks, actionlint and zizmor. The Go
|
||||||
hooks are prebuilt; their toolchains, and the binaries of those repositories that no hook runs, are removed to
|
hooks are prebuilt; their toolchains, and the binaries of those repositories that no hook runs, are removed to
|
||||||
keep layers small. The local hooks (`reuse-lint`,
|
keep layers small. The local hooks (`reuse-lint`,
|
||||||
`antsibull-changelog-lint`, `ansible-lint`) are `language: system`: they run from `/opt/venv`, which is why
|
`antsibull-changelog-lint`, `ansible-lint`, `script-tests`, `check-image-pins`) are `language: system`: they run from `/opt/venv`, which is why
|
||||||
that directory must be on `PATH` (it is, in the image).
|
that directory must be on `PATH` (it is, in the image).
|
||||||
- **`ansible-test sanity` virtualenvs**, primed in `/root/.ansible/test`, and Python 3.11, 3.13 and 3.14 as
|
- **`ansible-test sanity` virtualenvs**, primed in `/root/.ansible/test`, and Python 3.11, 3.13 and 3.14 as
|
||||||
`python3.11` / `python3.13` / `python3.14` (python-build-standalone, installed with uv) next to the distribution's
|
`python3.11` / `python3.13` / `python3.14` (python-build-standalone, installed with uv) next to the distribution's
|
||||||
@@ -63,7 +63,7 @@ jobs:
|
|||||||
`/opt/ci-pins.sha256` lists the four pin files by their checkout-relative path, so `sha256sum -c` runs in the checkout root. When
|
`/opt/ci-pins.sha256` lists the four pin files by their checkout-relative path, so `sha256sum -c` runs in the checkout root. When
|
||||||
the checkout's `requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml` and `.pre-commit-config.yaml` match, the baked tools and
|
the checkout's `requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml` and `.pre-commit-config.yaml` match, the baked tools and
|
||||||
collections are used as they are, and Lint and Build cut the network by environment (proxy variables and
|
collections are used as they are, and Lint and Build cut the network by environment (proxy variables and
|
||||||
`PIP_NO_INDEX`) for all but the script tests, so a tool that downloads at run time fails the job. When a pull request changes a pin the check fails and the job installs the pinned
|
`PIP_NO_INDEX`), so a tool that downloads at run time fails the job. When a pull request changes a pin the check fails and the job installs the pinned
|
||||||
tools and collections itself for that run
|
tools and collections itself for that run
|
||||||
(slower, same result), until the image is rebuilt from `main`. `lint.yml`, `build.yml` and `gitea-release-key.yml`
|
(slower, same result), until the image is rebuilt from `main`. `lint.yml`, `build.yml` and `gitea-release-key.yml`
|
||||||
are the real consumers.
|
are the real consumers.
|
||||||
|
|||||||
+4
-1
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
namespace: mortis
|
namespace: mortis
|
||||||
name: kamino
|
name: kamino
|
||||||
version: 3.4.0
|
version: 3.5.0
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Defame1297
|
- Defame1297
|
||||||
@@ -46,6 +46,7 @@ build_ignore:
|
|||||||
- .python-version
|
- .python-version
|
||||||
- .ruff_cache
|
- .ruff_cache
|
||||||
- .venv
|
- .venv
|
||||||
|
- .venv-dev
|
||||||
- .yamllint
|
- .yamllint
|
||||||
- docs
|
- docs
|
||||||
- .ansible-lint
|
- .ansible-lint
|
||||||
@@ -59,6 +60,7 @@ build_ignore:
|
|||||||
- images
|
- images
|
||||||
- scripts
|
- scripts
|
||||||
- tests/scripts
|
- tests/scripts
|
||||||
|
- pyproject.toml
|
||||||
- renovate.json
|
- renovate.json
|
||||||
- ruff.toml
|
- ruff.toml
|
||||||
- requirements-dev.txt
|
- requirements-dev.txt
|
||||||
@@ -66,6 +68,7 @@ build_ignore:
|
|||||||
- requirements-molecule.txt
|
- requirements-molecule.txt
|
||||||
- requirements-molecule.lock
|
- requirements-molecule.lock
|
||||||
- requirements.yml
|
- requirements.yml
|
||||||
|
- uv.lock
|
||||||
- gitleaks-report.json
|
- gitleaks-report.json
|
||||||
- importer_result.json
|
- importer_result.json
|
||||||
- 'roles/*/molecule'
|
- 'roles/*/molecule'
|
||||||
|
|||||||
+1
-2
@@ -63,8 +63,7 @@ it to this repository's organisation in the Gitea registry as `<version>` and `l
|
|||||||
image; a job downloads at run time only on the slow path (a pull request that changes a pin
|
image; a job downloads at run time only on the slow path (a pull request that changes a pin
|
||||||
file). *Why:* a run that downloads is slower and depends on the network. *Held:* control: on
|
file). *Why:* a run that downloads is slower and depends on the network. *Held:* control: on
|
||||||
the fast path Lint and Build cut the network by environment, so a download through pip or a
|
the fast path Lint and Build cut the network by environment, so a download through pip or a
|
||||||
proxy-honouring client fails the job; review for a raw socket, for the script tests, which keep
|
proxy-honouring client fails the job; review for a raw socket and for Molecule.
|
||||||
network, and for Molecule.
|
|
||||||
- **Each Dockerfile upgrades the base image's packages in its first apt layer.** *Why:* Ubuntu
|
- **Each Dockerfile upgrades the base image's packages in its first apt layer.** *Why:* Ubuntu
|
||||||
publishes package updates before it refreshes the base image. *Held:* review.
|
publishes package updates before it refreshes the base image. *Held:* review.
|
||||||
- **Recorded speed:** a speed optimisation that adds machinery states its measured saving where
|
- **Recorded speed:** a speed optimisation that adds machinery states its measured saving where
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
# distribution's python3 and ca-certificates.
|
# distribution's python3 and ca-certificates.
|
||||||
# - /opt/venv: requirements-dev.lock, the hashed lock of requirements-dev.txt (ansible-core, ansible-lint, pre-commit,
|
# - /opt/venv: requirements-dev.lock, the hashed lock of requirements-dev.txt (ansible-core, ansible-lint, pre-commit,
|
||||||
# antsibull-changelog, galaxy-importer, reuse, molecule, proxmoxer), on the Python of
|
# antsibull-changelog, galaxy-importer, reuse, molecule, proxmoxer), on the Python of
|
||||||
# .python-version (PYTHON_VERSION below), the one the lock was resolved on and a clone's .venv uses.
|
# .python-version (PYTHON_VERSION below), the one the lock was resolved on and a clone's .venv-dev uses.
|
||||||
# molecule is there for Lint's "Test the repository scripts" step, whose molecule tests import it; its
|
# molecule is there for Lint's run of the script-tests hook, whose molecule tests import it; its
|
||||||
# Docker driver and community.docker are not: Molecule runs in the molecule-controller image.
|
# Docker driver and community.docker are not: Molecule runs in the molecule-controller image.
|
||||||
# - /opt/collections: the collections of requirements.yml (the versions the roles are
|
# - /opt/collections: the collections of requirements.yml (the versions the roles are
|
||||||
# tested against), found through ANSIBLE_COLLECTIONS_PATH, so `ansible-lint --offline`
|
# tested against), found through ANSIBLE_COLLECTIONS_PATH, so `ansible-lint --offline`
|
||||||
@@ -71,7 +71,7 @@ COPY requirements-dev.txt requirements-dev.lock requirements.yml .pre-commit-con
|
|||||||
|
|
||||||
# The interpreters come first: /opt/venv is built from the pinned one (PYTHON_VERSION, kept equal to
|
# The interpreters come first: /opt/venv is built from the pinned one (PYTHON_VERSION, kept equal to
|
||||||
# .python-version and to the lock header by `check_image_versions.py pins`), not from the distribution's
|
# .python-version and to the lock header by `check_image_versions.py pins`), not from the distribution's
|
||||||
# python3, so the tools run on the Python the lock was resolved on and a clone's .venv uses.
|
# python3, so the tools run on the Python the lock was resolved on and a clone's .venv-dev uses.
|
||||||
# uv only lives in the build stage (its own venv): the final image keeps the interpreters it
|
# uv only lives in the build stage (its own venv): the final image keeps the interpreters it
|
||||||
# downloaded, not the installer. The distribution's python3 only bootstraps uv.
|
# downloaded, not the installer. The distribution's python3 only bootstraps uv.
|
||||||
RUN python3 -m venv /opt/uv-venv \
|
RUN python3 -m venv /opt/uv-venv \
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Pins apm for contributors (docs/contributing/setup.md). The Lint and Build tools are pinned in requirements-dev.txt.
|
||||||
|
[project]
|
||||||
|
name = "kamino"
|
||||||
|
version = "0"
|
||||||
|
# ruff reads this floor too: a higher one makes it reformat existing files.
|
||||||
|
requires-python = ">=3.11"
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = ["apm-cli==0.39.3"]
|
||||||
|
|
||||||
|
[tool.uv]
|
||||||
|
package = false
|
||||||
+70
-18
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"description": "Run by .gitea/workflows/renovate.yml on this repository's own runner. Policy: automerge minor and patch, majors by hand. Every bot pull request must pass scripts/check_bot_pr_diff.py (lint workflow), which allows only version, tag, digest and pin lines. Image versions are assigned by the Images workflow when an image's inputs change, so a bot pull request needs no version edit. Updates open on Mondays (UTC), so any Monday run can act; the own image pins and vulnerability fixes found on osv.dev open at any time. The weekly window and the groups bound the volume, so there is no hourly pull request limit. Vulnerability fixes skip the release-age wait, so they are never automerged: a person checks a fix that had no time to be pulled as a compromised release. Base-image bumps are manual: every Dockerfile is FROM ubuntu, grouped with the job containers.",
|
"description": "Run by .gitea/workflows/renovate.yml: minor and patch updates automerge once scripts/check_bot_pr_diff.py and CI pass, and those to code-owned files only once a code owner approves; majors, vulnerability fixes (which skip the release-age wait) and the exceptions below stay manual. Updates open on Mondays (UTC) after a 3-day release age, and an update with no release timestamp gets no wait.",
|
||||||
"extends": [
|
"extends": [
|
||||||
"config:recommended",
|
"config:recommended",
|
||||||
":enablePreCommit"
|
":enablePreCommit"
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
"semanticCommitScope": "deps",
|
"semanticCommitScope": "deps",
|
||||||
"enabledManagers": [
|
"enabledManagers": [
|
||||||
"pip-compile",
|
"pip-compile",
|
||||||
|
"pep621",
|
||||||
"ansible-galaxy",
|
"ansible-galaxy",
|
||||||
"pre-commit",
|
"pre-commit",
|
||||||
"github-actions",
|
"github-actions",
|
||||||
@@ -35,6 +36,11 @@
|
|||||||
"/^requirements-molecule\\.lock$/"
|
"/^requirements-molecule\\.lock$/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"pep621": {
|
||||||
|
"managerFilePatterns": [
|
||||||
|
"/^pyproject\\.toml$/"
|
||||||
|
]
|
||||||
|
},
|
||||||
"pre-commit": {
|
"pre-commit": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"managerFilePatterns": [
|
"managerFilePatterns": [
|
||||||
@@ -54,7 +60,7 @@
|
|||||||
"customManagers": [
|
"customManagers": [
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"description": "The uv pin that installs the build-stage Python interpreters of the ci and molecule-controller images (their Dockerfiles). It is an image input: the merge publishes a new version of each.",
|
"description": "The uv pin that installs the build-stage Python of the ci and molecule-controller images. It is an image input: the merge publishes a new version of each.",
|
||||||
"managerFilePatterns": [
|
"managerFilePatterns": [
|
||||||
"/^images/ci/Dockerfile$/",
|
"/^images/ci/Dockerfile$/",
|
||||||
"/^images/molecule-controller/Dockerfile$/"
|
"/^images/molecule-controller/Dockerfile$/"
|
||||||
@@ -67,7 +73,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"description": "The job container of each image of image.yml (matrix job_image, ubuntu by digest). kaniko unpacks the image over the job container, so its release must equal the Dockerfile's (check_image_versions.py pins). Tag and digest updates within a release arrive here; a new release is a deliberate edit of both (rule below disables major ubuntu updates). Never automerged: the job holds the registry push credential (image.yml rule below).",
|
"description": "The ubuntu job container of each image in image.yml, whose release must equal its Dockerfile's because kaniko unpacks the image over it. Never automerged: the job holds the registry push credential (image.yml rule below).",
|
||||||
"managerFilePatterns": [
|
"managerFilePatterns": [
|
||||||
"/^\\.gitea/workflows/image\\.yml$/"
|
"/^\\.gitea/workflows/image\\.yml$/"
|
||||||
],
|
],
|
||||||
@@ -79,7 +85,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"description": "The CONTROLLER_IMAGE (molecule-controller), MOLECULE_IMAGE and MOLECULE_IMAGE_<release> values of molecule.yml are a multi-line `>-` scalar, which the github-actions manager does not read; matched here by its exact shape. Used by the pin-follow rule below.",
|
"description": "The image pins of molecule.yml are multi-line `>-` scalars, which the github-actions manager does not read. Used by the pin-follow rule below.",
|
||||||
"managerFilePatterns": [
|
"managerFilePatterns": [
|
||||||
"/^\\.gitea/workflows/molecule\\.yml$/"
|
"/^\\.gitea/workflows/molecule\\.yml$/"
|
||||||
],
|
],
|
||||||
@@ -92,21 +98,28 @@
|
|||||||
],
|
],
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"description": "Dockerfile base-image tag and digest bumps (images/*/Dockerfile) MAY automerge. Kamino is the untrusted side and the bump pull request's own CI exercises the new image before the merge. Placed first so the major-version rule below still turns automerge off. The merge publishes a new image version. Today every Dockerfile is FROM ubuntu, whose bumps join the manual ubuntu base images group below; this rule is the safety net for a future base image of another kind.",
|
"description": "Dockerfile base-image bumps automerge once a code owner approves (images/** is in CODEOWNERS); the Images workflow builds the new image after the merge, and the pin-follow pull request's CI then runs on it. Placed first so the majors rule below still turns automerge off.",
|
||||||
"matchManagers": [
|
"matchManagers": [
|
||||||
"dockerfile"
|
"dockerfile"
|
||||||
],
|
],
|
||||||
"automerge": true
|
"automerge": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "The Renovate job container of renovate.yml runs with the job token: hand-bumped, never by the bot (the bot-diff check would refuse a change to that file anyway).",
|
"description": "Renovate's own image never automerges: its job runs with the write-capable bot token. One weekly pull request moves the pin in renovate.yml and lint.yml's copy together.",
|
||||||
"matchFileNames": [
|
"matchDatasources": [
|
||||||
".gitea/workflows/renovate.yml"
|
"docker"
|
||||||
],
|
],
|
||||||
"enabled": false
|
"matchPackageNames": [
|
||||||
|
"renovate/renovate"
|
||||||
|
],
|
||||||
|
"schedule": [
|
||||||
|
"on monday"
|
||||||
|
],
|
||||||
|
"minimumReleaseAge": "3 days",
|
||||||
|
"automerge": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "A new Ubuntu release is a deliberate edit, never a bump. The molecule-ubuntu<NNNN> images are one release by name and by contract (extensions/molecule/image-smoke* assert it), and every image's job container must run the same release as its Dockerfile (check_image_versions.py pins), so a base-image major in one file alone would fail the check or the build. Tag and digest updates within a release still arrive.",
|
"description": "A new Ubuntu release is a deliberate edit, never a bump: each molecule-ubuntu<NNNN> image is one release by contract, and each job container must run its Dockerfile's release. Tag and digest updates within a release still arrive.",
|
||||||
"matchPackageNames": [
|
"matchPackageNames": [
|
||||||
"ubuntu"
|
"ubuntu"
|
||||||
],
|
],
|
||||||
@@ -126,7 +139,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "ansible-core and ansible-lint move together (the lint rules follow the core version). Minor and patch bumps automerge like the rest, majors are manual. A new ansible-core minor can bring new sanity findings: the shared tests/sanity/ignore-common.txt covers the known ones, and the Build check (ansible-test sanity) is the gate, so a bump that shows new findings stays red and is not merged. The group spans requirements-dev.lock and requirements-molecule.lock, so one pull request moves both ansible-core pins, which check_image_versions.py pins holds equal.",
|
"description": "ansible-core and ansible-lint move together, because the lint rules follow the core version. One pull request moves the ansible-core pins of both locks, which check_image_versions.py pins holds equal.",
|
||||||
"groupName": "ansible tooling",
|
"groupName": "ansible tooling",
|
||||||
"matchDatasources": [
|
"matchDatasources": [
|
||||||
"pypi"
|
"pypi"
|
||||||
@@ -137,7 +150,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Hold ansible-lint at the newest version galaxy-importer allows. galaxy-importer 0.4.44 (the newest release, used by the Build job) declares ansible-lint<=26.10.1, so a pin above that makes pip fail with ResolutionImpossible and Lint and Build go red (seen on the 26.11.0 bump). Remove this rule, and raise the cap, once a galaxy-importer release lifts its ansible-lint limit.",
|
"description": "Hold ansible-lint at the newest version galaxy-importer allows, or pip cannot install Lint's and Build's tools. Raise or remove the cap once galaxy-importer lifts its ansible-lint limit.",
|
||||||
"matchDatasources": [
|
"matchDatasources": [
|
||||||
"pypi"
|
"pypi"
|
||||||
],
|
],
|
||||||
@@ -147,28 +160,38 @@
|
|||||||
"allowedVersions": "<=26.10.1"
|
"allowedVersions": "<=26.10.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "The job containers of image.yml (matrix job_image, ubuntu by digest) hold the org registry push credential while the image job runs: never automerged. Their ubuntu bumps share one branch with the Dockerfile FROM bumps (ubuntu base images rule below), so that pull request is manual too: a group automerges only if every update in it does.",
|
"description": "The job containers of image.yml hold the registry push credential while the image job runs, so their bumps never automerge. Their ubuntu bumps share a branch with the Dockerfile FROM bumps, so that group is manual too.",
|
||||||
"matchFileNames": [
|
"matchFileNames": [
|
||||||
".gitea/workflows/image.yml"
|
".gitea/workflows/image.yml"
|
||||||
],
|
],
|
||||||
"automerge": false
|
"automerge": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "The Dockerfile FROM digests and the image.yml job_image digests of one Ubuntu update move in one pull request, so the release pair stays in step and one Images run covers both.",
|
"description": "The Dockerfile FROM and image.yml job_image digests of one Ubuntu update move in one pull request, so each release pair stays in step and one Images run covers both.",
|
||||||
"matchPackageNames": [
|
"matchPackageNames": [
|
||||||
"ubuntu"
|
"ubuntu"
|
||||||
],
|
],
|
||||||
"groupName": "ubuntu base images"
|
"groupName": "ubuntu base images"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Safety net only: kaniko is pinned by layer digests in image.yml and no Renovate manager reads them, so it is updated by hand. If a manager ever starts to read it, its bumps are not automerged.",
|
"description": "Safety net: kaniko is pinned by layer digests that no manager reads, so it is updated by hand. If a manager ever reads it, its bumps do not automerge.",
|
||||||
"matchPackageNames": [
|
"matchPackageNames": [
|
||||||
"/kaniko/"
|
"/kaniko/"
|
||||||
],
|
],
|
||||||
"automerge": false
|
"automerge": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Pin follow-up for our own images (git.rkdr.net/mortis/*): moves the image:<version>@sha256:<digest> pins of lint.yml, build.yml, molecule.yml and gitea-release-key.yml to the newest published version and its digest, and automerges. The Images workflow's completion starts a Renovate run, so this pull request opens minutes after a new version is pushed. The pull request's own Lint and Build run in the new image before the merge, and scripts/check_bot_pr_diff.py allows only these pin lines. The registry lists tags and digests anonymously, so no hostRules are needed. A major version stays manual (rule above). One pull request moves every image an Images run published (ci, molecule-controller and both molecule target images), so one Molecule run tests them together. Exempt from the weekly schedule, so the pins on main catch up with a new image within minutes.",
|
"description": "Our own images are built from main by the Images workflow, so there is no third-party release to wait for. Docker only, so another kind of dependency from this organisation keeps the wait.",
|
||||||
|
"matchDatasources": [
|
||||||
|
"docker"
|
||||||
|
],
|
||||||
|
"matchPackageNames": [
|
||||||
|
"git.rkdr.net/mortis/**"
|
||||||
|
],
|
||||||
|
"minimumReleaseAge": "0 days"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Moves the pins of our own images in the workflows to the newest published version in one pull request at any time, so main catches up minutes after an Images run. It automerges once a code owner approves (CODEOWNERS), after its own Lint, Build and Molecule run on the new images.",
|
||||||
"matchPackageNames": [
|
"matchPackageNames": [
|
||||||
"git.rkdr.net/mortis/**"
|
"git.rkdr.net/mortis/**"
|
||||||
],
|
],
|
||||||
@@ -179,7 +202,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Look the pre-commit hook repositories up with git ls-remote (git-tags) instead of the GitHub API. This run has no GitHub token, and the github-tags datasource then either skips every hook (skipReason github-token-required, dry run 3880) or is refused at once with 403 rate limit (githubTokenWarn off, local run). git-tags needs no API and no credential, and it uses the dereferenced hash of an annotated tag, so the new rev is the commit, as pre-commit needs. The `# frozen:` form is kept by the manager's own replace template. It works only together with RENOVATE_GITHUB_TOKEN_WARN=false in renovate.yml: the token check runs after extraction and skips every github-tags dependency before a package rule can change its datasource (local run, Renovate 44.161.0). git-tags has no release timestamps, so minimumReleaseAge cannot delay a hook bump: hook bumps are never automerged, a person reviews each one.",
|
"description": "Look the pre-commit hooks up with git ls-remote (git-tags), because this run has no GitHub token; it needs RENOVATE_GITHUB_TOKEN_WARN=false in renovate.yml. git-tags has no release timestamps, so no wait applies and a person reviews every hook bump.",
|
||||||
"matchManagers": [
|
"matchManagers": [
|
||||||
"pre-commit"
|
"pre-commit"
|
||||||
],
|
],
|
||||||
@@ -196,7 +219,6 @@
|
|||||||
"pypi"
|
"pypi"
|
||||||
],
|
],
|
||||||
"matchPackageNames": [
|
"matchPackageNames": [
|
||||||
"apm-cli",
|
|
||||||
"antsibull-changelog",
|
"antsibull-changelog",
|
||||||
"galaxy-importer",
|
"galaxy-importer",
|
||||||
"reuse",
|
"reuse",
|
||||||
@@ -211,6 +233,36 @@
|
|||||||
"pre-commit"
|
"pre-commit"
|
||||||
],
|
],
|
||||||
"groupName": "pre-commit hooks"
|
"groupName": "pre-commit hooks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "requires-python in pyproject.toml is the floor ruff formats for, not a pin: never updated by the bot.",
|
||||||
|
"matchManagers": [
|
||||||
|
"pep621"
|
||||||
|
],
|
||||||
|
"matchDepTypes": [
|
||||||
|
"requires-python"
|
||||||
|
],
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "No lock file maintenance for uv.lock: scripts/check_uv_lock.py refuses any change to a package other than apm-cli, so a person refreshes uv.lock by hand.",
|
||||||
|
"matchManagers": [
|
||||||
|
"pep621"
|
||||||
|
],
|
||||||
|
"matchUpdateTypes": [
|
||||||
|
"lockFileMaintenance"
|
||||||
|
],
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "apm-cli (pyproject.toml and uv.lock) gets its own pull request, never automerged: CI never runs apm, so a green run says nothing about a new version. Placed last so no rule above turns automerge back on.",
|
||||||
|
"matchManagers": [
|
||||||
|
"pep621"
|
||||||
|
],
|
||||||
|
"matchPackageNames": [
|
||||||
|
"apm-cli"
|
||||||
|
],
|
||||||
|
"automerge": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lockFileMaintenance": {
|
"lockFileMaintenance": {
|
||||||
|
|||||||
+6
-1180
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,5 @@
|
|||||||
# Pinned tooling for Lint and Build, used by CI (.gitea/workflows) and locally:
|
# Pinned tooling for Lint and Build, used by CI (.gitea/workflows) and locally:
|
||||||
# python3 -m venv .venv && . .venv/bin/activate && pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt
|
# python3 -m venv .venv-dev && . .venv-dev/bin/activate && pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt
|
||||||
# This file holds the direct pins; requirements-dev.lock is their hashed lock (every transitive
|
# This file holds the direct pins; requirements-dev.lock is their hashed lock (every transitive
|
||||||
# package too, with the sha256 of each release file) and is what gets installed; pip refuses an
|
# package too, with the sha256 of each release file) and is what gets installed; pip refuses an
|
||||||
# install in which the two files disagree. Renovate bumps a pin here and regenerates the lock
|
# install in which the two files disagree. Renovate bumps a pin here and regenerates the lock
|
||||||
@@ -12,12 +12,9 @@ pre-commit==4.7.0
|
|||||||
antsibull-changelog==0.38.0
|
antsibull-changelog==0.38.0
|
||||||
galaxy-importer==0.4.45
|
galaxy-importer==0.4.45
|
||||||
reuse==6.3.0
|
reuse==6.3.0
|
||||||
# molecule without its Docker driver: Lint's "Test the repository scripts" step imports it in
|
# molecule without its Docker driver: Lint's run of the script-tests hook imports it in
|
||||||
# test_check_scenarios_load_checkout.py and test_run_molecule_scenarios.py, which skip without it.
|
# test_check_scenarios_load_checkout.py and test_run_molecule_scenarios.py, which skip without it.
|
||||||
molecule==26.11.1
|
molecule==26.11.1
|
||||||
# proxmoxer: the controller-side library community.proxmox's modules import (they refuse anything below 2.3),
|
# proxmoxer: the controller-side library community.proxmox's modules import (they refuse anything below 2.3),
|
||||||
# so lint runs where a consumer's controller would.
|
# so lint runs where a consumer's controller would.
|
||||||
proxmoxer==2.3.0
|
proxmoxer==2.3.0
|
||||||
# apm-cli: for changing apm.yml (run apm install, commit the lock). Keep it at 0.36.1 or later (#252):
|
|
||||||
# before 0.29.0, `apm audit --ci` compares the whole .claude/settings.json and fails on any hand-written key.
|
|
||||||
apm-cli==0.39.1
|
|
||||||
+8
-1
@@ -68,6 +68,11 @@ names a check that does not exist yet and its backlog issue.
|
|||||||
- **Secrets.** Never in plaintext in the repository, a role's defaults, task output or a file on
|
- **Secrets.** Never in plaintext in the repository, a role's defaults, task output or a file on
|
||||||
the controller; `no_log: true` on every task that carries one; a secret is a required input
|
the controller; `no_log: true` on every task that carries one; a secret is a required input
|
||||||
with no default; a role generates one only straight into a secret store the consumer names.
|
with no default; a role generates one only straight into a secret store the consumer names.
|
||||||
|
A secret returned as a `no_log`, non-cacheable output fact from an opt-in entry point, for the
|
||||||
|
calling play to persist (for example vault-encrypted into inventory), counts as handed straight
|
||||||
|
to the consumer's store, as the gitea and cloudflared `mint` entry points do. Such an entry point
|
||||||
|
has a confirm flag, refuses under CI environment variables, sets `no_log` on every task, blanks
|
||||||
|
its intermediates, skips under `--check` and does nothing when the secret already exists.
|
||||||
Keys a host generates for itself and keeps (SSH host keys) are not covered. The README line
|
Keys a host generates for itself and keeps (SSH host keys) are not covered. The README line
|
||||||
"`no_log` is not used: the role handles no secrets" stays only where true. *Why:* nothing leaks
|
"`no_log` is not used: the role handles no secrets" stays only where true. *Why:* nothing leaks
|
||||||
today and a role writing to a secret store stays possible. *Held:* review.
|
today and a role writing to a secret store stays possible. *Held:* review.
|
||||||
@@ -114,7 +119,9 @@ names a check that does not exist yet and its backlog issue.
|
|||||||
only on a supported entry point, an internal role on any entry point in its argument_specs.
|
only on a supported entry point, an internal role on any entry point in its argument_specs.
|
||||||
*Why:* a task-level include keeps the order readable, where `meta` dependencies run hidden and
|
*Why:* a task-level include keeps the order readable, where `meta` dependencies run hidden and
|
||||||
deduplicated. *Held:* the selector runs a dependent role's scenarios when a role it uses
|
deduplicated. *Held:* the selector runs a dependent role's scenarios when a role it uses
|
||||||
changes; review for empty `dependencies` until Lint fails a non-empty one (#246).
|
changes; control: `test_roles_call_each_other_by_full_name_only` in
|
||||||
|
`tests/scripts/test_select_molecule_scenarios.py`, run by the Lint check, fails a non-empty
|
||||||
|
`dependencies`.
|
||||||
- **Internal roles.** A leading `_`; only roles of this Collection call it, by FQCN; it refuses
|
- **Internal roles.** A leading `_`; only roles of this Collection call it, by FQCN; it refuses
|
||||||
to run without a parent role (an `assert` on `ansible_parent_role_names`, as in
|
to run without a parent role (an `assert` on `ansible_parent_role_names`, as in
|
||||||
`_binary_update`); it has argument_specs and Molecule scenarios and follows the platform rules.
|
`_binary_update`); it has argument_specs and Molecule scenarios and follows the platform rules.
|
||||||
|
|||||||
@@ -58,13 +58,14 @@ The input asserts carry `always` (and `assert`), so they run whatever tags are s
|
|||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
The `default` molecule scenario runs in CI only, on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). It replaces the upstream repository with a local stub whose installer only logs its arguments and creates the database file, so it tests the merge, the asserts, the user, the configuration directory and the rendered `pihole.toml` (owner, group and mode), the clone's checked-out version, the installer sequence (install once, then reconfigure from the handler) and idempotence, not Pi-hole itself: no pihole-FTL service runs, so that the service loaded the configuration is not verified. It runs `check` before the converge (a fresh host) and after it (a configured host). Negative tests in `verify.yml` cover a host without Ubuntu facts, a missing `pihole_web_password`, an unset interface, empty upstreams, a non-string password and the placeholder password.
|
The `default` molecule scenario runs in CI only, on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). It replaces the upstream repository with a local stub whose installer only logs its arguments and creates the database file, so it tests the merge, the asserts, the user, the configuration directory and the rendered `pihole.toml` (owner, group and mode), the clone's checked-out version, the installer sequence (install once, then reconfigure from the handler) and idempotence, not Pi-hole itself: no pihole-FTL service runs, so that the service loaded the configuration is not verified. It runs `check` before the converge (a fresh host) and after it (a configured host). Negative tests in `verify.yml` cover a host without Ubuntu facts, a missing `pihole_web_password`, an unset interface, empty upstreams, a non-string password, the placeholder password and a non-empty app password.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Idempotent: yes.
|
- Idempotent: yes.
|
||||||
- Merge model: the role sets an internal fact to `pihole_default | combine(pihole_overrides | default({}), recursive=True)`. The input is only read, never overwritten, so each run recomputes the merge. Dictionaries are not merged across variable sources, so define `pihole_overrides` in one place only.
|
- Merge model: the role sets an internal fact to `pihole_default | combine(pihole_overrides | default({}), recursive=True)`. The input is only read, never overwritten, so each run recomputes the merge. Dictionaries are not merged across variable sources, so define `pihole_overrides` in one place only.
|
||||||
- Secrets: the password is hashed twice with SHA-256 in the template (`pwhash`). The merge and both template tasks use `no_log`, and the templates `diff: false`, so a `pihole.toml` change shows no diff. `pihole_testing` masks the web password, app password and TOTP secret in its output. `totp_secret` and `app_password` default to empty strings.
|
- Secrets: the password is hashed twice with SHA-256 in the template (`pwhash`). The merge and both template tasks use `no_log`, and the templates `diff: false`, so a `pihole.toml` change shows no diff. `pihole_testing` masks the web password, app password and TOTP secret in its output. `totp_secret` and `app_password` default to empty strings.
|
||||||
|
- App passwords: `config.webserver.api.app_password` must stay empty, and the role fails otherwise; `app_pwhash` always renders empty, which disables app passwords. Released pihole-FTL upgrades a legacy-hashed (double SHA-256) app password on login by writing the new hash into the main `pwhash`, so one login with the app password would replace the web password.
|
||||||
- Install flow: the role creates the `pihole` system user (nologin), the configuration directory and, on first install, `pihole.toml`, because the unattended installer needs it first. It clones `repo.version` and runs the installer with `--unattended` only when `config.files.database` does not exist yet. A change to `pihole.toml` notifies the `reconfigure pihole` handler, which runs the installer with `--reconfigure --unattended`.
|
- Install flow: the role creates the `pihole` system user (nologin), the configuration directory and, on first install, `pihole.toml`, because the unattended installer needs it first. It clones `repo.version` and runs the installer with `--unattended` only when `config.files.database` does not exist yet. A change to `pihole.toml` notifies the `reconfigure pihole` handler, which runs the installer with `--reconfigure --unattended`.
|
||||||
- Updates: the role does not upgrade an installed Pi-hole; changing `repo.version` only moves the clone.
|
- Updates: the role does not upgrade an installed Pi-hole; changing `repo.version` only moves the clone.
|
||||||
- Check mode: `--check` is the supported preview; a play-level `check_mode: true` is not supported. On a host where the configuration directory does not exist yet, the `pihole.toml` template tasks are skipped under `--check`, because the directory they write into is not created.
|
- Check mode: `--check` is the supported preview; a play-level `check_mode: true` is not supported. On a host where the configuration directory does not exist yet, the `pihole.toml` template tasks are skipped under `--check`, because the directory they write into is not created.
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ pihole_default:
|
|||||||
password: "{{ pihole_web_password }}"
|
password: "{{ pihole_web_password }}"
|
||||||
# Pi-hole 2FA TOTP secret.
|
# Pi-hole 2FA TOTP secret.
|
||||||
totp_secret: ""
|
totp_secret: ""
|
||||||
# Pi-hole application password (to circumvent 2FA for legacy 3rd-party services)
|
# Pi-hole application password: must stay empty, app_pwhash always renders empty (README Notes)
|
||||||
app_password: ""
|
app_password: ""
|
||||||
# Should application password API sessions be allowed to modify config settings?
|
# Should application password API sessions be allowed to modify config settings?
|
||||||
app_sudo: false
|
app_sudo: false
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ argument_specs:
|
|||||||
over C(pihole_default) in C(defaults/main.yml). The spec types it as a dictionary only, because sub-options
|
over C(pihole_default) in C(defaults/main.yml). The spec types it as a dictionary only, because sub-options
|
||||||
would reject every key it does not list. The merged result is an internal fact and never overwrites the
|
would reject every key it does not list. The merged result is an internal fact and never overwrites the
|
||||||
input. The role fails unless the merged C(config.dns.upstreams) is a non-empty list, C(config.dns.interface)
|
input. The role fails unless the merged C(config.dns.upstreams) is a non-empty list, C(config.dns.interface)
|
||||||
is a non-empty string and C(config.webserver.api.password) is a string other than
|
is a non-empty string, C(config.webserver.api.password) is a string other than
|
||||||
C(changetoyourownpassword).
|
C(changetoyourownpassword) and C(config.webserver.api.app_password) is empty.
|
||||||
- >-
|
- >-
|
||||||
C(pihole_default) (every setting rendered into C(pihole.toml)) and C(pihole_install_script) (the quoted
|
C(pihole_default) (every setting rendered into C(pihole.toml)) and C(pihole_install_script) (the quoted
|
||||||
installer path under C(repo.path)) are role defaults deliberately not listed here, because argument
|
installer path under C(repo.path)) are role defaults deliberately not listed here, because argument
|
||||||
@@ -47,7 +47,11 @@ argument_specs:
|
|||||||
C(config.dns.interface) must be set (string, for example C(eth0)): its default is an empty placeholder
|
C(config.dns.interface) must be set (string, for example C(eth0)): its default is an empty placeholder
|
||||||
and the role fails until it is set. C(config.dns.upstreams) (list of IP addresses or hostnames,
|
and the role fails until it is set. C(config.dns.upstreams) (list of IP addresses or hostnames,
|
||||||
optionally with C(#port)) must stay non-empty. C(config.webserver.api.password) must stay a string.
|
optionally with C(#port)) must stay non-empty. C(config.webserver.api.password) must stay a string.
|
||||||
C(config.webserver.api.totp_secret) and C(config.webserver.api.app_password) are also credentials.
|
C(config.webserver.api.totp_secret) is also a credential.
|
||||||
|
- >-
|
||||||
|
C(config.webserver.api.app_password) must stay empty and C(app_pwhash) always renders empty, which
|
||||||
|
disables app passwords: released pihole-FTL replaces the main web password on a login with a
|
||||||
|
legacy-hashed app password.
|
||||||
- >-
|
- >-
|
||||||
Other keys the tasks read are C(repo.remote), C(repo.version) (a tag, default C(v6.4)), C(repo.path)
|
Other keys the tasks read are C(repo.remote), C(repo.version) (a tag, default C(v6.4)), C(repo.path)
|
||||||
(default C(~/.cache/pi-hole) of the connecting user), C(user), C(group) (both default C(pihole)) and
|
(default C(~/.cache/pi-hole) of the connecting user), C(user), C(group) (both default C(pihole)) and
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
database: passwd
|
database: passwd
|
||||||
key: pihole
|
key: pihole
|
||||||
|
|
||||||
- name: The config carries the overridden upstreams and a hashed password
|
- name: The config carries the overridden upstreams, a hashed password and no app password
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'9.9.9.9' in pihole_test_toml_content"
|
- "'9.9.9.9' in pihole_test_toml_content"
|
||||||
@@ -66,6 +66,7 @@
|
|||||||
- "'\"eth0\"' not in pihole_test_toml_content"
|
- "'\"eth0\"' not in pihole_test_toml_content"
|
||||||
- "'molecule-test-password' not in pihole_test_toml_content"
|
- "'molecule-test-password' not in pihole_test_toml_content"
|
||||||
- pihole_test_toml_content is search('(?m)^\\s*pwhash = \"[0-9a-f]{64}\"')
|
- pihole_test_toml_content is search('(?m)^\\s*pwhash = \"[0-9a-f]{64}\"')
|
||||||
|
- pihole_test_toml_content is search('(?m)^\\s*app_pwhash = \"\"$')
|
||||||
quiet: true
|
quiet: true
|
||||||
vars:
|
vars:
|
||||||
pihole_test_toml_content: "{{ pihole_test_toml.content | b64decode }}"
|
pihole_test_toml_content: "{{ pihole_test_toml.content | b64decode }}"
|
||||||
@@ -167,3 +168,9 @@
|
|||||||
dns: {interface: molecule0}
|
dns: {interface: molecule0}
|
||||||
webserver: {api: {password: changetoyourownpassword}}
|
webserver: {api: {password: changetoyourownpassword}}
|
||||||
expect: placeholder changetoyourownpassword
|
expect: placeholder changetoyourownpassword
|
||||||
|
- name: app-password-set
|
||||||
|
overrides:
|
||||||
|
config:
|
||||||
|
dns: {interface: molecule0}
|
||||||
|
webserver: {api: {password: molecule-test-password, app_password: molecule-test-app-password}}
|
||||||
|
expect: app_password must stay empty
|
||||||
@@ -53,3 +53,15 @@
|
|||||||
The web password is the placeholder changetoyourownpassword: set pihole_web_password, or
|
The web password is the placeholder changetoyourownpassword: set pihole_web_password, or
|
||||||
pihole_overrides.config.webserver.api.password, to a secret of your own.
|
pihole_overrides.config.webserver.api.password, to a secret of your own.
|
||||||
quiet: true
|
quiet: true
|
||||||
|
|
||||||
|
# Released pihole-FTL upgrades a legacy-hashed app password on login by writing the new hash
|
||||||
|
# into the main pwhash, so the role renders app_pwhash empty, which disables app passwords.
|
||||||
|
- name: Check that no app password is set
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- (__pihole_candidate.config.webserver.api.app_password | default('', true)) == ''
|
||||||
|
fail_msg: >-
|
||||||
|
config.webserver.api.app_password must stay empty: released pihole-FTL replaces the main
|
||||||
|
web password when someone logs in with an app password the role has hashed. Remove
|
||||||
|
app_password from pihole_overrides.
|
||||||
|
quiet: true
|
||||||
@@ -838,9 +838,9 @@
|
|||||||
#
|
#
|
||||||
# Possible values are:
|
# Possible values are:
|
||||||
# <valid Pi-hole password hash>
|
# <valid Pi-hole password hash>
|
||||||
# NOTE! I am assuming this should be double-hashed just like the regular password, but
|
# Always empty, which disables app passwords: the role refuses app_password, because
|
||||||
# this assumption has not been tested!
|
# released pihole-FTL rewrites the main pwhash on a login with a legacy-hashed app password.
|
||||||
app_pwhash = "{{ __pihole_effective.config.webserver.api.app_password | hash('sha256') | hash('sha256') }}"
|
app_pwhash = ""
|
||||||
|
|
||||||
# Should application password API sessions be allowed to modify config settings?
|
# Should application password API sessions be allowed to modify config settings?
|
||||||
# Setting this to true allows third-party applications using the application password
|
# Setting this to true allows third-party applications using the application password
|
||||||
|
|||||||
+5
-2
@@ -29,6 +29,7 @@ Main entry point:
|
|||||||
| `ufw_manage_rules` | `true` | no | Skip the `ufw_rules` schema check, the lock-out guard and rule application when false. Before-rules validation and `before.rules`, defaults and enable still run (gated on `ufw_enabled`). |
|
| `ufw_manage_rules` | `true` | no | Skip the `ufw_rules` schema check, the lock-out guard and rule application when false. Before-rules validation and `before.rules`, defaults and enable still run (gated on `ufw_enabled`). |
|
||||||
| `ufw_defaults` | `incoming: deny`, `outgoing: allow`, `routed: deny` | no | Default policies. All three keys are read, so override all of them. |
|
| `ufw_defaults` | `incoming: deny`, `outgoing: allow`, `routed: deny` | no | Default policies. All three keys are read, so override all of them. |
|
||||||
| `ufw_logging` | `"on"` | no | UFW logging level. |
|
| `ufw_logging` | `"on"` | no | UFW logging level. |
|
||||||
|
| `ufw_mask_nftables` | `true` | no | Mask `nftables.service` without stopping it, so a package upgrade cannot flush the rules ufw loaded (see Notes). Set false on a host that loads its own ruleset through that unit. Gated on `ufw_enabled`. |
|
||||||
| `ufw_require_ssh_allow` | `true` | no | Enable the SSH lock-out guard. |
|
| `ufw_require_ssh_allow` | `true` | no | Enable the SSH lock-out guard. |
|
||||||
| `ufw_ssh_port` | `ansible_port` or 22 | no | TCP port the guard looks for. |
|
| `ufw_ssh_port` | `ansible_port` or 22 | no | TCP port the guard looks for. |
|
||||||
| `ufw_rules` | `[]` | no | Base rule list: `rule` (allow, deny, reject, limit), `port`, `proto`, `from`, `to`, `interface`, `direction`, `comment`, `delete` (see Notes). |
|
| `ufw_rules` | `[]` | no | Base rule list: `rule` (allow, deny, reject, limit), `port`, `proto`, `from`, `to`, `interface`, `direction`, `comment`, `delete` (see Notes). |
|
||||||
@@ -117,7 +118,7 @@ An **orphan** is a rule tagged `ansible-ufw[<owner>:<key>]` whose owner is neith
|
|||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
`ufw` (everything), `ufw_install`, `ufw_sysctl`, `ufw_aggregate`, `ufw_validate`, `ufw_before_rules`, `ufw_defaults`, `ufw_rules`, `ufw_enable`.
|
`ufw` (everything), `ufw_install`, `ufw_sysctl`, `ufw_aggregate`, `ufw_validate`, `ufw_nftables`, `ufw_before_rules`, `ufw_defaults`, `ufw_rules`, `ufw_enable`.
|
||||||
|
|
||||||
Skipping `ufw_aggregate` leaves the lists the later tasks read (`ufw_aggregated_rules`, `ufw_aggregated_before_rules`) undefined or stale, so do not select a later tag alone.
|
Skipping `ufw_aggregate` leaves the lists the later tasks read (`ufw_aggregated_rules`, `ufw_aggregated_before_rules`) undefined or stale, so do not select a later tag alone.
|
||||||
|
|
||||||
@@ -144,10 +145,11 @@ The scenario `molecule/default/` runs in CI only, on two platforms: `${MOLECULE_
|
|||||||
- Verify then reads `ufw status verbose` and `ufw show added`: ufw is active with default deny incoming, the base rules are loaded, the deleted rule is gone, the manual and SSH rules are untouched, the service rules carry their owner tag, stale and orphan rules are deleted only where purging was on and only when they cannot carry SSH.
|
- Verify then reads `ufw status verbose` and `ufw show added`: ufw is active with default deny incoming, the base rules are loaded, the deleted rule is gone, the manual and SSH rules are untouched, the service rules carry their owner tag, stale and orphan rules are deleted only where purging was on and only when they cannot carry SSH.
|
||||||
- Verify checks `before.rules`: the loopback accept, the INVALID-state drop behind its logging rule and in its place among the input rules.
|
- Verify checks `before.rules`: the loopback accept, the INVALID-state drop behind its logging rule and in its place among the input rules.
|
||||||
- Verify runs `service_rules` under the `check_mode` keyword and checks that the rule list did not change.
|
- Verify runs `service_rules` under the `check_mode` keyword and checks that the rule list did not change.
|
||||||
|
- Verify checks the nftables mask: prepare installs `nftables`, enables and starts its unit; after the converge the unit is masked and still active, ufw's chains survive `apt-get install --reinstall nftables` (whose postinst runs the upgrade restart), the same reinstall with the mask removed flushes them (the control), and after the package is purged and the mask removed the role masks the absent unit again without failing.
|
||||||
|
|
||||||
The scenario `molecule/check-absent/` runs on the same two platforms: prepare purges ufw and refreshes the APT cache, then `check` runs the main entry point and `service_rules` under `--check`, which must pass with ufw not installed. Nothing is applied.
|
The scenario `molecule/check-absent/` runs on the same two platforms: prepare purges ufw and refreshes the APT cache, then `check` runs the main entry point and `service_rules` under `--check`, which must pass with ufw not installed. Nothing is applied.
|
||||||
|
|
||||||
Not covered: `ufw_before_rules` entries and `ufw_sysctl_overrides` are never set, and `orphan_rules` runs in check mode only under `--check` (the `check` steps), not under the `check_mode` keyword.
|
Not covered: `ufw_mask_nftables: false` is never set, `ufw_before_rules` entries and `ufw_sysctl_overrides` are never set, and `orphan_rules` runs in check mode only under `--check` (the `check` steps), not under the `check_mode` keyword.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
@@ -158,5 +160,6 @@ Not covered: `ufw_before_rules` entries and `ufw_sysctl_overrides` are never set
|
|||||||
- Rule schema is asserted before anything changes: `rule` must be allow, deny, reject or limit, `port` a positive integer, `proto` tcp or udp, and each rule needs `port`, `from`, `to` or `interface`.
|
- Rule schema is asserted before anything changes: `rule` must be allow, deny, reject or limit, `port` a positive integer, `proto` tcp or udp, and each rule needs `port`, `from`, `to` or `interface`.
|
||||||
- UFW is only re-enabled when `ufw status verbose` shows it inactive or the logging line differs, because the module rewrites rules and re-applies sysctl on every call.
|
- UFW is only re-enabled when `ufw status verbose` shows it inactive or the logging line differs, because the module rewrites rules and re-applies sysctl on every call.
|
||||||
- The `Reload UFW` handler runs `ufw reload`.
|
- The `Reload UFW` handler runs `ufw reload`.
|
||||||
|
- nftables: when `nftables.service` is enabled (a preset can do that), the `nftables` package's postinst restarts it on upgrade (`dh_installsystemd --no-enable --no-start --restart-after-upgrade` emits `deb-systemd-invoke try-restart`), and both the restart and the unit's `ExecStop=/usr/sbin/nft flush ruleset` delete every rule ufw (and Docker) loaded, since the stock `/etc/nftables.conf` begins with `flush ruleset`. The role masks the unit and does not stop it, so nothing is flushed during the run. systemd refuses every job but a stop on a masked unit, so the postinst's restart fails before anything runs and the postinst ignores the failure (`|| true`); at boot the unit is not started either. The mask also applies when the unit or the package is absent, so a later install cannot enable it; the package's postinst removes only a mask its own helper created. The role never unmasks: with `ufw_mask_nftables: false` or `ufw_enabled: false` an existing mask stays. `--check` reports the mask without applying it. When `/etc/systemd/system/nftables.service` is a unit file of its own rather than a link, `systemctl mask` refuses with "already exists" and the play fails; set `ufw_mask_nftables: false` on such a host.
|
||||||
- Check mode: `--check` is the supported preview; a play-level `check_mode: true` is not supported. On a host without ufw the preview reports the install and skips the configuration (`before.rules`, default policies, rules, enable), which needs the `ufw` binary.
|
- Check mode: `--check` is the supported preview; a play-level `check_mode: true` is not supported. On a host without ufw the preview reports the install and skips the configuration (`before.rules`, default policies, rules, enable), which needs the `ufw` binary.
|
||||||
- `no_log` is not used: the role handles no secrets.
|
- `no_log` is not used: the role handles no secrets.
|
||||||
@@ -9,6 +9,10 @@ ufw_defaults:
|
|||||||
|
|
||||||
ufw_logging: "on"
|
ufw_logging: "on"
|
||||||
|
|
||||||
|
# Mask nftables.service (not stopped), so a restart by a package upgrade cannot flush the rules
|
||||||
|
# ufw loaded. false: leave the unit alone, for hosts that load their own ruleset through it.
|
||||||
|
ufw_mask_nftables: true
|
||||||
|
|
||||||
# Lock-out guard: with a deny/reject incoming default the play refuses to run
|
# Lock-out guard: with a deny/reject incoming default the play refuses to run
|
||||||
# unless an allow/limit rule for this TCP port is in the rule list, since the
|
# unless an allow/limit rule for this TCP port is in the rule list, since the
|
||||||
# default is applied before the rules and a missing rule cuts the SSH session.
|
# default is applied before the rules and a missing rule cuts the SSH session.
|
||||||
|
|||||||
@@ -49,6 +49,18 @@ argument_specs:
|
|||||||
choices: ["on", "off", low, medium, high, full]
|
choices: ["on", "off", low, medium, high, full]
|
||||||
description:
|
description:
|
||||||
- UFW logging setting. UFW is only re-enabled when it is inactive or its current logging line differs from this value.
|
- UFW logging setting. UFW is only re-enabled when it is inactive or its current logging line differs from this value.
|
||||||
|
ufw_mask_nftables:
|
||||||
|
type: bool
|
||||||
|
default: true
|
||||||
|
description:
|
||||||
|
- >-
|
||||||
|
When true (and C(ufw_enabled) is true) C(nftables.service) is masked, without being stopped, also when the
|
||||||
|
unit or the C(nftables) package is absent. A restart of the enabled unit, which the package runs on upgrade,
|
||||||
|
loads the stock C(/etc/nftables.conf) that begins with C(flush ruleset), and its stop flushes the ruleset,
|
||||||
|
which deletes the rules ufw loaded. A masked unit is never started, also not at boot.
|
||||||
|
- >-
|
||||||
|
Set false on hosts that load their own ruleset through C(nftables.service). The role never unmasks the unit,
|
||||||
|
so switching to false leaves an existing mask in place.
|
||||||
ufw_require_ssh_allow:
|
ufw_require_ssh_allow:
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
|
|||||||
@@ -84,3 +84,40 @@
|
|||||||
- {port: "40:50", comment: "ansible-ufw[svc_c:6666666663]: range"}
|
- {port: "40:50", comment: "ansible-ufw[svc_c:6666666663]: range"}
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: ufw_prepare_rule
|
loop_var: ufw_prepare_rule
|
||||||
|
|
||||||
|
# An enabled, active nftables.service with the stock /etc/nftables.conf, as a preset leaves
|
||||||
|
# it; verify.yml checks that the role's mask keeps a package upgrade from flushing ufw's rules.
|
||||||
|
- name: Install nftables
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: nftables
|
||||||
|
state: present
|
||||||
|
|
||||||
|
# A policy-rc.d that refuses actions would make the postinst skip the restart verify.yml tests.
|
||||||
|
- name: Let maintainer scripts act on units as on a host
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /usr/sbin/policy-rc.d
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
# ProtectSystem and ProtectHome need a mount namespace, which needs CAP_SYS_ADMIN; without
|
||||||
|
# it the unit fails with 226/NAMESPACE in this unprivileged container.
|
||||||
|
- name: Create the drop-in directory of nftables.service
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/systemd/system/nftables.service.d
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Disable the namespace-based sandboxing of nftables.service for the container
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/systemd/system/nftables.service.d/molecule.conf
|
||||||
|
mode: "0644"
|
||||||
|
content: |
|
||||||
|
[Service]
|
||||||
|
ProtectSystem=no
|
||||||
|
ProtectHome=no
|
||||||
|
|
||||||
|
- name: Enable and start nftables.service
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: nftables.service
|
||||||
|
enabled: true
|
||||||
|
state: started
|
||||||
|
daemon_reload: true
|
||||||
@@ -521,3 +521,110 @@
|
|||||||
- ufw_verify_chk_after.stdout_lines == ufw_verify_chk_before.stdout_lines
|
- ufw_verify_chk_after.stdout_lines == ufw_verify_chk_before.stdout_lines
|
||||||
- ufw_verify_chk_after.stdout_lines | select('search', 'svc_chk|7701') | list | length == 0
|
- ufw_verify_chk_after.stdout_lines | select('search', 'svc_chk|7701') | list | length == 0
|
||||||
quiet: true
|
quiet: true
|
||||||
|
|
||||||
|
# prepare.yml left nftables.service enabled and active. The package's postinst runs
|
||||||
|
# `deb-systemd-invoke try-restart nftables.service` on upgrade (and on a reinstall, which passes
|
||||||
|
# the old version too); the stock config and ExecStop flush the ruleset. The masked case runs
|
||||||
|
# first, then a control without the mask proves the reinstall reaches the unit here, then the
|
||||||
|
# absent-package case. Last, because the control flushes ufw's rules.
|
||||||
|
- name: The nftables mask keeps a package upgrade from flushing the rules
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
ufw_verify_nft_reinstall:
|
||||||
|
- apt-get
|
||||||
|
- install
|
||||||
|
- --reinstall
|
||||||
|
- -y
|
||||||
|
- -o
|
||||||
|
- Dpkg::Options::=--force-confold
|
||||||
|
- nftables
|
||||||
|
tasks:
|
||||||
|
# A mask request in check mode changes nothing and returns the unit's properties.
|
||||||
|
- name: Read the state of nftables.service
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: nftables.service
|
||||||
|
masked: true
|
||||||
|
check_mode: true
|
||||||
|
register: ufw_verify_nft_unit
|
||||||
|
|
||||||
|
- name: The role masked the unit and did not stop it
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ufw_verify_nft_unit is not changed
|
||||||
|
- ufw_verify_nft_unit.status.LoadState == 'masked'
|
||||||
|
- ufw_verify_nft_unit.status.ActiveState == 'active'
|
||||||
|
quiet: true
|
||||||
|
|
||||||
|
- name: Reinstall nftables while the unit is masked
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: "{{ ufw_verify_nft_reinstall }}"
|
||||||
|
environment: {DEBIAN_FRONTEND: noninteractive}
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
|
- name: Read the iptables rules after the masked reinstall
|
||||||
|
ansible.builtin.command: iptables -S
|
||||||
|
register: ufw_verify_nft_masked_rules
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: The rules of ufw survived the reinstall
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ufw_verify_nft_masked_rules.stdout_lines | select('search', '^-N ufw-user-input$') | list | length == 1
|
||||||
|
- ufw_verify_nft_masked_rules.stdout_lines | select('search', '^-A ufw-user-input .*--dport 22 ') | list | length > 0
|
||||||
|
quiet: true
|
||||||
|
|
||||||
|
- name: Remove the mask for the control case
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: nftables.service
|
||||||
|
masked: false
|
||||||
|
|
||||||
|
- name: Reinstall nftables while the unit is enabled and active
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: "{{ ufw_verify_nft_reinstall }}"
|
||||||
|
environment: {DEBIAN_FRONTEND: noninteractive}
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
|
- name: Read the iptables rules after the unmasked reinstall
|
||||||
|
ansible.builtin.command: iptables -S
|
||||||
|
register: ufw_verify_nft_unmasked_rules
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Without the mask the reinstall flushed the rules of ufw
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that: ufw_verify_nft_unmasked_rules.stdout_lines | select('search', '^-N ufw-user-input$') | list | length == 0
|
||||||
|
quiet: true
|
||||||
|
|
||||||
|
- name: Purge nftables
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: nftables
|
||||||
|
state: absent
|
||||||
|
purge: true
|
||||||
|
|
||||||
|
- name: Read the state of nftables.service with the package gone
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: nftables.service
|
||||||
|
masked: true
|
||||||
|
check_mode: true
|
||||||
|
register: ufw_verify_nft_gone
|
||||||
|
|
||||||
|
- name: Run the role on a host without the nftables package
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: mortis.kamino.ufw
|
||||||
|
vars:
|
||||||
|
ufw_rules:
|
||||||
|
- {rule: allow, port: 22, proto: tcp, comment: ssh}
|
||||||
|
|
||||||
|
- name: Read the state of nftables.service after the role
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: nftables.service
|
||||||
|
masked: true
|
||||||
|
check_mode: true
|
||||||
|
register: ufw_verify_nft_absent
|
||||||
|
|
||||||
|
- name: The role masked the absent unit without failing
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ufw_verify_nft_gone is changed
|
||||||
|
- ufw_verify_nft_absent is not changed
|
||||||
|
quiet: true
|
||||||
@@ -35,6 +35,10 @@
|
|||||||
ansible.builtin.import_tasks: validate.yml
|
ansible.builtin.import_tasks: validate.yml
|
||||||
tags: [ufw, ufw_validate]
|
tags: [ufw, ufw_validate]
|
||||||
|
|
||||||
|
- name: Import UFW nftables task
|
||||||
|
ansible.builtin.import_tasks: nftables.yml
|
||||||
|
tags: [ufw, ufw_nftables]
|
||||||
|
|
||||||
- name: Import UFW before rules task
|
- name: Import UFW before rules task
|
||||||
ansible.builtin.import_tasks: before_rules.yml
|
ansible.builtin.import_tasks: before_rules.yml
|
||||||
tags: [ufw, ufw_before_rules]
|
tags: [ufw, ufw_before_rules]
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
# A restart of nftables.service (on a package upgrade) flushes the rules ufw loaded. Mask only:
|
||||||
|
# a stop would flush them now. README Notes has the detail.
|
||||||
|
- name: Mask nftables.service without stopping it
|
||||||
|
become: true
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: nftables.service
|
||||||
|
masked: true
|
||||||
|
when:
|
||||||
|
- ufw_enabled
|
||||||
|
- ufw_mask_nftables
|
||||||
+2
-2
@@ -12,8 +12,8 @@ rules for scripts (prefer a standard tool, comment length) are in
|
|||||||
- **A script change comes with its test in `tests/scripts/`** (`test_<script>.py`), in the same
|
- **A script change comes with its test in `tests/scripts/`** (`test_<script>.py`), in the same
|
||||||
pull request. Run them with `python3 -m unittest discover -s tests/scripts`.
|
pull request. Run them with `python3 -m unittest discover -s tests/scripts`.
|
||||||
*Why:* a script decides whether a pull request passes, so an untested change can wave through
|
*Why:* a script decides whether a pull request passes, so an untested change can wave through
|
||||||
what it should stop. *Held:* control: the Lint check's "Test the repository scripts" step runs
|
what it should stop. *Held:* control: the `script-tests` pre-push hook runs the
|
||||||
the tests; review for whether the change is tested at all.
|
tests, and the Lint check runs it again; review for whether the change is tested at all.
|
||||||
- **A line added to `tests/sanity/ignore-common.txt` is a last resort and carries its reason** as
|
- **A line added to `tests/sanity/ignore-common.txt` is a last resort and carries its reason** as
|
||||||
a trailing `# ...` comment. Fix the finding first. A finding of one ansible-core version only
|
a trailing `# ...` comment. Fix the finding first. A finding of one ansible-core version only
|
||||||
goes in a committed `ignore-<MAJOR.MINOR>.txt`, which the Build job appends.
|
goes in a committed `ignore-<MAJOR.MINOR>.txt`, which the Build job appends.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ cd "$root"
|
|||||||
|
|
||||||
for tool in ansible ansible-test; do
|
for tool in ansible ansible-test; do
|
||||||
if ! command -v "$tool" >/dev/null 2>&1; then
|
if ! command -v "$tool" >/dev/null 2>&1; then
|
||||||
echo "error: $tool is not on PATH; run scripts/dev-setup.sh and use its virtualenv (.venv/bin)" >&2
|
echo "error: $tool is not on PATH; run scripts/dev-setup.sh and use its virtualenv (.venv-dev/bin)" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ When <head-ref> starts with `renovate/`, the diff of <base-ref>...HEAD may only
|
|||||||
`name==version` entries, `--hash=sha256:<64 hex>` lines and plain `# via` or prose comments,
|
`name==version` entries, `--hash=sha256:<64 hex>` lines and plain `# via` or prose comments,
|
||||||
nothing else; packages may be added or removed (a transitive dependency), but the
|
nothing else; packages may be added or removed (a transitive dependency), but the
|
||||||
`# pip-compile ...` command in the header, which Renovate runs again, must stay as it is;
|
`# pip-compile ...` command in the header, which Renovate runs again, must stay as it is;
|
||||||
|
* pyproject.toml: the version of a quoted `"name==version"` pin (the names, spelled as they
|
||||||
|
are, and every other line, stay), only together with uv.lock;
|
||||||
|
* uv.lock: the apm-cli bump to the pin of the new pyproject.toml, and nothing else
|
||||||
|
(check_uv_lock.py), only together with pyproject.toml;
|
||||||
* requirements.yml and extensions/molecule/requirements.yml: `version:` lines (the collection
|
* requirements.yml and extensions/molecule/requirements.yml: `version:` lines (the collection
|
||||||
names, and every other line, stay);
|
names, and every other line, stay);
|
||||||
* .pre-commit-config.yaml: `rev:` lines (a tag, or a commit SHA with its `# frozen: <tag>` comment);
|
* .pre-commit-config.yaml: `rev:` lines (a tag, or a commit SHA with its `# frozen: <tag>` comment);
|
||||||
@@ -21,8 +25,11 @@ When <head-ref> starts with `renovate/`, the diff of <base-ref>...HEAD may only
|
|||||||
`job_image: ubuntu:...@sha256:...` lines (the name stays); CI assigns the image versions
|
`job_image: ubuntu:...@sha256:...` lines (the name stays); CI assigns the image versions
|
||||||
and a human sets the matrix `base:`, so neither is the bot's to change;
|
and a human sets the matrix `base:`, so neither is the bot's to change;
|
||||||
* .gitea/workflows/{lint,build,molecule,gitea-release-key}.yml: the version and digest of a
|
* .gitea/workflows/{lint,build,molecule,gitea-release-key}.yml: the version and digest of a
|
||||||
`git.rkdr.net/mortis/<name>:<version>@sha256:<digest>` pin (the name stays), including
|
`git.rkdr.net/mortis/<name>:<version>@sha256:<digest>` pin, in place (the name stays),
|
||||||
the MOLECULE_IMAGE value.
|
including the MOLECULE_IMAGE value;
|
||||||
|
* .gitea/workflows/renovate.yml, and lint.yml's copy of it: the version and digest of the
|
||||||
|
`image: renovate/renovate:<version>-full@sha256:<digest>` line, in place; the name and the
|
||||||
|
`-full` flavour stay (the job's report check needs the python3 that only -full ships).
|
||||||
|
|
||||||
Every other file, every other line, an added, deleted or mode-changed file fails, with one
|
Every other file, every other line, an added, deleted or mode-changed file fails, with one
|
||||||
`::error::` line per offending file. renovate.json itself is not allowed: the bot does not
|
`::error::` line per offending file. renovate.json itself is not allowed: the bot does not
|
||||||
@@ -50,6 +57,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import check_image_versions as civ
|
import check_image_versions as civ
|
||||||
|
import check_uv_lock
|
||||||
|
|
||||||
PREFIX = "renovate/"
|
PREFIX = "renovate/"
|
||||||
TAG = r"[A-Za-z0-9._-]+"
|
TAG = r"[A-Za-z0-9._-]+"
|
||||||
@@ -68,13 +76,18 @@ UV_TOKEN = re.compile(r"\buv==[0-9][0-9A-Za-z.+!_-]*")
|
|||||||
UBUNTU_LINE = re.compile(
|
UBUNTU_LINE = re.compile(
|
||||||
rf"^(\s*job_image:\s*ubuntu)(?::{TAG})?@sha256:[0-9a-f]{{64}}\s*$"
|
rf"^(\s*job_image:\s*ubuntu)(?::{TAG})?@sha256:[0-9a-f]{{64}}\s*$"
|
||||||
)
|
)
|
||||||
|
RENOVATE_LINE = re.compile(
|
||||||
|
r"^(\s*image:\s*renovate/renovate:)[0-9]+(?:\.[0-9]+)*(-full)@sha256:[0-9a-f]{64}\s*$"
|
||||||
|
)
|
||||||
|
RENOVATE_WORKFLOW = ".gitea/workflows/renovate.yml"
|
||||||
|
LINT_WORKFLOW = ".gitea/workflows/lint.yml"
|
||||||
DOCKERFILE = re.compile(r"images/[^/]+/Dockerfile")
|
DOCKERFILE = re.compile(r"images/[^/]+/Dockerfile")
|
||||||
COLLECTION_PINS = {"requirements.yml", "extensions/molecule/requirements.yml"}
|
COLLECTION_PINS = {"requirements.yml", "extensions/molecule/requirements.yml"}
|
||||||
# Lint's and the molecule-controller image's requirements, each with its pip-compile lock.
|
# Lint's and the molecule-controller image's requirements, each with its pip-compile lock.
|
||||||
REQUIREMENTS = {"requirements-dev.txt", "requirements-molecule.txt"}
|
REQUIREMENTS = {"requirements-dev.txt", "requirements-molecule.txt"}
|
||||||
LOCKS = {"requirements-dev.lock", "requirements-molecule.lock"}
|
LOCKS = {"requirements-dev.lock", "requirements-molecule.lock"}
|
||||||
|
UV_LOCK = "uv.lock"
|
||||||
CONSUMERS = {
|
CONSUMERS = {
|
||||||
".gitea/workflows/lint.yml",
|
|
||||||
".gitea/workflows/build.yml",
|
".gitea/workflows/build.yml",
|
||||||
".gitea/workflows/molecule.yml",
|
".gitea/workflows/molecule.yml",
|
||||||
".gitea/workflows/gitea-release-key.yml",
|
".gitea/workflows/gitea-release-key.yml",
|
||||||
@@ -144,6 +157,16 @@ def lock_problem(removed, added):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
# A quoted `name==version` pin in a pyproject.toml dependency array.
|
||||||
|
PYPROJECT_PIN = re.compile(r'"([A-Za-z0-9][A-Za-z0-9._-]*)==[0-9][0-9A-Za-z.+!_-]*"')
|
||||||
|
|
||||||
|
|
||||||
|
def reduce_pyproject(line):
|
||||||
|
if not PYPROJECT_PIN.search(line):
|
||||||
|
return None
|
||||||
|
return PYPROJECT_PIN.sub(lambda m: f'"{m[1]}==X"', line)
|
||||||
|
|
||||||
|
|
||||||
def reduce_rev(line):
|
def reduce_rev(line):
|
||||||
return "rev" if REV_LINE.match(line) else None
|
return "rev" if REV_LINE.match(line) else None
|
||||||
|
|
||||||
@@ -167,6 +190,28 @@ def reduce_pin(line):
|
|||||||
return reduced if PIN.search(line) else None
|
return reduced if PIN.search(line) else None
|
||||||
|
|
||||||
|
|
||||||
|
def reduce_renovate_image(line):
|
||||||
|
m = RENOVATE_LINE.match(line)
|
||||||
|
return m[1] + "X" + m[2] if m else None
|
||||||
|
|
||||||
|
|
||||||
|
def reduce_lint_yml(line):
|
||||||
|
# Lint also validates renovate.json in a copy of renovate.yml's image.
|
||||||
|
return reduce_pin(line) or reduce_renovate_image(line)
|
||||||
|
|
||||||
|
|
||||||
|
MORTIS_PIN = (reduce_pin, "an image pin of the mortis registry")
|
||||||
|
# The workflows whose image lines a bot moves: (reduce_line, what may change).
|
||||||
|
WORKFLOW_PINS = {
|
||||||
|
**dict.fromkeys(CONSUMERS, MORTIS_PIN),
|
||||||
|
LINT_WORKFLOW: (
|
||||||
|
reduce_lint_yml,
|
||||||
|
"an image pin of the mortis registry or the Renovate image line",
|
||||||
|
),
|
||||||
|
RENOVATE_WORKFLOW: (reduce_renovate_image, "the Renovate image line"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def file_problem(path, removed, added):
|
def file_problem(path, removed, added):
|
||||||
"""One-line reason why the change to `path` is not allowed for a bot, or None."""
|
"""One-line reason why the change to `path` is not allowed for a bot, or None."""
|
||||||
if path in REQUIREMENTS:
|
if path in REQUIREMENTS:
|
||||||
@@ -178,6 +223,10 @@ def file_problem(path, removed, added):
|
|||||||
)
|
)
|
||||||
if path in LOCKS:
|
if path in LOCKS:
|
||||||
return lock_problem(removed, added)
|
return lock_problem(removed, added)
|
||||||
|
if path == "pyproject.toml":
|
||||||
|
return same_shape(
|
||||||
|
removed, added, reduce_pyproject, "a quoted `name==version` pin"
|
||||||
|
)
|
||||||
if path in COLLECTION_PINS:
|
if path in COLLECTION_PINS:
|
||||||
return same_shape(removed, added, reduce_version, "a `version:` line")
|
return same_shape(removed, added, reduce_version, "a `version:` line")
|
||||||
if path == ".pre-commit-config.yaml":
|
if path == ".pre-commit-config.yaml":
|
||||||
@@ -196,10 +245,8 @@ def file_problem(path, removed, added):
|
|||||||
reduce_image_yml,
|
reduce_image_yml,
|
||||||
"a `job_image:` ubuntu pin",
|
"a `job_image:` ubuntu pin",
|
||||||
)
|
)
|
||||||
if path in CONSUMERS:
|
if path in WORKFLOW_PINS:
|
||||||
return same_shape(
|
return same_shape(removed, added, *WORKFLOW_PINS[path])
|
||||||
removed, added, reduce_pin, "an image pin of the mortis registry"
|
|
||||||
)
|
|
||||||
return "is not a file a bot pull request may change"
|
return "is not a file a bot pull request may change"
|
||||||
|
|
||||||
|
|
||||||
@@ -248,21 +295,29 @@ def parse_patch(text):
|
|||||||
|
|
||||||
def moved_problem(removed, added):
|
def moved_problem(removed, added):
|
||||||
"""A reason when a changed line changes position, else None; both lists are (line number, line).
|
"""A reason when a changed line changes position, else None; both lists are (line number, line).
|
||||||
A `job_image:` pin moved to another matrix entry would change which job runs on it."""
|
A `job_image:` pin moved to another matrix entry, or a workflow's image line moved to another
|
||||||
|
job, would change which job runs on it."""
|
||||||
if [n for n, unused in removed] != [n for n, unused in added]:
|
if [n for n, unused in removed] != [n for n, unused in added]:
|
||||||
return "moves or deletes a line (the changed lines must stay where they are)"
|
return "moves or deletes a line (the changed lines must stay where they are)"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def check(entries, patch_of):
|
def check(entries, patch_of, show=None):
|
||||||
"""One message per offending file; patch_of(path) returns that file's -U0 patch text."""
|
"""One message per offending file; patch_of(path) returns that file's -U0 patch text and
|
||||||
|
show(side, path) its text on the "base" or "head" side (needed for uv.lock)."""
|
||||||
problems = []
|
problems = []
|
||||||
|
# The pin and its lock move together, so neither can change what the other one locks.
|
||||||
|
partners = {"pyproject.toml": UV_LOCK, UV_LOCK: "pyproject.toml"}
|
||||||
|
paths = {path for unused, unused, unused, path in entries}
|
||||||
for old_mode, new_mode, status, path in entries:
|
for old_mode, new_mode, status, path in entries:
|
||||||
if status != "M" or old_mode != new_mode or new_mode != "100644":
|
if status != "M" or old_mode != new_mode or new_mode != "100644":
|
||||||
problems.append(
|
problems.append(
|
||||||
f"{path}: a bot pull request may not add, delete, rename or change the mode of a file"
|
f"{path}: a bot pull request may not add, delete, rename or change the mode of a file"
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
if path in partners and partners[path] not in paths:
|
||||||
|
problems.append(f"{path}: changes without {partners[path]}")
|
||||||
|
continue
|
||||||
patch = patch_of(path)
|
patch = patch_of(path)
|
||||||
if BINARY.search(patch):
|
if BINARY.search(patch):
|
||||||
problems.append(
|
problems.append(
|
||||||
@@ -276,10 +331,23 @@ def check(entries, patch_of):
|
|||||||
f"{len(removed)} removed and {len(added)} added (binary or empty change?)"
|
f"{len(removed)} removed and {len(added)} added (binary or empty change?)"
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
reason = file_problem(
|
if path == UV_LOCK:
|
||||||
path, [line for unused, line in removed], [line for unused, line in added]
|
reason = (
|
||||||
|
check_uv_lock.lock_problem(
|
||||||
|
show("base", path),
|
||||||
|
show("head", path),
|
||||||
|
show("head", "pyproject.toml"),
|
||||||
)
|
)
|
||||||
if not reason and path == civ.MATRIX_FILE:
|
if show
|
||||||
|
else "is not a file a bot pull request may change"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
reason = file_problem(
|
||||||
|
path,
|
||||||
|
[line for unused, line in removed],
|
||||||
|
[line for unused, line in added],
|
||||||
|
)
|
||||||
|
if not reason and (path == civ.MATRIX_FILE or path in WORKFLOW_PINS):
|
||||||
reason = moved_problem(removed, added)
|
reason = moved_problem(removed, added)
|
||||||
if reason:
|
if reason:
|
||||||
problems.append(f"{path}: {reason}")
|
problems.append(f"{path}: {reason}")
|
||||||
@@ -336,8 +404,14 @@ def run(argv):
|
|||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def show(side, path):
|
||||||
|
rev = base if side == "base" else "HEAD"
|
||||||
|
return civ.git("cat-file", "blob", f"{rev}:{path}")
|
||||||
|
|
||||||
entries = parse_raw(raw)
|
entries = parse_raw(raw)
|
||||||
return check(entries, patch_of), f"{len(entries)} file(s) within the bot allowance"
|
return check(
|
||||||
|
entries, patch_of, show
|
||||||
|
), f"{len(entries)} file(s) within the bot allowance"
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ allow list. It fails the build for:
|
|||||||
ansible-galaxy dereferences FILE symlinks while building, so a symlink to a file reaches
|
ansible-galaxy dereferences FILE symlinks while building, so a symlink to a file reaches
|
||||||
the archive as a regular file with the target's content and this check cannot see it. The
|
the archive as a regular file with the target's content and this check cannot see it. The
|
||||||
`Refuse symlinks in the source tree` step of .gitea/workflows/build.yml is the only guard
|
`Refuse symlinks in the source tree` step of .gitea/workflows/build.yml is the only guard
|
||||||
against that. Its `find` prunes ./.venv and ./.git only because both are in galaxy.yml
|
against that. Its `find` prunes ./.git, ./.venv and ./.venv-dev only because they are in galaxy.yml
|
||||||
`build_ignore` (or excluded by ansible-galaxy itself, as .git is): the two lists must stay
|
`build_ignore` (or excluded by ansible-galaxy itself, as .git is): the two lists must stay
|
||||||
in step, and tests/scripts/test_check_tarball.py fails when a pruned directory is not
|
in step, and tests/scripts/test_check_tarball.py fails when a pruned directory is not
|
||||||
ignored by the build.
|
ignored by the build.
|
||||||
|
|||||||
@@ -0,0 +1,198 @@
|
|||||||
|
# SPDX-FileCopyrightText: Defame1297 and contributors
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
"""The uv.lock rule of check_bot_pr_diff.py: a bot may move apm-cli to its pin, nothing else.
|
||||||
|
|
||||||
|
Both locks are parsed. The top level stays as it is, except `revision`. The same packages are
|
||||||
|
locked, and every one but apm-cli and the root project is unchanged. The root project changes
|
||||||
|
only its apm-cli specifier, to the pin in pyproject.toml. apm-cli changes only its version, up
|
||||||
|
to that pin, and its files: the same kinds (an sdist if it had one, the same wheel tags), each
|
||||||
|
on PyPI's download host, named for apm-cli at the pin, by sha256. Versions are plain releases
|
||||||
|
compared as numbers. A bump that moves anything else fails, and a person makes it by hand.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import copy
|
||||||
|
import re
|
||||||
|
import tomllib
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
|
PACKAGE = "apm-cli"
|
||||||
|
REGISTRY = {"registry": "https://pypi.org/simple"}
|
||||||
|
ROOT_SOURCE = {"virtual": "."}
|
||||||
|
FILE_KEYS = {"url", "hash", "size", "upload-time"}
|
||||||
|
SHA256 = re.compile(r"sha256:[0-9a-f]{64}")
|
||||||
|
PIN = re.compile(rf"{re.escape(PACKAGE)}==([0-9][0-9A-Za-z.+!_-]*)")
|
||||||
|
# A plain release; pre-, post- and dev-releases, epochs and local versions are bumped by hand.
|
||||||
|
RELEASE = re.compile(r"[0-9]+(?:\.[0-9]+)*")
|
||||||
|
DIST = re.sub(r"[-_.]+", "_", PACKAGE).lower()
|
||||||
|
|
||||||
|
|
||||||
|
class Refused(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def parse(text, what):
|
||||||
|
try:
|
||||||
|
return tomllib.loads(text)
|
||||||
|
except tomllib.TOMLDecodeError as exc:
|
||||||
|
raise Refused(f"{what} is not valid TOML ({exc})") from None
|
||||||
|
|
||||||
|
|
||||||
|
def pinned_version(pyproject):
|
||||||
|
pins = [
|
||||||
|
m[1]
|
||||||
|
for entry in parse(pyproject, "pyproject.toml")
|
||||||
|
.get("dependency-groups", {})
|
||||||
|
.get("dev", [])
|
||||||
|
if isinstance(entry, str) and (m := PIN.fullmatch(entry))
|
||||||
|
]
|
||||||
|
if len(pins) != 1:
|
||||||
|
raise Refused(f"pyproject.toml does not pin {PACKAGE} once with ==")
|
||||||
|
return pins[0]
|
||||||
|
|
||||||
|
|
||||||
|
def by_name(lock):
|
||||||
|
packages = {}
|
||||||
|
for package in lock.get("package", []):
|
||||||
|
packages.setdefault(package.get("name"), []).append(package)
|
||||||
|
return packages
|
||||||
|
|
||||||
|
|
||||||
|
def only(packages, what):
|
||||||
|
if len(packages) != 1:
|
||||||
|
raise Refused(f"the lock does not hold exactly one {what}")
|
||||||
|
return packages[0]
|
||||||
|
|
||||||
|
|
||||||
|
def without_apm_specifier(root):
|
||||||
|
"""The root project with its apm-cli dev specifier blanked, and that specifier."""
|
||||||
|
root = copy.deepcopy(root)
|
||||||
|
entries = [
|
||||||
|
entry
|
||||||
|
for entry in root.get("metadata", {}).get("requires-dev", {}).get("dev", [])
|
||||||
|
if entry.get("name") == PACKAGE
|
||||||
|
]
|
||||||
|
entry = only(entries, f"{PACKAGE} dev requirement in the root project")
|
||||||
|
specifier = entry.pop("specifier", None)
|
||||||
|
return root, specifier
|
||||||
|
|
||||||
|
|
||||||
|
def release(version):
|
||||||
|
"""A plain release as a tuple of numbers without trailing zeros, or None."""
|
||||||
|
if not isinstance(version, str) or not RELEASE.fullmatch(version):
|
||||||
|
return None
|
||||||
|
parts = [int(part) for part in version.split(".")]
|
||||||
|
while len(parts) > 1 and parts[-1] == 0:
|
||||||
|
parts.pop()
|
||||||
|
return tuple(parts)
|
||||||
|
|
||||||
|
|
||||||
|
def file_kinds(package):
|
||||||
|
"""The kinds of file a package locks: "sdist" and the tag of each wheel."""
|
||||||
|
version = package.get("version")
|
||||||
|
kinds = {"sdist"} if "sdist" in package else set()
|
||||||
|
for wheel in package.get("wheels", []):
|
||||||
|
name = urllib.parse.urlsplit(wheel.get("url", "")).path.rsplit("/", 1)[-1]
|
||||||
|
prefix = f"{DIST}-{version}-"
|
||||||
|
if not (name.startswith(prefix) and name.endswith(".whl")):
|
||||||
|
raise Refused(f"the {PACKAGE} wheel {name} is not {PACKAGE} {version}")
|
||||||
|
kinds.add(name[len(prefix) : -len(".whl")])
|
||||||
|
return kinds
|
||||||
|
|
||||||
|
|
||||||
|
def file_problem(pin, file):
|
||||||
|
url = urllib.parse.urlsplit(file.get("url", ""))
|
||||||
|
segments = url.path.split("/")
|
||||||
|
name = segments[-1]
|
||||||
|
if not (
|
||||||
|
set(file) <= FILE_KEYS
|
||||||
|
and url.scheme == "https"
|
||||||
|
and url.netloc == "files.pythonhosted.org"
|
||||||
|
and segments[:2] == ["", "packages"]
|
||||||
|
and not any(part in ("", ".", "..") for part in segments[1:])
|
||||||
|
and "%" not in url.path
|
||||||
|
and not (url.query or url.fragment)
|
||||||
|
):
|
||||||
|
return f"an {PACKAGE} file is not a plain download from files.pythonhosted.org"
|
||||||
|
if not (
|
||||||
|
name == f"{DIST}-{pin}.tar.gz"
|
||||||
|
or (name.startswith(f"{DIST}-{pin}-") and name.endswith(".whl"))
|
||||||
|
):
|
||||||
|
return f"the {PACKAGE} file {name} is not {PACKAGE} {pin}"
|
||||||
|
if not SHA256.fullmatch(str(file.get("hash", ""))):
|
||||||
|
return f"the {PACKAGE} file {name} has no sha256 hash"
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def apm_problem(old, new, pin):
|
||||||
|
if new.get("version") != pin:
|
||||||
|
return f"{PACKAGE} is locked at {new.get('version')}, not at the pin {pin}"
|
||||||
|
old_release, new_release = release(old.get("version")), release(pin)
|
||||||
|
if old_release is None or new_release is None:
|
||||||
|
return f"{PACKAGE} {old.get('version')} or {pin} is not a plain release"
|
||||||
|
if new_release <= old_release:
|
||||||
|
return f"{PACKAGE} does not move up from {old.get('version')} to {pin}"
|
||||||
|
rest = {"version", "sdist", "wheels"}
|
||||||
|
if {k: v for k, v in old.items() if k not in rest} != {
|
||||||
|
k: v for k, v in new.items() if k not in rest
|
||||||
|
}:
|
||||||
|
return f"changes the source or dependencies of {PACKAGE}"
|
||||||
|
files = ([new["sdist"]] if "sdist" in new else []) + new.get("wheels", [])
|
||||||
|
if not files:
|
||||||
|
return f"locks no file for {PACKAGE}"
|
||||||
|
for file in files:
|
||||||
|
reason = file_problem(pin, file)
|
||||||
|
if reason:
|
||||||
|
return reason
|
||||||
|
if file_kinds(old) != file_kinds(new):
|
||||||
|
return f"changes which kinds of file {PACKAGE} locks (sdist, wheel tags)"
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def compare(old, new, pin):
|
||||||
|
rest = {"revision", "package"}
|
||||||
|
if {k: v for k, v in old.items() if k not in rest} != {
|
||||||
|
k: v for k, v in new.items() if k not in rest
|
||||||
|
}:
|
||||||
|
return "changes a top-level setting other than revision"
|
||||||
|
if not isinstance(new.get("revision"), int):
|
||||||
|
return "the lock revision is not a number"
|
||||||
|
old_packages, new_packages = by_name(old), by_name(new)
|
||||||
|
if set(old_packages) != set(new_packages):
|
||||||
|
return "adds or removes a package"
|
||||||
|
roots = [
|
||||||
|
name
|
||||||
|
for name, entries in new_packages.items()
|
||||||
|
if any(e.get("source") == ROOT_SOURCE for e in entries)
|
||||||
|
]
|
||||||
|
root = only(roots, "root project")
|
||||||
|
for name in new_packages:
|
||||||
|
if name not in (PACKAGE, root) and old_packages[name] != new_packages[name]:
|
||||||
|
return f"changes the package {name}"
|
||||||
|
old_root, _unused = without_apm_specifier(only(old_packages[root], "root project"))
|
||||||
|
new_root, specifier = without_apm_specifier(
|
||||||
|
only(new_packages[root], "root project")
|
||||||
|
)
|
||||||
|
if old_root != new_root:
|
||||||
|
return "changes the root project beyond its apm-cli specifier"
|
||||||
|
if specifier != f"=={pin}":
|
||||||
|
return f"the root project's {PACKAGE} specifier is not =={pin}"
|
||||||
|
return apm_problem(
|
||||||
|
only(old_packages.get(PACKAGE, []), PACKAGE),
|
||||||
|
only(new_packages.get(PACKAGE, []), PACKAGE),
|
||||||
|
pin,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def lock_problem(old_lock, new_lock, pyproject):
|
||||||
|
"""None when new_lock differs from old_lock only by the apm-cli bump to the pin of
|
||||||
|
pyproject (the new pyproject.toml's text); else a one-line reason."""
|
||||||
|
try:
|
||||||
|
return compare(
|
||||||
|
parse(old_lock, "the old uv.lock"),
|
||||||
|
parse(new_lock, "the new uv.lock"),
|
||||||
|
pinned_version(pyproject),
|
||||||
|
)
|
||||||
|
except Refused as exc:
|
||||||
|
return str(exc)
|
||||||
|
except (AttributeError, TypeError):
|
||||||
|
return "the lock does not have the shape uv writes"
|
||||||
@@ -26,7 +26,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
# The repository is derived from this script's own location (symlinks resolved), never
|
# The repository is derived from this script's own location (symlinks resolved), never
|
||||||
# from the caller's working directory: running it from another repository must not
|
# from the caller's working directory: running it from another repository must not
|
||||||
# create or remove that repository's .venv.
|
# create or remove that repository's .venv-dev.
|
||||||
script="$(readlink -f "${BASH_SOURCE[0]}")"
|
script="$(readlink -f "${BASH_SOURCE[0]}")"
|
||||||
root="$(git -C "$(dirname "$script")/.." rev-parse --show-toplevel)"
|
root="$(git -C "$(dirname "$script")/.." rev-parse --show-toplevel)"
|
||||||
cd "$root"
|
cd "$root"
|
||||||
@@ -122,19 +122,19 @@ if still="$(git -C "$root" config --get core.hooksPath)" && [ -n "$still" ]; the
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# A virtualenv made by an older Python is rebuilt rather than reused.
|
# A virtualenv made by an older Python is rebuilt rather than reused.
|
||||||
if [ -x .venv/bin/python ] && ! .venv/bin/python -c "$py_ok" 2>/dev/null; then
|
if [ -x .venv-dev/bin/python ] && ! .venv-dev/bin/python -c "$py_ok" 2>/dev/null; then
|
||||||
rm -rf "$root/.venv"
|
rm -rf "$root/.venv-dev"
|
||||||
fi
|
fi
|
||||||
[ -x .venv/bin/python ] || "$python" -m venv .venv
|
[ -x .venv-dev/bin/python ] || "$python" -m venv .venv-dev
|
||||||
.venv/bin/pip install --quiet --disable-pip-version-check --require-hashes -r requirements-dev.lock -r requirements-dev.txt
|
.venv-dev/bin/pip install --quiet --disable-pip-version-check --require-hashes -r requirements-dev.lock -r requirements-dev.txt
|
||||||
.venv/bin/pre-commit install --install-hooks
|
.venv-dev/bin/pre-commit install --install-hooks
|
||||||
|
|
||||||
# The collections of requirements.yml, exactly as pinned, into this clone (.ansible/ is ignored by
|
# The collections of requirements.yml, exactly as pinned, into this clone (.ansible/ is ignored by
|
||||||
# git and by the Collection build). ANSIBLE_COLLECTIONS_PATH is set to the target for the install:
|
# git and by the Collection build). ANSIBLE_COLLECTIONS_PATH is set to the target for the install:
|
||||||
# a copy found elsewhere (~/.ansible/collections) would be skipped as already installed.
|
# a copy found elsewhere (~/.ansible/collections) would be skipped as already installed.
|
||||||
collections="$root/.ansible/collections"
|
collections="$root/.ansible/collections"
|
||||||
mkdir -p "$collections"
|
mkdir -p "$collections"
|
||||||
ANSIBLE_COLLECTIONS_PATH="$collections" .venv/bin/ansible-galaxy collection install \
|
ANSIBLE_COLLECTIONS_PATH="$collections" .venv-dev/bin/ansible-galaxy collection install \
|
||||||
-r requirements.yml -p "$collections"
|
-r requirements.yml -p "$collections"
|
||||||
|
|
||||||
marker="# kamino-dev-setup: virtualenv first on PATH"
|
marker="# kamino-dev-setup: virtualenv first on PATH"
|
||||||
@@ -150,7 +150,7 @@ for hook in pre-commit commit-msg pre-push; do
|
|||||||
{
|
{
|
||||||
head -n 1 "$file"
|
head -n 1 "$file"
|
||||||
# %q shell-quotes the path: a repository path with spaces, quotes or $(...) is data.
|
# %q shell-quotes the path: a repository path with spaces, quotes or $(...) is data.
|
||||||
printf '%s\n' "$marker" "export PATH=$(printf '%q' "$root/.venv/bin"):\"\$PATH\""
|
printf '%s\n' "$marker" "export PATH=$(printf '%q' "$root/.venv-dev/bin"):\"\$PATH\""
|
||||||
tail -n +2 "$file"
|
tail -n +2 "$file"
|
||||||
} > "$tmp"
|
} > "$tmp"
|
||||||
cat "$tmp" > "$file" # keeps the file mode of the hook
|
cat "$tmp" > "$file" # keeps the file mode of the hook
|
||||||
@@ -179,4 +179,4 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Done: git commit now runs the hooks with the tools in $root/.venv/bin and the collections in $collections."
|
echo "Done: git commit now runs the hooks with the tools in $root/.venv-dev/bin and the collections in $collections."
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
# Needs the network (PyPI) and the Python of .python-version (python<MINOR>; KAMINO_PYTHON overrides it): the
|
# Needs the network (PyPI) and the Python of .python-version (python<MINOR>; KAMINO_PYTHON overrides it): the
|
||||||
# header of the lock records it, and check_image_versions.py pins fails when it differs.
|
# header of the lock records it, and check_image_versions.py pins fails when it differs.
|
||||||
# pip and pip-tools are installed, at the pinned versions below, into a throwaway virtualenv, never
|
# pip and pip-tools are installed, at the pinned versions below, into a throwaway virtualenv, never
|
||||||
# into the project's .venv. pip is pinned too: pip-tools breaks on newer pip releases (7.5.2 on pip 26). Commit
|
# into the project's .venv-dev. pip is pinned too: pip-tools breaks on newer pip releases (7.5.2 on pip 26). Commit
|
||||||
# the lock with its requirements file; pip refuses an install of the two when they disagree
|
# the lock with its requirements file; pip refuses an install of the two when they disagree
|
||||||
# (`pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt`).
|
# (`pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt`).
|
||||||
# The pins are not hash-checked themselves: they come from PyPI over TLS, like the pip that
|
# The pins are not hash-checked themselves: they come from PyPI over TLS, like the pip that
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ Only a pull request is narrowed, and only when <base-ref> is given and EVENT_NAM
|
|||||||
A role uses another when any file under its directory names it as `mortis.kamino.<other>`
|
A role uses another when any file under its directory names it as `mortis.kamino.<other>`
|
||||||
(an include_role, a scenario's prepare play, a comment). The relation is transitive: when
|
(an include_role, a scenario's prepare play, a comment). The relation is transitive: when
|
||||||
`a` names `b` and `b` names `c`, a change to `c` selects all three. The roles call each other
|
`a` names `b` and `b` names `c`, a change to `c` selects all three. The roles call each other
|
||||||
by that full name only (a test checks includes, imports, play `roles:` entries and meta
|
by that full name only (a test checks includes, imports and play `roles:` entries for a bare
|
||||||
dependencies for a bare or templated role name), so the text search finds every use. It reads the
|
or templated role name, and that no role declares meta dependencies), so the text search finds
|
||||||
|
every use. It reads the
|
||||||
tree under test, not the base: a pull request that drops a use also changes the using role,
|
tree under test, not the base: a pull request that drops a use also changes the using role,
|
||||||
which then selects itself, and a role the pull request deletes or renames still counts as used
|
which then selects itself, and a role the pull request deletes or renames still counts as used
|
||||||
by the roles that name it. A shared file outside roles/<role>/ (a plugin) already selects
|
by the roles that name it. A shared file outside roles/<role>/ (a plugin) already selects
|
||||||
@@ -92,6 +93,8 @@ IGNORED = (
|
|||||||
"ruff.toml",
|
"ruff.toml",
|
||||||
"apm.yml",
|
"apm.yml",
|
||||||
"apm.lock.yaml",
|
"apm.lock.yaml",
|
||||||
|
"pyproject.toml",
|
||||||
|
"uv.lock",
|
||||||
".claude/*",
|
".claude/*",
|
||||||
"tests/sanity/*",
|
"tests/sanity/*",
|
||||||
"tests/scripts/*",
|
"tests/scripts/*",
|
||||||
@@ -105,6 +108,7 @@ IGNORED = (
|
|||||||
".gitea/workflows/renovate.yml",
|
".gitea/workflows/renovate.yml",
|
||||||
".gitea/workflows/gitea-release-key.yml",
|
".gitea/workflows/gitea-release-key.yml",
|
||||||
"scripts/check_bot_pr_diff.py",
|
"scripts/check_bot_pr_diff.py",
|
||||||
|
"scripts/check_uv_lock.py",
|
||||||
"scripts/check_image_versions.py",
|
"scripts/check_image_versions.py",
|
||||||
"scripts/next_image_version.py",
|
"scripts/next_image_version.py",
|
||||||
"scripts/check_tarball.py",
|
"scripts/check_tarball.py",
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# SPDX-FileCopyrightText: Defame1297 and contributors
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
"""The environment for a test's git fixture: no caller GIT_* and no user or system config."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def isolated(**extra):
|
||||||
|
"""A copy of os.environ for git: a hook exports GIT_DIR, which would point it at the real repo."""
|
||||||
|
env = {k: v for k, v in os.environ.items() if not k.startswith("GIT_")}
|
||||||
|
env.update(GIT_CONFIG_GLOBAL="/dev/null", GIT_CONFIG_NOSYSTEM="1", **extra)
|
||||||
|
return env
|
||||||
@@ -13,8 +13,12 @@ from unittest import mock
|
|||||||
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
||||||
sys.path.insert(0, str(SCRIPTS))
|
sys.path.insert(0, str(SCRIPTS))
|
||||||
import check_bot_pr_diff as cbd
|
import check_bot_pr_diff as cbd
|
||||||
|
import git_env
|
||||||
|
from test_check_uv_lock import APM_NEW, APM_OLD, CLICK_OLD, UV_LOCK, uv_files
|
||||||
|
|
||||||
D1, D2 = "sha256:" + "a" * 64, "sha256:" + "b" * 64
|
D1, D2 = "sha256:" + "a" * 64, "sha256:" + "b" * 64
|
||||||
|
RENOVATE_OLD = f" image: renovate/renovate:44.161.0-full@{D1}"
|
||||||
|
RENOVATE_NEW = f" image: renovate/renovate:44.170.2-full@{D2}"
|
||||||
FILES = {
|
FILES = {
|
||||||
"requirements-dev.txt": "# pins\nansible-core==2.19.14\nreuse==6.2.0\n",
|
"requirements-dev.txt": "# pins\nansible-core==2.19.14\nreuse==6.2.0\n",
|
||||||
"requirements.yml": "---\ncollections:\n - name: community.general\n version: 14.0.0\n",
|
"requirements.yml": "---\ncollections:\n - name: community.general\n version: 14.0.0\n",
|
||||||
@@ -27,9 +31,17 @@ FILES = {
|
|||||||
" container:\n image: ${{ matrix.job_image }}\n"
|
" container:\n image: ${{ matrix.job_image }}\n"
|
||||||
" steps:\n - run: echo ok\n"
|
" steps:\n - run: echo ok\n"
|
||||||
),
|
),
|
||||||
".gitea/workflows/lint.yml": f"container:\n image: git.rkdr.net/mortis/ci:0.2.0@{D1}\nrun: echo a\n",
|
".gitea/workflows/lint.yml": (
|
||||||
|
f"container:\n image: git.rkdr.net/mortis/ci:0.2.0@{D1}\nrun: echo a\n"
|
||||||
|
f"jobs:\n renovate-config:\n container:\n{RENOVATE_OLD}\n"
|
||||||
|
),
|
||||||
|
".gitea/workflows/renovate.yml": (
|
||||||
|
f"jobs:\n renovate:\n container:\n{RENOVATE_OLD}\n"
|
||||||
|
" steps:\n - env:\n LOG_LEVEL: info\n run: renovate\n"
|
||||||
|
),
|
||||||
".gitea/workflows/molecule.yml": f"env:\n MOLECULE_IMAGE: >-\n git.rkdr.net/mortis/mol:0.1.0@{D1}\n",
|
".gitea/workflows/molecule.yml": f"env:\n MOLECULE_IMAGE: >-\n git.rkdr.net/mortis/mol:0.1.0@{D1}\n",
|
||||||
"renovate.json": "{}\n",
|
"renovate.json": "{}\n",
|
||||||
|
"pyproject.toml": '[project]\nrequires-python = ">=3.11"\n\n[dependency-groups]\ndev = ["apm-cli==0.39.3"]\n',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -40,15 +52,12 @@ def run(cwd, *cmd):
|
|||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
env={
|
env=git_env.isolated(),
|
||||||
**os.environ,
|
|
||||||
"GIT_CONFIG_GLOBAL": "/dev/null",
|
|
||||||
"GIT_CONFIG_SYSTEM": "/dev/null",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
H1, H2 = "a" * 64, "b" * 64
|
H1, H2 = "a" * 64, "b" * 64
|
||||||
|
FILES["uv.lock"] = UV_LOCK
|
||||||
|
|
||||||
|
|
||||||
class LockRuleTest(unittest.TestCase):
|
class LockRuleTest(unittest.TestCase):
|
||||||
@@ -113,6 +122,69 @@ class LockRuleTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class PyprojectRuleTest(unittest.TestCase):
|
||||||
|
def test_an_apm_cli_bump_is_allowed(self):
|
||||||
|
self.assertIsNone(
|
||||||
|
cbd.file_problem(
|
||||||
|
"pyproject.toml",
|
||||||
|
['dev = ["apm-cli==0.39.3"]'],
|
||||||
|
['dev = ["apm-cli==0.39.4"]'],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_a_new_dependency_is_refused(self):
|
||||||
|
old = 'dev = ["apm-cli==0.39.3"]'
|
||||||
|
for new in (
|
||||||
|
'dev = ["apm-cli==0.39.4", "evil==1.0"]',
|
||||||
|
'dev = ["evil==0.39.4"]',
|
||||||
|
'dev = ["apm-cli==0.39.4"]\nprod = ["evil==1.0"]',
|
||||||
|
):
|
||||||
|
with self.subTest(new=new):
|
||||||
|
self.assertIsNotNone(
|
||||||
|
cbd.file_problem("pyproject.toml", [old], new.split("\n"))
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_a_pinned_name_keeps_its_spelling(self):
|
||||||
|
self.assertIsNotNone(
|
||||||
|
cbd.file_problem(
|
||||||
|
"pyproject.toml",
|
||||||
|
['dev = ["apm-cli==0.39.3"]'],
|
||||||
|
['dev = ["APM-CLI==0.39.4"]'],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_an_edit_to_another_setting_is_refused(self):
|
||||||
|
for old, new in (
|
||||||
|
('requires-python = ">=3.11"', 'requires-python = ">=3.12"'),
|
||||||
|
("package = false", "package = true"),
|
||||||
|
(
|
||||||
|
'dev = ["apm-cli==0.39.3"]',
|
||||||
|
'dev = ["apm-cli @ https://evil.example/apm.tgz"]',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'dev = ["apm-cli==0.39.3"]',
|
||||||
|
'dev = ["apm-cli==0.39.4"] # index-url = "https://evil/simple"',
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with self.subTest(new=new):
|
||||||
|
self.assertIsNotNone(cbd.file_problem("pyproject.toml", [old], [new]))
|
||||||
|
|
||||||
|
|
||||||
|
class UvLockTest(unittest.TestCase):
|
||||||
|
def test_uv_lock_is_refused_without_both_sides_to_parse(self):
|
||||||
|
entries = [
|
||||||
|
("100644", "100644", "M", "pyproject.toml"),
|
||||||
|
("100644", "100644", "M", "uv.lock"),
|
||||||
|
]
|
||||||
|
patches = {
|
||||||
|
"pyproject.toml": '@@ -1 +1 @@\n-dev = ["apm-cli==0.39.3"]\n+dev = ["apm-cli==0.39.4"]\n',
|
||||||
|
"uv.lock": "@@ -1 +1 @@\n-revision = 3\n+revision = 5\n",
|
||||||
|
}
|
||||||
|
problems = cbd.check(entries, patches.get)
|
||||||
|
self.assertEqual(len(problems), 1, problems)
|
||||||
|
self.assertTrue(problems[0].startswith("uv.lock: "), problems)
|
||||||
|
|
||||||
|
|
||||||
class RuleTest(unittest.TestCase):
|
class RuleTest(unittest.TestCase):
|
||||||
def problem(self, path, old, new):
|
def problem(self, path, old, new):
|
||||||
return cbd.file_problem(path, [old], [new])
|
return cbd.file_problem(path, [old], [new])
|
||||||
@@ -162,6 +234,8 @@ class RuleTest(unittest.TestCase):
|
|||||||
f" image: git.rkdr.net/mortis/ci:0.2.0@{D1}",
|
f" image: git.rkdr.net/mortis/ci:0.2.0@{D1}",
|
||||||
f" image: git.rkdr.net/mortis/ci:0.2.1@{D2}",
|
f" image: git.rkdr.net/mortis/ci:0.2.1@{D2}",
|
||||||
),
|
),
|
||||||
|
(".gitea/workflows/renovate.yml", RENOVATE_OLD, RENOVATE_NEW),
|
||||||
|
(".gitea/workflows/lint.yml", RENOVATE_OLD, RENOVATE_NEW),
|
||||||
]
|
]
|
||||||
for path, old, new in cases:
|
for path, old, new in cases:
|
||||||
self.assertIsNone(self.problem(path, old, new), (path, old, new))
|
self.assertIsNone(self.problem(path, old, new), (path, old, new))
|
||||||
@@ -245,11 +319,55 @@ class RuleTest(unittest.TestCase):
|
|||||||
f" image: git.rkdr.net/defame1297/ci:0.2.0@{D1}",
|
f" image: git.rkdr.net/defame1297/ci:0.2.0@{D1}",
|
||||||
),
|
),
|
||||||
("renovate.json", "{}", '{"a": 1}'),
|
("renovate.json", "{}", '{"a": 1}'),
|
||||||
|
(
|
||||||
|
".gitea/workflows/renovate.yml",
|
||||||
|
" run: renovate",
|
||||||
|
" run: evil",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
".gitea/workflows/renovate.yml",
|
||||||
|
" LOG_LEVEL: info",
|
||||||
|
" LOG_LEVEL: debug",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
".gitea/workflows/renovate.yml",
|
||||||
|
f" image: git.rkdr.net/mortis/ci:0.2.0@{D1}",
|
||||||
|
f" image: git.rkdr.net/mortis/ci:0.2.1@{D2}",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
".gitea/workflows/lint.yml",
|
||||||
|
f" image: git.rkdr.net/mortis/ci:0.2.0@{D1}",
|
||||||
|
RENOVATE_NEW,
|
||||||
|
),
|
||||||
("roles/x/tasks/main.yml", "a", "b"),
|
("roles/x/tasks/main.yml", "a", "b"),
|
||||||
]
|
]
|
||||||
for path, old, new in cases:
|
for path, old, new in cases:
|
||||||
self.assertIsNotNone(self.problem(path, old, new), (path, old, new))
|
self.assertIsNotNone(self.problem(path, old, new), (path, old, new))
|
||||||
|
|
||||||
|
def test_the_renovate_image_pins_are_the_same(self):
|
||||||
|
# Lint validates renovate.json in the image renovate.yml runs; one bot PR moves both copies.
|
||||||
|
pins = []
|
||||||
|
for name in ("renovate.yml", "lint.yml"):
|
||||||
|
text = (SCRIPTS.parent / ".gitea/workflows" / name).read_text()
|
||||||
|
lines = [line for line in text.splitlines() if "renovate/renovate:" in line]
|
||||||
|
self.assertEqual(len(lines), 1, (name, lines))
|
||||||
|
self.assertIsNotNone(cbd.RENOVATE_LINE.match(lines[0]), (name, lines[0]))
|
||||||
|
pins.append(lines[0].strip())
|
||||||
|
self.assertEqual(pins[0], pins[1])
|
||||||
|
|
||||||
|
def test_the_renovate_image_keeps_its_name_flavour_and_digest(self):
|
||||||
|
for path in (".gitea/workflows/renovate.yml", ".gitea/workflows/lint.yml"):
|
||||||
|
for new in (
|
||||||
|
RENOVATE_NEW.replace("renovate/renovate", "evil/renovate"),
|
||||||
|
RENOVATE_NEW.replace("-full@", "@"),
|
||||||
|
RENOVATE_NEW.replace("-full@", "-slim@"),
|
||||||
|
RENOVATE_NEW.replace(f"@{D2}", ""),
|
||||||
|
RENOVATE_NEW.replace("44.170.2", "latest"),
|
||||||
|
RENOVATE_NEW + " # evil",
|
||||||
|
RENOVATE_NEW.replace(" image:", " image:"),
|
||||||
|
):
|
||||||
|
self.assertIsNotNone(self.problem(path, RENOVATE_OLD, new), (path, new))
|
||||||
|
|
||||||
def test_job_image_lines_cannot_be_added_removed_or_moved(self):
|
def test_job_image_lines_cannot_be_added_removed_or_moved(self):
|
||||||
path = ".gitea/workflows/image.yml"
|
path = ".gitea/workflows/image.yml"
|
||||||
line = f" job_image: ubuntu:24.04@{D1}"
|
line = f" job_image: ubuntu:24.04@{D1}"
|
||||||
@@ -354,6 +472,10 @@ class RuleTest(unittest.TestCase):
|
|||||||
|
|
||||||
class RepoTest(unittest.TestCase):
|
class RepoTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
# The gate runs git in-process, in the fixture's directory.
|
||||||
|
patcher = mock.patch.dict(os.environ, git_env.isolated(), clear=True)
|
||||||
|
patcher.start()
|
||||||
|
self.addCleanup(patcher.stop)
|
||||||
self.tmp = tempfile.TemporaryDirectory()
|
self.tmp = tempfile.TemporaryDirectory()
|
||||||
self.repo = pathlib.Path(self.tmp.name)
|
self.repo = pathlib.Path(self.tmp.name)
|
||||||
self.addCleanup(self.tmp.cleanup)
|
self.addCleanup(self.tmp.cleanup)
|
||||||
@@ -458,7 +580,7 @@ class RepoTest(unittest.TestCase):
|
|||||||
def test_empty_head_ref_on_a_pull_request_fails_closed(self):
|
def test_empty_head_ref_on_a_pull_request_fails_closed(self):
|
||||||
self.write("roles/x/main.yml", "a\n")
|
self.write("roles/x/main.yml", "a\n")
|
||||||
self.commit("anything")
|
self.commit("anything")
|
||||||
env = {**os.environ, "EVENT_NAME": "pull_request"}
|
env = git_env.isolated(EVENT_NAME="pull_request")
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
[sys.executable, str(SCRIPTS / "check_bot_pr_diff.py"), "", "main"],
|
[sys.executable, str(SCRIPTS / "check_bot_pr_diff.py"), "", "main"],
|
||||||
cwd=self.repo,
|
cwd=self.repo,
|
||||||
@@ -499,6 +621,142 @@ class RepoTest(unittest.TestCase):
|
|||||||
self.assertEqual(code, 0, err)
|
self.assertEqual(code, 0, err)
|
||||||
self.assertIn("5 file(s)", out)
|
self.assertIn("5 file(s)", out)
|
||||||
|
|
||||||
|
def test_a_renovate_self_bump_passes(self):
|
||||||
|
self.edit(".gitea/workflows/renovate.yml", RENOVATE_OLD, RENOVATE_NEW)
|
||||||
|
self.edit(".gitea/workflows/lint.yml", RENOVATE_OLD, RENOVATE_NEW)
|
||||||
|
self.commit("bot")
|
||||||
|
code, out, err = self.gate()
|
||||||
|
self.assertEqual(code, 0, err)
|
||||||
|
self.assertIn("2 file(s)", out)
|
||||||
|
|
||||||
|
def test_an_added_renovate_image_line_is_refused(self):
|
||||||
|
for path in (".gitea/workflows/renovate.yml", ".gitea/workflows/lint.yml"):
|
||||||
|
self.assertIsNotNone(cbd.file_problem(path, [], [RENOVATE_NEW]), path)
|
||||||
|
self.assertIsNotNone(
|
||||||
|
cbd.file_problem(path, [RENOVATE_OLD], [RENOVATE_NEW, RENOVATE_NEW]),
|
||||||
|
path,
|
||||||
|
)
|
||||||
|
|
||||||
|
def assert_moved_line_refused(self, path, anchor):
|
||||||
|
self.edit(path, f"{RENOVATE_OLD}\n", "")
|
||||||
|
self.edit(path, anchor, f"{anchor}{RENOVATE_NEW}\n")
|
||||||
|
self.commit("bot")
|
||||||
|
code, _unused, err = self.gate()
|
||||||
|
self.assertEqual(code, 1, err)
|
||||||
|
self.assertIn(path, err)
|
||||||
|
self.assertIn("moves or deletes a line", err)
|
||||||
|
|
||||||
|
def test_a_moved_renovate_image_line_is_refused(self):
|
||||||
|
self.assert_moved_line_refused(
|
||||||
|
".gitea/workflows/renovate.yml", " run: renovate\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_a_moved_image_line_in_lint_yml_is_refused(self):
|
||||||
|
self.assert_moved_line_refused(".gitea/workflows/lint.yml", "run: echo a\n")
|
||||||
|
|
||||||
|
def bump_apm_cli(self):
|
||||||
|
"""The change Renovate makes for apm-cli 0.39.4, as uv 0.13.1 writes it."""
|
||||||
|
self.edit("pyproject.toml", "apm-cli==0.39.3", "apm-cli==0.39.4")
|
||||||
|
self.edit("uv.lock", 'version = "0.39.3"', 'version = "0.39.4"')
|
||||||
|
self.edit("uv.lock", '"==0.39.3"', '"==0.39.4"')
|
||||||
|
self.edit("uv.lock", "apm_cli-0.39.3", "apm_cli-0.39.4")
|
||||||
|
self.edit("uv.lock", APM_OLD, APM_NEW)
|
||||||
|
|
||||||
|
def assert_lock_refused(self):
|
||||||
|
self.commit("bot")
|
||||||
|
code, _unused, err = self.gate()
|
||||||
|
self.assertEqual(code, 1, err)
|
||||||
|
self.assertIn("uv.lock", err)
|
||||||
|
|
||||||
|
def test_an_apm_cli_bump_with_its_lock_passes(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
self.commit("bot")
|
||||||
|
code, out, err = self.gate()
|
||||||
|
self.assertEqual(code, 0, err)
|
||||||
|
self.assertIn("2 file(s)", out)
|
||||||
|
|
||||||
|
def test_another_packages_file_under_the_apm_cli_entry_is_refused(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
lock = (self.repo / "uv.lock").read_text()
|
||||||
|
start = lock.index('version = "0.39.4"')
|
||||||
|
end = lock.index("[[package]]", start)
|
||||||
|
six = (
|
||||||
|
'version = "1.17.0"\nsource = { registry = "https://pypi.org/simple" }\n'
|
||||||
|
'dependencies = [\n { name = "click" },\n { name = "watchdog" },\n]\n'
|
||||||
|
'wheels = [\n { url = "https://files.pythonhosted.org/packages/b7/ce/'
|
||||||
|
'149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", '
|
||||||
|
'hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", '
|
||||||
|
'size = 11050, upload-time = "2024-12-04T17:35:26.475Z" },\n]\n\n'
|
||||||
|
)
|
||||||
|
self.write("uv.lock", lock[:start] + six + lock[end:])
|
||||||
|
self.assert_lock_refused()
|
||||||
|
|
||||||
|
def test_a_new_package_is_refused(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
self.edit(
|
||||||
|
"uv.lock",
|
||||||
|
'dev = [\n { name = "apm-cli" },\n]',
|
||||||
|
'dev = [\n { name = "apm-cli" },\n { name = "six" },\n]',
|
||||||
|
)
|
||||||
|
self.write(
|
||||||
|
"uv.lock",
|
||||||
|
(self.repo / "uv.lock").read_text()
|
||||||
|
+ '\n[[package]]\nname = "six"\nversion = "1.17.0"\n'
|
||||||
|
'source = { registry = "https://pypi.org/simple" }\n'
|
||||||
|
+ uv_files("six", "1.17.0", H2),
|
||||||
|
)
|
||||||
|
self.assert_lock_refused()
|
||||||
|
|
||||||
|
def test_a_marker_that_drops_a_dependency_is_refused(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
self.edit(
|
||||||
|
"uv.lock",
|
||||||
|
' { name = "watchdog" },',
|
||||||
|
' { name = "watchdog", marker = "sys_platform == \'never\'" },',
|
||||||
|
)
|
||||||
|
self.assert_lock_refused()
|
||||||
|
|
||||||
|
def test_a_downgraded_transitive_package_is_refused(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
self.edit("uv.lock", 'version = "8.5.1"', 'version = "8.5.0"')
|
||||||
|
self.edit("uv.lock", "click-8.5.1", "click-8.5.0")
|
||||||
|
self.edit("uv.lock", CLICK_OLD, H2)
|
||||||
|
self.assert_lock_refused()
|
||||||
|
|
||||||
|
def test_a_pyproject_change_without_its_lock_is_refused(self):
|
||||||
|
self.edit("pyproject.toml", "apm-cli==0.39.3", "apm-cli==0.39.4")
|
||||||
|
self.commit("bot")
|
||||||
|
code, _unused, err = self.gate()
|
||||||
|
self.assertEqual(code, 1, err)
|
||||||
|
self.assertIn("pyproject.toml", err)
|
||||||
|
|
||||||
|
def test_an_apm_cli_lock_change_without_pyproject_is_refused(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
self.edit("pyproject.toml", "apm-cli==0.39.4", "apm-cli==0.39.3")
|
||||||
|
self.assert_lock_refused()
|
||||||
|
|
||||||
|
def test_a_changed_apm_cli_source_is_refused(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
lock = (self.repo / "uv.lock").read_text()
|
||||||
|
start = lock.index('name = "apm-cli"')
|
||||||
|
self.write(
|
||||||
|
"uv.lock",
|
||||||
|
lock[:start]
|
||||||
|
+ lock[start:].replace(
|
||||||
|
"https://pypi.org/simple", "https://evil.example/simple", 1
|
||||||
|
),
|
||||||
|
)
|
||||||
|
self.assert_lock_refused()
|
||||||
|
|
||||||
|
def test_a_changed_apm_cli_download_host_is_refused(self):
|
||||||
|
self.bump_apm_cli()
|
||||||
|
self.edit(
|
||||||
|
"uv.lock",
|
||||||
|
"https://files.pythonhosted.org/packages/ab/cd/apm_cli-0.39.4-py3",
|
||||||
|
"https://files.evil.example/packages/ab/cd/apm_cli-0.39.4-py3",
|
||||||
|
)
|
||||||
|
self.assert_lock_refused()
|
||||||
|
|
||||||
def test_each_violation_gets_one_line(self):
|
def test_each_violation_gets_one_line(self):
|
||||||
self.edit(".gitea/workflows/lint.yml", "echo a", "echo b")
|
self.edit(".gitea/workflows/lint.yml", "echo a", "echo b")
|
||||||
self.write("roles/x/main.yml", "a\n")
|
self.write("roles/x/main.yml", "a\n")
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
"""Run with: python3 -m unittest discover -s tests/scripts"""
|
"""Run with: python3 -m unittest discover -s tests/scripts"""
|
||||||
|
|
||||||
import os
|
|
||||||
import pathlib
|
import pathlib
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -12,6 +11,7 @@ import unittest
|
|||||||
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
||||||
sys.path.insert(0, str(SCRIPTS))
|
sys.path.insert(0, str(SCRIPTS))
|
||||||
import check_image_versions as civ
|
import check_image_versions as civ
|
||||||
|
import git_env
|
||||||
|
|
||||||
DIGEST = "sha256:" + "a" * 64
|
DIGEST = "sha256:" + "a" * 64
|
||||||
JOB = f"ubuntu:24.04@{DIGEST}"
|
JOB = f"ubuntu:24.04@{DIGEST}"
|
||||||
@@ -67,11 +67,7 @@ def run(cwd, *cmd):
|
|||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
env={
|
env=git_env.isolated(),
|
||||||
**os.environ,
|
|
||||||
"GIT_CONFIG_GLOBAL": "/dev/null",
|
|
||||||
"GIT_CONFIG_SYSTEM": "/dev/null",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import git_env
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
REPO = pathlib.Path(__file__).resolve().parents[2]
|
REPO = pathlib.Path(__file__).resolve().parents[2]
|
||||||
@@ -44,7 +45,11 @@ class CheckScenariosLoadCheckoutTest(unittest.TestCase):
|
|||||||
self.checkout = collection(self.ac_root)
|
self.checkout = collection(self.ac_root)
|
||||||
(self.checkout / "scripts").mkdir()
|
(self.checkout / "scripts").mkdir()
|
||||||
# molecule's CLI finds the base config from the repository root, as in the real checkout
|
# molecule's CLI finds the base config from the repository root, as in the real checkout
|
||||||
subprocess.run(["git", "init", "-q", str(self.checkout)], check=True)
|
subprocess.run(
|
||||||
|
["git", "init", "-q", str(self.checkout)],
|
||||||
|
check=True,
|
||||||
|
env=git_env.isolated(),
|
||||||
|
)
|
||||||
self.base_config = self.checkout / ".config" / "molecule" / "config.yml"
|
self.base_config = self.checkout / ".config" / "molecule" / "config.yml"
|
||||||
self.base_config.parent.mkdir(parents=True)
|
self.base_config.parent.mkdir(parents=True)
|
||||||
self.base_config.write_text("prerun: false\n")
|
self.base_config.write_text("prerun: false\n")
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ class CraftedTarballTest(unittest.TestCase):
|
|||||||
REPO,
|
REPO,
|
||||||
src,
|
src,
|
||||||
ignore=shutil.ignore_patterns(
|
ignore=shutil.ignore_patterns(
|
||||||
".git", ".venv", "__pycache__", "output", "*.tar.gz"
|
".git", ".venv", ".venv-dev", "__pycache__", "output", "*.tar.gz"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
out = pathlib.Path(self.tmp.name) / "dist"
|
out = pathlib.Path(self.tmp.name) / "dist"
|
||||||
|
|||||||
@@ -0,0 +1,321 @@
|
|||||||
|
# SPDX-FileCopyrightText: Defame1297 and contributors
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
"""Run with: python3 -m unittest discover -s tests/scripts"""
|
||||||
|
|
||||||
|
import pathlib
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
||||||
|
sys.path.insert(0, str(SCRIPTS))
|
||||||
|
import check_uv_lock as cul
|
||||||
|
|
||||||
|
APM_OLD, APM_NEW, CLICK_OLD, OTHER = "c" * 64, "d" * 64, "e" * 64, "f" * 64
|
||||||
|
PYPI_FILES = "https://files.pythonhosted.org/packages/ab/cd/"
|
||||||
|
|
||||||
|
|
||||||
|
def uv_files(dist, version, digest):
|
||||||
|
return (
|
||||||
|
f'sdist = {{ url = "{PYPI_FILES}{dist}-{version}.tar.gz", hash = "sha256:{digest}", '
|
||||||
|
f'size = 3132901, upload-time = "2026-12-01T18:11:22.037Z" }}\n'
|
||||||
|
f'wheels = [\n {{ url = "{PYPI_FILES}{dist}-{version}-py3-none-any.whl", '
|
||||||
|
f'hash = "sha256:{digest}", size = 3536708, upload-time = "2026-12-01T18:11:19.761Z" }},\n]\n'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# A uv.lock as uv 0.13.1 writes it: apm-cli, two of its dependencies and the root project.
|
||||||
|
UV_LOCK = (
|
||||||
|
'version = 1\nrevision = 5\nrequires-python = ">=3.11"\n\n'
|
||||||
|
'[[package]]\nname = "apm-cli"\nversion = "0.39.3"\n'
|
||||||
|
'source = { registry = "https://pypi.org/simple" }\n'
|
||||||
|
'dependencies = [\n { name = "click" },\n { name = "watchdog" },\n]\n'
|
||||||
|
+ uv_files("apm_cli", "0.39.3", APM_OLD)
|
||||||
|
+ '\n[[package]]\nname = "click"\nversion = "8.5.1"\n'
|
||||||
|
'source = { registry = "https://pypi.org/simple" }\n'
|
||||||
|
+ uv_files("click", "8.5.1", CLICK_OLD)
|
||||||
|
+ '\n[[package]]\nname = "kamino"\nversion = "0"\nsource = { virtual = "." }\n\n'
|
||||||
|
'[package.dev-dependencies]\ndev = [\n { name = "apm-cli" },\n]\n\n'
|
||||||
|
"[package.metadata]\n\n[package.metadata.requires-dev]\n"
|
||||||
|
'dev = [{ name = "apm-cli", specifier = "==0.39.3" }]\n'
|
||||||
|
'\n[[package]]\nname = "watchdog"\nversion = "7.1.1"\n'
|
||||||
|
'source = { registry = "https://pypi.org/simple" }\n'
|
||||||
|
+ uv_files("watchdog", "7.1.1", OTHER)
|
||||||
|
)
|
||||||
|
PYPROJECT = (
|
||||||
|
'[project]\nname = "kamino"\n\n[dependency-groups]\ndev = ["apm-cli==VERSION"]\n'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def bumped(lock=UV_LOCK):
|
||||||
|
"""The lock after Renovate's apm-cli 0.39.4 bump."""
|
||||||
|
return (
|
||||||
|
lock.replace('version = "0.39.3"', 'version = "0.39.4"')
|
||||||
|
.replace('"==0.39.3"', '"==0.39.4"')
|
||||||
|
.replace("apm_cli-0.39.3", "apm_cli-0.39.4")
|
||||||
|
.replace(APM_OLD, APM_NEW)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def problem(new, pin="0.39.4", old=UV_LOCK):
|
||||||
|
return cul.lock_problem(old, new, PYPROJECT.replace("VERSION", pin))
|
||||||
|
|
||||||
|
|
||||||
|
class AllowedTest(unittest.TestCase):
|
||||||
|
def test_an_apm_cli_bump_is_allowed(self):
|
||||||
|
self.assertIsNone(problem(bumped()))
|
||||||
|
|
||||||
|
def test_a_new_lock_revision_is_allowed(self):
|
||||||
|
old = UV_LOCK.replace("revision = 5", "revision = 3")
|
||||||
|
self.assertIsNone(problem(bumped(), old=old))
|
||||||
|
|
||||||
|
def test_a_package_without_an_sdist_is_allowed(self):
|
||||||
|
start = UV_LOCK.index("sdist = { url")
|
||||||
|
old = UV_LOCK[:start] + UV_LOCK[UV_LOCK.index("wheels = [", start) :]
|
||||||
|
self.assertIsNone(problem(bumped(old), old=old))
|
||||||
|
|
||||||
|
|
||||||
|
class RefusedTest(unittest.TestCase):
|
||||||
|
def assert_refused(self, new, **kwargs):
|
||||||
|
self.assertIsNotNone(problem(new, **kwargs))
|
||||||
|
|
||||||
|
def test_a_lock_that_is_not_toml_is_refused(self):
|
||||||
|
self.assert_refused(bumped() + "[[package\n")
|
||||||
|
|
||||||
|
def test_a_lock_of_another_shape_is_refused(self):
|
||||||
|
top = 'version = 1\nrevision = 5\nrequires-python = ">=3.11"\n'
|
||||||
|
for package in ('package = ["x"]\n', "package = 1\n"):
|
||||||
|
with self.subTest(package=package):
|
||||||
|
self.assertEqual(
|
||||||
|
problem(top + package), "the lock does not have the shape uv writes"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_the_lock_version_must_be_the_pin(self):
|
||||||
|
self.assert_refused(bumped(), pin="0.39.5")
|
||||||
|
self.assert_refused(
|
||||||
|
bumped().replace('version = "0.39.4"', 'version = "0.39.5"')
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_the_dev_specifier_must_be_the_pin(self):
|
||||||
|
self.assert_refused(bumped().replace('"==0.39.4"', '"==0.39.3"'))
|
||||||
|
self.assert_refused(bumped().replace('"==0.39.4"', '">=0.39.4"'))
|
||||||
|
|
||||||
|
def test_a_pyproject_without_one_apm_cli_pin_is_refused(self):
|
||||||
|
for pyproject in (
|
||||||
|
'[dependency-groups]\ndev = ["apm-cli>=0.39.4"]\n',
|
||||||
|
'[dependency-groups]\ndev = ["apm-cli==0.39.4", "apm-cli==0.39.5"]\n',
|
||||||
|
"[dependency-groups]\ndev = [\n",
|
||||||
|
):
|
||||||
|
with self.subTest(pyproject=pyproject):
|
||||||
|
self.assertIsNotNone(cul.lock_problem(UV_LOCK, bumped(), pyproject))
|
||||||
|
|
||||||
|
def test_another_top_level_setting_is_refused(self):
|
||||||
|
for old, new in (
|
||||||
|
('requires-python = ">=3.11"', 'requires-python = ">=3.12"'),
|
||||||
|
("version = 1\n", "version = 2\n"),
|
||||||
|
("revision = 5", 'revision = "5"'),
|
||||||
|
(
|
||||||
|
"revision = 5",
|
||||||
|
'revision = 5\n[options]\nexclude-newer = "2026-01-01T00:00:00Z"',
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with self.subTest(new=new):
|
||||||
|
self.assert_refused(bumped().replace(old, new, 1))
|
||||||
|
|
||||||
|
def test_an_apm_cli_dependency_change_is_refused(self):
|
||||||
|
for new in (
|
||||||
|
' { name = "click" },\n { name = "watchdog" },\n { name = "six" },\n',
|
||||||
|
' { name = "click" },\n',
|
||||||
|
' { name = "click", marker = "sys_platform == \'never\'" },\n { name = "watchdog" },\n',
|
||||||
|
' { name = "click", extra = ["evil"] },\n { name = "watchdog" },\n',
|
||||||
|
):
|
||||||
|
with self.subTest(new=new):
|
||||||
|
self.assert_refused(
|
||||||
|
bumped().replace(
|
||||||
|
' { name = "click" },\n { name = "watchdog" },\n', new, 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_a_changed_apm_cli_source_is_refused(self):
|
||||||
|
lock = bumped()
|
||||||
|
start = lock.index('name = "apm-cli"')
|
||||||
|
for source in (
|
||||||
|
'source = { registry = "https://evil.example/simple" }',
|
||||||
|
'source = { git = "https://evil.example/apm.git?rev=main#0123abc" }',
|
||||||
|
'source = { url = "https://evil.example/apm_cli-0.39.4.tar.gz" }',
|
||||||
|
):
|
||||||
|
with self.subTest(source=source):
|
||||||
|
self.assert_refused(
|
||||||
|
lock[:start]
|
||||||
|
+ lock[start:].replace(
|
||||||
|
'source = { registry = "https://pypi.org/simple" }', source, 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_a_file_that_is_not_the_pinned_apm_cli_from_pypi_is_refused(self):
|
||||||
|
wheel = f"{PYPI_FILES}apm_cli-0.39.4-py3-none-any.whl"
|
||||||
|
for old, new in (
|
||||||
|
(wheel, wheel.replace("files.pythonhosted.org", "files.evil.example")),
|
||||||
|
(wheel, wheel.replace("https://", "http://")),
|
||||||
|
(
|
||||||
|
wheel,
|
||||||
|
wheel.replace(
|
||||||
|
"files.pythonhosted.org", "files.pythonhosted.org.evil.example"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(wheel, wheel.replace("/packages/", "/other/")),
|
||||||
|
(wheel, wheel + "?x=/packages/apm_cli-0.39.4-py3-none-any.whl"),
|
||||||
|
(wheel, wheel.replace("apm_cli-0.39.4", "six-1.17.0")),
|
||||||
|
(wheel, wheel.replace("apm_cli-0.39.4", "apm_cli-0.39.3")),
|
||||||
|
(wheel, wheel.replace("apm_cli-0.39.4", "apm_cli-0.39.40")),
|
||||||
|
(wheel, wheel.replace(".whl", ".exe")),
|
||||||
|
(f"sha256:{APM_NEW}", "md5:" + "d" * 32),
|
||||||
|
(f"sha256:{APM_NEW}", "sha256:" + "d" * 63),
|
||||||
|
(f"sha256:{APM_NEW}", "sha256:" + "D" * 64),
|
||||||
|
):
|
||||||
|
with self.subTest(new=new):
|
||||||
|
self.assert_refused(bumped().replace(old, new))
|
||||||
|
|
||||||
|
def test_a_file_with_another_key_is_refused(self):
|
||||||
|
wheel = f'{{ url = "{PYPI_FILES}apm_cli-0.39.4-py3-none-any.whl", '
|
||||||
|
self.assert_refused(
|
||||||
|
bumped().replace(wheel, wheel + 'path = "../evil.whl", ', 1)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_an_apm_cli_without_files_is_refused(self):
|
||||||
|
lock = bumped()
|
||||||
|
start = lock.index("sdist = { url", lock.index('name = "apm-cli"'))
|
||||||
|
end = lock.index("]\n", start) + 2
|
||||||
|
self.assert_refused(lock[:start] + lock[end:])
|
||||||
|
|
||||||
|
def test_a_change_to_another_package_is_refused(self):
|
||||||
|
for old, new in (
|
||||||
|
('version = "8.5.1"', 'version = "8.5.0"'),
|
||||||
|
(CLICK_OLD, OTHER),
|
||||||
|
(
|
||||||
|
'name = "watchdog"\n',
|
||||||
|
'name = "watchdog"\ndependencies = [{ name = "click" }]\n',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'version = "0"\nsource = { virtual = "." }',
|
||||||
|
'version = "1"\nsource = { virtual = "." }',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'dev = [\n { name = "apm-cli" },\n]',
|
||||||
|
'dev = [\n { name = "apm-cli" },\n { name = "click" },\n]',
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with self.subTest(new=new):
|
||||||
|
self.assert_refused(bumped().replace(old, new, 1))
|
||||||
|
|
||||||
|
def test_an_added_or_removed_package_is_refused(self):
|
||||||
|
six = (
|
||||||
|
'\n[[package]]\nname = "six"\nversion = "1.17.0"\n'
|
||||||
|
'source = { registry = "https://pypi.org/simple" }\n'
|
||||||
|
+ uv_files("six", "1.17.0", OTHER)
|
||||||
|
)
|
||||||
|
self.assert_refused(bumped() + six)
|
||||||
|
watchdog = bumped().index('\n[[package]]\nname = "watchdog"')
|
||||||
|
self.assert_refused(bumped()[:watchdog])
|
||||||
|
|
||||||
|
def test_a_second_apm_cli_or_root_entry_is_refused(self):
|
||||||
|
apm = bumped()
|
||||||
|
start = apm.index('[[package]]\nname = "apm-cli"')
|
||||||
|
end = apm.index("[[package]]", start + 1)
|
||||||
|
self.assert_refused(apm + "\n" + apm[start:end])
|
||||||
|
root = apm.index('[[package]]\nname = "kamino"')
|
||||||
|
self.assert_refused(
|
||||||
|
apm
|
||||||
|
+ '\n[[package]]\nname = "other"\nversion = "0"\nsource = { virtual = "." }\n',
|
||||||
|
old=UV_LOCK
|
||||||
|
+ '\n[[package]]\nname = "other"\nversion = "0"\nsource = { virtual = "." }\n',
|
||||||
|
)
|
||||||
|
self.assertGreater(root, 0)
|
||||||
|
|
||||||
|
|
||||||
|
def moved(lock, old, new):
|
||||||
|
"""lock with apm-cli moved from version old to new."""
|
||||||
|
return (
|
||||||
|
lock.replace(f'version = "{old}"', f'version = "{new}"')
|
||||||
|
.replace(f'"=={old}"', f'"=={new}"')
|
||||||
|
.replace(f"apm_cli-{old}", f"apm_cli-{new}")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def without_apm_wheels(lock):
|
||||||
|
start = lock.index("wheels = [", lock.index('name = "apm-cli"'))
|
||||||
|
return lock[:start] + lock[lock.index("]\n", start) + 2 :]
|
||||||
|
|
||||||
|
|
||||||
|
class FileKindsAndOrderTest(unittest.TestCase):
|
||||||
|
def test_dropped_wheels_without_a_version_change_are_refused(self):
|
||||||
|
new = without_apm_wheels(UV_LOCK).replace("size = 3132901", "size = 3132902", 1)
|
||||||
|
self.assertIsNotNone(problem(new, pin="0.39.3"))
|
||||||
|
|
||||||
|
def test_a_downgrade_is_refused(self):
|
||||||
|
self.assertIsNotNone(problem(UV_LOCK, pin="0.39.3", old=bumped()))
|
||||||
|
|
||||||
|
def test_the_version_must_rise(self):
|
||||||
|
self.assertIsNotNone(problem(UV_LOCK.replace(APM_OLD, APM_NEW), pin="0.39.3"))
|
||||||
|
|
||||||
|
def test_versions_are_compared_as_numbers(self):
|
||||||
|
old = moved(UV_LOCK, "0.39.3", "0.39.9")
|
||||||
|
self.assertIsNone(
|
||||||
|
problem(moved(old, "0.39.9", "0.39.10"), pin="0.39.10", old=old)
|
||||||
|
)
|
||||||
|
old = moved(UV_LOCK, "0.39.3", "0.9.0")
|
||||||
|
self.assertIsNone(problem(moved(old, "0.9.0", "0.10.0"), pin="0.10.0", old=old))
|
||||||
|
old = moved(UV_LOCK, "0.39.3", "0.40.0")
|
||||||
|
self.assertIsNotNone(
|
||||||
|
problem(moved(old, "0.40.0", "0.39.10"), pin="0.39.10", old=old)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_a_version_that_is_not_a_plain_release_is_refused(self):
|
||||||
|
for version in (
|
||||||
|
"0.40.0rc1",
|
||||||
|
"0.40.0.post1",
|
||||||
|
"0.40.0.dev1",
|
||||||
|
"1!0.1.0",
|
||||||
|
"0.40.0+local",
|
||||||
|
):
|
||||||
|
with self.subTest(version=version):
|
||||||
|
self.assertIsNotNone(
|
||||||
|
problem(moved(UV_LOCK, "0.39.3", version), pin=version)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_the_kinds_of_file_stay_the_same(self):
|
||||||
|
self.assertIsNotNone(problem(without_apm_wheels(bumped())))
|
||||||
|
start = bumped().index("sdist = { url", bumped().index('name = "apm-cli"'))
|
||||||
|
no_sdist = bumped()[:start] + bumped()[bumped().index("wheels = [", start) :]
|
||||||
|
self.assertIsNotNone(problem(no_sdist))
|
||||||
|
old_no_sdist = (
|
||||||
|
UV_LOCK[: UV_LOCK.index("sdist = { url")]
|
||||||
|
+ UV_LOCK[UV_LOCK.index("wheels = [") :]
|
||||||
|
)
|
||||||
|
self.assertIsNotNone(problem(bumped(), old=old_no_sdist))
|
||||||
|
self.assertIsNone(problem(no_sdist, old=old_no_sdist))
|
||||||
|
for tag in ("cp311-cp311-manylinux_2_17_x86_64", "py2.py3-none-any"):
|
||||||
|
with self.subTest(tag=tag):
|
||||||
|
self.assertIsNotNone(
|
||||||
|
problem(bumped().replace("0.39.4-py3-none-any", f"0.39.4-{tag}"))
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_a_path_that_leaves_packages_is_refused(self):
|
||||||
|
wheel = f"{PYPI_FILES}apm_cli-0.39.4-py3-none-any.whl"
|
||||||
|
for path in (
|
||||||
|
"/packages/../../simple/x/",
|
||||||
|
"/packages/ab/./cd/",
|
||||||
|
"/packages//ab/",
|
||||||
|
"/packages/%2e%2e/%2e%2e/simple/x/",
|
||||||
|
"/packages/ab/cd%2F/",
|
||||||
|
):
|
||||||
|
with self.subTest(path=path):
|
||||||
|
bad = (
|
||||||
|
"https://files.pythonhosted.org"
|
||||||
|
+ path
|
||||||
|
+ "apm_cli-0.39.4-py3-none-any.whl"
|
||||||
|
)
|
||||||
|
self.assertIsNotNone(problem(bumped().replace(wheel, bad)))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
@@ -192,7 +192,7 @@ class DevSetupTest(unittest.TestCase):
|
|||||||
proc = self.run_setup(repo, KAMINO_PYTHON=str(wrong))
|
proc = self.run_setup(repo, KAMINO_PYTHON=str(wrong))
|
||||||
self.assertNotEqual(proc.returncode, 0)
|
self.assertNotEqual(proc.returncode, 0)
|
||||||
self.assertIn("is not Python 3.13 (.python-version)", proc.stderr)
|
self.assertIn("is not Python 3.13 (.python-version)", proc.stderr)
|
||||||
self.assertFalse((repo / ".venv").exists())
|
self.assertFalse((repo / ".venv-dev").exists())
|
||||||
|
|
||||||
def test_an_interpreter_of_another_minor_is_refused_and_the_pinned_one_accepted(
|
def test_an_interpreter_of_another_minor_is_refused_and_the_pinned_one_accepted(
|
||||||
self,
|
self,
|
||||||
@@ -201,10 +201,10 @@ class DevSetupTest(unittest.TestCase):
|
|||||||
proc = self.run_setup(repo, STUB_PY_MINOR="3.12")
|
proc = self.run_setup(repo, STUB_PY_MINOR="3.12")
|
||||||
self.assertNotEqual(proc.returncode, 0)
|
self.assertNotEqual(proc.returncode, 0)
|
||||||
self.assertIn("is not Python 3.13 (.python-version)", proc.stderr)
|
self.assertIn("is not Python 3.13 (.python-version)", proc.stderr)
|
||||||
self.assertFalse((repo / ".venv").exists())
|
self.assertFalse((repo / ".venv-dev").exists())
|
||||||
proc = self.run_setup(repo, STUB_PY_MINOR="3.13")
|
proc = self.run_setup(repo, STUB_PY_MINOR="3.13")
|
||||||
self.assertEqual(proc.returncode, 0, proc.stderr)
|
self.assertEqual(proc.returncode, 0, proc.stderr)
|
||||||
self.assertTrue((repo / ".venv").is_dir())
|
self.assertTrue((repo / ".venv-dev").is_dir())
|
||||||
|
|
||||||
def test_a_missing_pin_file_is_refused_with_a_message(self) -> None:
|
def test_a_missing_pin_file_is_refused_with_a_message(self) -> None:
|
||||||
repo = self.make_repo()
|
repo = self.make_repo()
|
||||||
@@ -228,6 +228,30 @@ class DevSetupTest(unittest.TestCase):
|
|||||||
text = self.hook(repo, name).read_text()
|
text = self.hook(repo, name).read_text()
|
||||||
self.assertIn("# kamino-dev-setup: virtualenv first on PATH", text)
|
self.assertIn("# kamino-dev-setup: virtualenv first on PATH", text)
|
||||||
self.assertEqual(self.hooks_z(repo), b"")
|
self.assertEqual(self.hooks_z(repo), b"")
|
||||||
|
self.assertFalse((repo / ".venv").exists())
|
||||||
|
|
||||||
|
def test_a_rerun_moves_the_hooks_of_an_older_setup_to_venv_dev(self) -> None:
|
||||||
|
repo = self.make_repo()
|
||||||
|
kept = repo / ".venv" / "kept"
|
||||||
|
kept.parent.mkdir()
|
||||||
|
kept.write_text("")
|
||||||
|
names = ("pre-commit", "commit-msg", "pre-push")
|
||||||
|
for name in names:
|
||||||
|
hook = self.hook(repo, name)
|
||||||
|
hook.parent.mkdir(exist_ok=True)
|
||||||
|
hook.write_text(
|
||||||
|
"#!/usr/bin/env bash\n"
|
||||||
|
"# kamino-dev-setup: virtualenv first on PATH\n"
|
||||||
|
f'export PATH={repo}/.venv/bin:"$PATH"\n'
|
||||||
|
)
|
||||||
|
hook.chmod(0o755)
|
||||||
|
result = self.run_setup(repo)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
for name in names:
|
||||||
|
text = self.hook(repo, name).read_text()
|
||||||
|
self.assertIn(f'export PATH={repo}/.venv-dev/bin:"$PATH"\n', text)
|
||||||
|
self.assertNotIn("/.venv/bin", text)
|
||||||
|
self.assertTrue(kept.exists())
|
||||||
|
|
||||||
def test_a_missing_tea_warns_and_setup_succeeds(self) -> None:
|
def test_a_missing_tea_warns_and_setup_succeeds(self) -> None:
|
||||||
repo = self.make_repo()
|
repo = self.make_repo()
|
||||||
@@ -403,12 +427,12 @@ class DevSetupTest(unittest.TestCase):
|
|||||||
self.git(other, "init", "--quiet")
|
self.git(other, "init", "--quiet")
|
||||||
result = self.run_setup(repo, cwd=other)
|
result = self.run_setup(repo, cwd=other)
|
||||||
self.assertEqual(result.returncode, 0, result.stderr)
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
self.assertFalse((other / ".venv").exists())
|
self.assertFalse((other / ".venv-dev").exists())
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
os.listdir(other / ".git" / "hooks"),
|
os.listdir(other / ".git" / "hooks"),
|
||||||
[n for n in os.listdir(other / ".git" / "hooks") if n.endswith(".sample")],
|
[n for n in os.listdir(other / ".git" / "hooks") if n.endswith(".sample")],
|
||||||
)
|
)
|
||||||
self.assertTrue((repo / ".venv").is_dir())
|
self.assertTrue((repo / ".venv-dev").is_dir())
|
||||||
self.assertTrue(self.hook(repo).exists())
|
self.assertTrue(self.hook(repo).exists())
|
||||||
|
|
||||||
def test_crafted_repository_path_is_not_executed(self) -> None:
|
def test_crafted_repository_path_is_not_executed(self) -> None:
|
||||||
@@ -428,7 +452,7 @@ class DevSetupTest(unittest.TestCase):
|
|||||||
self.assertEqual(hook.returncode, 0, hook.stderr)
|
self.assertEqual(hook.returncode, 0, hook.stderr)
|
||||||
lines = hook.stdout.splitlines()
|
lines = hook.stdout.splitlines()
|
||||||
self.assertEqual(lines[0], "hook-ran")
|
self.assertEqual(lines[0], "hook-ran")
|
||||||
self.assertTrue(lines[1].startswith(f"{repo}/.venv/bin:"), lines[1])
|
self.assertTrue(lines[1].startswith(f"{repo}/.venv-dev/bin:"), lines[1])
|
||||||
for place in (workdir, repo, self.tmp, Path.cwd()):
|
for place in (workdir, repo, self.tmp, Path.cwd()):
|
||||||
self.assertFalse((place / "PWNED").exists(), place)
|
self.assertFalse((place / "PWNED").exists(), place)
|
||||||
self.assertFalse((place / "PWNED2").exists(), place)
|
self.assertFalse((place / "PWNED2").exists(), place)
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ import contextlib
|
|||||||
import http.server
|
import http.server
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
||||||
sys.path.insert(0, str(SCRIPTS))
|
sys.path.insert(0, str(SCRIPTS))
|
||||||
@@ -156,6 +158,12 @@ class QuietServer(http.server.HTTPServer):
|
|||||||
|
|
||||||
class RegistryClient(unittest.TestCase):
|
class RegistryClient(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
# Lint exports a dead proxy with an empty no_proxy; the fake registry is on loopback.
|
||||||
|
patcher = mock.patch.dict(
|
||||||
|
os.environ, no_proxy="127.0.0.1", NO_PROXY="127.0.0.1"
|
||||||
|
)
|
||||||
|
patcher.start()
|
||||||
|
self.addCleanup(patcher.stop)
|
||||||
FakeRegistry.refuse = FakeRegistry.refuse_token = FakeRegistry.no_realm = False
|
FakeRegistry.refuse = FakeRegistry.refuse_token = FakeRegistry.no_realm = False
|
||||||
FakeRegistry.empty_token = FakeRegistry.unknown = False
|
FakeRegistry.empty_token = FakeRegistry.unknown = False
|
||||||
FakeRegistry.not_found = None
|
FakeRegistry.not_found = None
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import yaml
|
|||||||
|
|
||||||
REPO = pathlib.Path(__file__).resolve().parents[2]
|
REPO = pathlib.Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO / "scripts"))
|
sys.path.insert(0, str(REPO / "scripts"))
|
||||||
|
import git_env
|
||||||
import select_molecule_scenarios as sel
|
import select_molecule_scenarios as sel
|
||||||
|
|
||||||
ROLE_KEYS = {
|
ROLE_KEYS = {
|
||||||
@@ -217,6 +218,16 @@ class SelectTest(unittest.TestCase):
|
|||||||
chosen, _reason = self.select(["requirements-dev.txt", "requirements-dev.lock"])
|
chosen, _reason = self.select(["requirements-dev.txt", "requirements-dev.lock"])
|
||||||
self.assertEqual(chosen, [])
|
self.assertEqual(chosen, [])
|
||||||
|
|
||||||
|
def test_the_apm_pin_selects_nothing(self):
|
||||||
|
chosen, _reason = self.select(["pyproject.toml", "uv.lock"])
|
||||||
|
self.assertEqual(chosen, [])
|
||||||
|
|
||||||
|
def test_the_bot_diff_check_selects_nothing(self):
|
||||||
|
chosen, _reason = self.select(
|
||||||
|
["scripts/check_bot_pr_diff.py", "scripts/check_uv_lock.py"]
|
||||||
|
)
|
||||||
|
self.assertEqual(chosen, [])
|
||||||
|
|
||||||
def test_molecule_requirements_select_everything(self):
|
def test_molecule_requirements_select_everything(self):
|
||||||
# An ansible-core or molecule bump there changes the tools every scenario runs with.
|
# An ansible-core or molecule bump there changes the tools every scenario runs with.
|
||||||
for path in ("requirements-molecule.txt", "requirements-molecule.lock"):
|
for path in ("requirements-molecule.txt", "requirements-molecule.lock"):
|
||||||
@@ -399,9 +410,6 @@ class MainTest(unittest.TestCase):
|
|||||||
(d / "molecule.yml").write_text("---\n")
|
(d / "molecule.yml").write_text("---\n")
|
||||||
|
|
||||||
def git(self, root, *args):
|
def git(self, root, *args):
|
||||||
# No GIT_* from the caller (a hook exports GIT_DIR), no user or system config.
|
|
||||||
env = {k: v for k, v in os.environ.items() if not k.startswith("GIT_")}
|
|
||||||
env.update(GIT_CONFIG_GLOBAL="/dev/null", GIT_CONFIG_NOSYSTEM="1")
|
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[
|
[
|
||||||
"git",
|
"git",
|
||||||
@@ -417,7 +425,7 @@ class MainTest(unittest.TestCase):
|
|||||||
],
|
],
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
env=env,
|
env=git_env.isolated(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def topic_repo(self, root, files):
|
def topic_repo(self, root, files):
|
||||||
|
|||||||
Reference in new issue
Block a user