Skip to content

feat(k8s): run the environment checks in homelab CI #5296

Done

Description

@dan-petty

Problem or Motivation

The homelab environment moves to the private repository dan-petty/homelab (tracker #5120, phase 2). Tests and CI jobs in devops-cli check the environment files: for example test_k8s_argocd_apps.py, the manifest part of test_k8s_manifests.py, the environment alert and dashboard tests and the cloudflared checks. #5131 lists each check that moves. #5134 step 6 (plan step 17) deletes the environment files and these checks from devops-cli. No step brings the checks to homelab before the delete. homelab has only .github/workflows/lint.yml (make lint) and no Python test harness. Some invariants also fail on the copy: test_k8s_argocd_apps.py:155 asserts that prune is true, and lines 163-175 assert that each source is devops-cli main.

Proposed Solution & Architectural Design

Step 16 of the corrected plan on #5120. The work is in dan-petty/homelab. This item is a sub-issue of #5120, because the tracker holds the order.

  1. Bring the environment checks that the refactor(k8s): read the environment tree from the infra repo #5131 list moves to homelab CI.
  2. Choose one of two ways in the plan of this item:
  3. Change the invariants for the copy. Prune is false until feat(argocd): read the environment from the homelab repo #5134 step 5a (plan step 13) and true after it. Each git source names homelab, except Application devops (devops-cli k8s/devops on main) and the product ref of Application prometheus (devops-cli main).
  4. Use path filters on each homelab workflow, so that no workflow runs at each devops-cli release (owner decision on Actions minutes). Renovate makes the version bumps.
  5. Make each test fixture from the devops-cli history only, never from homelab, because homelab holds the real hosts after plan step 14.

Check.

Rollback. git revert in homelab.

Downtime. None.

Order and dependencies. Plan step 16. It needs dan-petty/homelab#23 (the copy, plan step 9) and the #5131 list of moved checks. It must land before #5134 step 6 (plan step 17). A person merges.

Owner decision (2026-11-13). homelab is the development environment. It keeps the branch and pull request conventions and gets a .pre-commit-config.yaml with the pre-commit-hooks hook no-commit-to-branch (branch main). It gets no branch protection, no ruleset, no required check and no other gate that blocks or delays work. The step 16 environment checks are advisory: they report on each pull request and never block a merge or an apply.

Target Subsystem

Kubernetes & Minikube Automation

Existing Tool Considered

pytest, kustomize, kube-linter, promtool and the devops commands already cover the checks. The work is to run them on the homelab tree. Cost: about 2M tokens to build, 0.2M a quarter to keep, 4 hours.

Source: #5120

Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: pytest (https://pypi.org/project/pytest), MIT, last activity 2026-10-27, maintained.
Reason: Searches found no tool that moves these project-specific checks. pytest, already used by the repository, runs and reports them as tests, but the homelab workflow, path filters, check logic and invariant values stay custom work.

Covers:

  • Runs the moved environment checks as one test suite
  • Builds each fixture tree from the devops-cli history only
  • Reports each test result on a pull request

Lacks:

  • Homelab CI workflow with path filters on each check
  • The check logic itself: kustomize, kube-linter, promtool, cloudflared image
  • Invariant values of the copy, such as prune and git source
  • Advisory reporting that blocks no merge or apply

Proposed design

Problem statement

dan-petty/devops-cli moves its homelab environment files to the private repository dan-petty/homelab, and #5134 step 6 deletes the environment checks that stay behind. The checks that move already run in homelab CI: the homelab k8s.yml workflow runs scripts/k8s-checks.py under paths filters, and the person who refused the earlier plan reports that homelab pull request #39 delivered the checks and later homelab pull requests updated them. This item adds no check code to devops-cli; it records the delivery in Step 16 of docs/HOMELAB_REPO_SWITCH.md, which #5134 step 6 waits on, so a reader can run the check of the step.

Acceptance criteria

Requirement: Step 16 names where homelab CI runs the checks

The Step 16 section of docs/HOMELAB_REPO_SWITCH.md SHALL name the homelab workflow .github/workflows/k8s.yml, the script scripts/k8s-checks.py and the live check of the workflow.

Scenario: The step names the workflow and the script

  • WHEN git grep -n 'scripts/k8s-checks.py' -- docs/HOMELAB_REPO_SWITCH.md runs
  • THEN the command prints the Step 16 line that names .github/workflows/k8s.yml and scripts/k8s-checks.py.

Requirement: Homelab CI runs the moved checks on a pull request

The homelab workflow .github/workflows/k8s.yml MUST run the environment checks on a pull request that changes an environment path and report each result.

Scenario: The newest k8s workflow run of a pull request

  • WHEN gh run list --repo dan-petty/homelab --workflow k8s.yml --limit 1 --json event,conclusion runs after a homelab pull request that changes k8s/llm/valkey.yaml
  • THEN the command prints one run whose event is pull_request and whose conclusion is success.

Requirement: No homelab check is required

The homelab repository MUST NOT hold a branch protection, a ruleset or a required check that blocks a merge or an apply.

Scenario: The protection of main

  • WHEN uv run devops gh api repos/dan-petty/homelab/branches/main/protection runs
  • THEN the command exits 1 with the message Branch not protected, so no check is required.

Requirement: devops-cli keeps the environment paths frozen until step 17

The k8s row of devops ci SHALL keep the environment_freeze check until #5134 step 6 deletes it.

Scenario: A branch that changes an environment file

  • WHEN uv run devops ci test tests/invariants/test_environment_freeze_check.py runs
  • THEN the suite passes, and its case for a diff that holds k8s/llm/valkey.yaml gives exit 1 with a finding that names the path and dan-petty/homelab.

Existing Tool Considered

The alternatives check gives pytest (https://pypi.org/project/pytest) the verdict in-use: MIT, maintained, last activity 2026-10-27, and the repository already runs it. The block in the alternatives check states what pytest lacks, and this item adds no harness and no check code to devops-cli, because homelab runs its own scripts/k8s-checks.py. The own code that homelab keeps instead of a tool that covers it carries the cost of the issue: about 2M tokens to build, 0.2M a quarter to keep and 4 hours.

Key questions

  • Where does the work of this item live, and what does it add to devops-cli?: The checks live in dan-petty/homelab: its k8s.yml workflow runs scripts/k8s-checks.py under paths filters, and the stage return reports that homelab pull request feat(devcontainer): automate PR devcontainer cleanup on PR merge in GHCR #39 delivered the checks and later homelab pull requests updated them. devops-cli adds no check code; its one change is the Step 16 record in docs/HOMELAB_REPO_SWITCH.md, because Step 17 starts only when Step 16 is merged and the check of Step 16 names no command. [sources: openspec/changes/archive/2026-11-22-5408-pr-ready-no-workflow/proposal.md:30, docs/HOMELAB_REPO_SWITCH.md:264, docs/HOMELAB_REPO_SWITCH.md:282]
  • Which environment checks does the refactor(k8s): read the environment tree from the infra repo #5131 list move?: The k8s row of devops ci with its tests/gate/k8s_checks modules (the Argo CD Applications check included), the manifest part of the k8s manifests test, the environment alert and dashboard tests, the cloudflared Deployment check, and the k8s managers of .github/renovate.json. The product base k8s/devops and its checks stay. [sources: openspec/changes/archive/2026-11-13-5131-environment-root-from-the-infra-repo/proposal.md:31, tests/gate/k8s.py:7]
  • Which way does the item take: a pytest project in dan-petty/homelab or generic environment checks as devops product commands?: Neither. Homelab runs its own scripts/k8s-checks.py from its k8s.yml workflow, and the person who refused the earlier plan reports the work complete there and not buildable in devops-cli. This item adds no second harness and no product command. (best practice) [sources: openspec/changes/archive/2026-11-22-5408-pr-ready-no-workflow/proposal.md:30, docs/HOMELAB_REPO_SWITCH.md:264]
    • Rejected: A pytest project in dan-petty/homelab. homelab already runs its own script and holds no Python test harness, so a second harness would duplicate the checks and drift.
    • Rejected: Product commands of devops that resolve the environment tree. the person who refused the earlier plan returned that design, because the work belongs in homelab and is complete there.
    • Chosen: Homelab's own scripts/k8s-checks.py. the homelab k8s.yml workflow already runs this script under paths filters, so this item adds no check code.
  • What does the owner decision of 2026-11-13 require of dan-petty/homelab?: homelab is the development environment. It keeps the branch and pull request conventions and gets .pre-commit-config.yaml with the pre-commit-hooks hook no-commit-to-branch on main. It gets no branch protection, no ruleset and no required check; the Step 16 checks are advisory, report on each pull request and block no merge and no apply. (best practice) [sources: docs/HOMELAB_REPO_SWITCH.md:268, .pre-commit-config.yaml:8, docs/adr/0012-releases-are-derived-by-release-please-from-trunk-and-milestones-are-planning-buckets.md:222]
    • Chosen: Advisory checks with no required check. the owner decision of 2026-11-13 names the Step 16 checks as advisory, and the runbook says they never block a merge or an apply.
    • Rejected: Required checks and a ruleset. the owner decision refuses each gate that blocks or delays work in homelab.
  • Which change does devops-cli keep for Step 16 now that homelab CI runs the checks?: docs/HOMELAB_REPO_SWITCH.md Step 16 names the homelab workflow .github/workflows/k8s.yml, the script scripts/k8s-checks.py and the live check gh run list --repo dan-petty/homelab --workflow k8s.yml, so a reader can run the check that Step 17 waits on. (best practice) [sources: docs/HOMELAB_REPO_SWITCH.md:264, docs/HOMELAB_REPO_SWITCH.md:270, docs/HOMELAB_REPO_SWITCH.md:282, openspec/changes/archive/2026-11-22-5408-pr-ready-no-workflow/proposal.md:30]
    • Chosen: Record the homelab workflow, script and live check in Step 16. Step 17 starts only when Step 16 is merged, and the check of Step 16 names no command, so the record is the one devops-cli change that makes the precondition verifiable.
    • Rejected: Close the item with no devops-cli change. the stage job opens a pull request in devops-cli, so an item with no change has nothing to deliver.
    • Rejected: Add the checks as devops product commands. the person who refused the earlier plan returned that design; the checks are delivered in homelab.
  • What does devops-cli do with its environment paths now?: The k8s row of devops ci holds environment_freeze, which refuses a branch that changes an environment path until feat(argocd): read the environment from the homelab repo #5134 step 6 deletes it, and its test checks the pathspec without starting git. [sources: tests/gate/k8s.py:7, docs/HOMELAB_REPO_SWITCH.md:184, tests/invariants/test_environment_freeze_check.py:47]
  • What do homelab#80, feat(ai): dynamic package introspection and multi-source docs ingestion engine #82 and fix(review): remediate session 20260909-122649 findings and enhance feedback self-improvement review loop #87 require of the checks?: The item names them as homelab-side requirements: accept https://github.com/dan-petty/infra at a v tag as a git source, resolve a values template of infra ($infra refs) with SourceTrees.value_file, and build Kustomize remote bases and components at ?ref= tags. devops-cli already does the last two for its own readers: SourceTrees.value_file resolves $<ref>/<path> and the deploy builds a remote base or component at the revision of its source. No source in this run reads the homelab issue text, so the homelab side stays unverified here. [sources: src/devops_cli/k8s/app_sources.py:127, k8s/README.md:25]
  • Should a person close feat(k8s): run the environment checks in homelab CI #5296 as delivered?: Yes, once the Step 16 record merges: homelab CI runs the moved checks and reports them as advisory, and feat(argocd): read the environment from the homelab repo #5134 step 6 owns the deletion of the devops-cli environment files and checks. A person merges the record and closes the item. (a person decides)

Open questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#6175, #6176

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found pytest plus dedicated Kubernetes manifest/rule validators (kube-linter, kubeconform, promtool), and the issue's own "Existing Tool Considered" already names pytest, kustomize, kube-linter, promtool and the devops commands as tools that cover the checks. pytest covers the test harness that runs the moved environment checks, but no single tool covers the homelab-specific CI workflow, the path filters and the changed invariants (prune flag, git source refs), so the coverage is only partial.

    The repository already uses this tool.

    Tool: pytest (https://pypi.org/project/pytest)

    • License: MIT
    • Last activity: 2026-10-27
    • Maintained: yes

    Covers:

    • pytest is the Python test harness in which the moved environment checks (ArgoCD apps, k8s manifests, alerts/dashboards, cloudflared) are written and run.
    • It runs and reports on each check in CI, so the checks can report on every pull request.
    • The issue itself states that pytest (with kustomize, kube-linter and promtool) already covers the checks, so no new check tool is needed.

    Lacks:

    • It does not provide the homelab CI workflow, path filters or advisory (non-blocking) reporting.
    • It does not supply the individual check logic: kustomize builds, kube-linter lints manifests and promtool validates alert/dashboard rules.
    • It does not change the invariants for the homelab copy (prune false/true, each git source naming homelab, the devops and prometheus exceptions).
    • It does not keep fixtures derived only from devops-cli history rather than the live homelab tree.

    Tools considered:

    Searches run:

    • tool to run Kubernetes manifest and ArgoCD application checks in CI, results: 5
    • pytest project testing kubernetes manifests and helm, results: 5
    • kube-linter kubernetes manifest linting open source, results: 5
    • kubeconform kubernetes manifest validation, results: 5
    • conftest rego kubernetes manifest policy testing, results: 5
    • kube-linter, results: 5
    • pytest-dev pytest test framework github, results: 5

    Sources:

    Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.

  6. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  7. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 73743a2 (see proposed design in issue body).

    Moved to new items: #6175, #6176.

  8. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    The environment checks in homelab CI must accept https://github.com/dan-petty/infra at a v tag as a git source, and must render Applications that read a values template of infra ($infra refs, resolved by SourceTrees.value_file) and Kustomize remote bases and components at ?ref= tags (dan-petty/homelab#80, dan-petty/homelab#82, dan-petty/homelab#87). Service Applications are generated in the cluster by the services ApplicationSet, so the checks see no service repository source. dan-petty/homelab#78 moves the plain manifest checks (kubeconform, kube-linter, Trivy) to the infra reusable workflow; keep the devops-cli checks of this item beside it.

  9. added
    owner/agent
    on Nov 24, 2026
  10. dan-petty commented on Nov 24, 2026

    @dan-petty
    OwnerAuthor

    This item cannot be built in devops-cli. The issue states that the work is in dan-petty/homelab. dan-petty/homelab#39 already implemented the environment checks in scripts/k8s-checks.py, the Makefile, and .github/workflows/k8s.yml on 2026-11-13. Subsequent pull requests dan-petty/homelab#78 and dan-petty/homelab#166 updated these checks for shared infra workflows and infra sources. devops-cli freezes environment paths under environment_freeze.py and holds no homelab CI workflow. Returning item because the work belongs in homelab and is already complete there.

  11. added
    status/new
    and removed
    status/ready
    owner/agent
    on Nov 24, 2026
  12. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  13. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Step 16 is dan-petty/homelab#244: homelab CI now also builds each path source of the Argo CD Applications (devops k8s lint). Its other validators already ran there.

    Scope decision, for the owner to accept with that merge: the k8s gate checks that assert a value of a manifest are not ported. The owner ordered the removal of such checks on 2026-11-25 (#7231), and step 17 deletes them with the environment files. This replaces the first line of the check of this item ("each check that the #5131 list moves").

    After the merge of dan-petty/homelab#244, close this item.

  14. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Done with dan-petty/homelab#244 (merged, main green). The scope decision of the comment above stands: no value check was ported.

  15. removed
    status/new
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/k8ssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions