Skip to content

feat(repos): onboard a repository in one command - #6806

Merged
dan-petty merged 5 commits into
mainfrom
feat/6773-repos-onboard
Nov 22, 2026
Merged

dan-petty merged 5 commits into
mainfrom
feat/6773-repos-onboard

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

devops repos onboard <owner>/<name> onboards a repository in one command (ADR 0035) and replaces devops roadmap onboard. Rows 0 to 15 each read with GET, compare with the baseline, and write only the differences through one route table. --plan reads only, --dry-run sends nothing, --confirm writes, and --all --plan checks each repository of service.repos. The baseline is the Copier template of github.template_repository at --template-ref, _commit of .copier-answers.yml or the latest release. A route-ownership test holds each write to its owner, and each GraphQL route names its mutations. Row 11 merges the template pull request only at the head that its checks ran on. The release key comes by reference and reaches no output. The output ends with the person steps. New settings: github.template_repository, github.release_app_client_id, github.release_app_private_key. The how-to is docs/repos/onboard.md.

Closes #6773

Change: openspec/changes/archive/2026-11-22-6773-repos-onboard/

@dan-petty dan-petty added type/feature Type feature: a new function scope/repos The devops repos commands and worktrees labels Nov 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Builder notes for the owner review. These points are not part of the squash commit.

Deviations from the design of #6773

  1. Row 7 sends no PUT. It reads GET /repos/<repo>/installation with the JWT of each App whose ID and key the configuration holds (service.github_app, renovate). On a miss it prints the person step. Reason: the owner rule of 2026-11-21 says that every GitHub App of the account is installed on all dan-petty repositories, with no per-repository install step. Also, GET /user/installations with the token of gh answers HTTP 403 ("You must authenticate with an access token authorized to a GitHub App", run of 2026-11-22), so the person token cannot list installations.
  2. Row 11 can merge at once. GitHub refuses enablePullRequestAutoMerge when the pull request has nothing to wait for (merge state CLEAN, HAS_HOOKS or UNSTABLE). In that state the command sends mergePullRequest with the squash method and expectedHeadOid of the head that the checks ran on, as gh pr merge --auto does. ADR 0035 section 4 says "turns on auto-merge". I did not edit the accepted record. Please decide if this needs an amendment.
  3. Row 14 opens no homelab pull request. The services entry holds values of the service (namespaces, path) that the command cannot know, so --service prints the person step with the link to docs/service-repos.md of infra.
  4. The template pull request adds only the files that the repository lacks. A template file that the repository holds with other text stays, and the output lists it under "Kept". After the first render, Renovate's copier manager brings each new tag. On dan-petty/infra, the plan keeps 9 files, such as .pre-commit-config.yaml and AGENTS.md.
  5. Copier is a program, not a Python dependency. copier 9.19.1 requires jinja2-ansible-filters, whose PyPI license is GPL3, and the template uses its filter regex_search. CONTRIBUTING.md refuses a strong-copyleft dependency. So copier must be on PATH. Without it, the baseline rows read not readable and name the program.
  6. The read of --plan includes the clone of the template. copier copy clones the public template over git smart HTTP, which sends a POST to git-upload-pack. It is a read and writes nothing.
  7. Flags. --language of the design is not built: the template has no language question. --release-flow/--no-release-flow is added for the template question release_flow. With no flag, a repository that can have environments gets the release flow (D2).
  8. Row 10 waits while the checks of the template pull request have not passed, so the ruleset requires only the checks that reported (D3).
  9. Row 15 starts the ingestion pass only when the index is not current, so a confirmed run on an onboarded repository writes no point.
  10. --template-ref takes a tag or a commit. Copier refuses a branch name (git worktree add fails with "invalid reference").

Person steps

  • Add the copier program to the development tools image (dan-petty/devtools). Until then, devops repos onboard cannot render the baseline on a host without it.
  • Merge and release dan-petty/infra pull request feat(k8s): cluster default-deny NetworkPolicies for monitoring and argocd namespaces #40. Until a release holds copier.yml, the default template ref (the latest release, v0.2.0 now) renders no template, and a run needs --template-ref <commit>.
  • Store the release App once: devops config set github.release_app_client_id <id> and devops config set github.release_app_private_key --from-file <key.pem>.
  • Run devops repos onboard <owner>/<name> --confirm for each repository (never run by the agent).
  • Review the diff in tuicr (tuicr -r origin/main..HEAD).

Read path proof (GET only)

  • devops repos onboard dan-petty/infra --plan --template-ref d47429ddd43839293899915f4dd709cea268e36b (the head of infra feat(k8s): cluster default-deny NetworkPolicies for monitoring and argocd namespaces #40), with copier 9.19.1 on PATH: row 2 pending (merge methods, squash title and body, update branch), row 3 pending (vulnerability alerts, immutable releases), row 4 not available (404), row 6 present, row 7 present (devops-cli-service, dan-petty-renovate), row 8 present, row 9 pending (4 missing files), row 10 present, and 9 kept files.
  • devops repos onboard dan-petty/devtools --dry-run printed the reads and the 33 write routes, and sent no request.
  • Not proven here: the writes against real GitHub (--confirm is a person step), and the live answer shapes of immutable-releases and code-quality/setup, which follow the GitHub documents and the design.

@dan-petty
dan-petty force-pushed the feat/6773-repos-onboard branch from 0cd12f7 to d20029d Compare November 22, 2026 23:10
@devops-cli-service

Copy link
Copy Markdown
Contributor

Pull request #6806 has merge conflicts with main at commit d20029d97109. GitHub cannot merge it. Rebase the branch onto the current main, resolve the conflicts and push the branch.

@dan-petty
dan-petty marked this pull request as ready for review November 22, 2026 23:18
- Commit docs/repos/onboard.md: the root rule /repos/ of .gitignore no longer
  ignores docs/repos/, and the docs site nav lists the page.
- Row 11 uses the head that the checks ran on. A head that moved makes the
  row waiting, and the next run checks the new head.
- A GraphQL route names its mutations. The writer refuses a document with
  another top field (graphql-core parses it).
- For a repository that does not exist, row 0 checks the token scopes
  before row 1 creates it.
- A private repository on the Free plan gets no release flow, also with
  --release-flow (D2).
- Row 2 sends a commit title with its commit message, as GitHub requires.
- A missing copier program gives a person step with its install.
- The dry run lists the reads of .github/labels.yml and of the parent
  commit.
- Rename the owner RAG_PASS to RAG_INGEST, and update the config tests for
  the release App settings.
@dan-petty
dan-petty enabled auto-merge (squash) November 22, 2026 23:20
@dan-petty
dan-petty force-pushed the feat/6773-repos-onboard branch from d20029d to 70c56d2 Compare November 22, 2026 23:23
@dan-petty
dan-petty merged commit 0197537 into main Nov 22, 2026
30 checks passed
@dan-petty
dan-petty deleted the feat/6773-repos-onboard branch November 22, 2026 23:29
dan-petty pushed a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.196.0](v0.195.4...v0.196.0)
(2026-11-22)


### Features

* **repos:** onboard a repository in one command
([#6806](#6806))
([0197537](0197537)),
closes [#6773](#6773)
* **roadmap:** Run several implement Jobs on disjoint files
([#6807](#6807))
([0ce63b3](0ce63b3))
* **roadmap:** the Service removes the labels of a closed issue
([#6802](#6802))
([f3a1e9a](f3a1e9a)),
closes [#4660](#4660)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
dan-petty added a commit that referenced this pull request Nov 23, 2026
The error catalog `docs/ERRORS.md` did not list the four errors of
`devops repos onboard` (#6806). The generator imported only the modules
of `devops_cli.exceptions` and of `CONST_DOMAIN_EXCEPTION_MODULES`, a
hand list. No check failed, and the catalog test passed or failed with
the shard layout. #6810 added the two modules to the list, but the next
module can miss it again.

The generator now imports the module of each `.py` file of the package,
so `__subclasses__` gives every error class that a module defines. The
hand list goes. The generator does not use `pkgutil.walk_packages`,
because it skips `devops_cli/docker/`, a directory with no
`__init__.py`. `DocGenerator.catalog_module_names` gives the names. A
new test runs the import step and expects the module of each file to be
loaded.

`devops docs generate` and the catalog tests each take about 2 s more.
The generated docs do not change.

Closes #6815

Change:
`openspec/changes/archive/2026-11-23-6815-error-catalog-onboard-errors/`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/repos The devops repos commands and worktrees type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(repos): onboard a repository with one command

1 participant