Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ releases yet; everything is under Unreleased.
another cluster's file. Check now has a row for every app whose config template names an
`org_repo`: absent (the app's first run makes it), this install's, another install's with the
project and cluster it names, or a rename forward, which is a stop.
- **Check names where skills come from.** None ship with kobo (the stranger run, 2026-12-01: the
first clean bootstrap made `<org>/kobo-skills` and the catalog came up with skills=0). The row
says skills go in that repo, that its publish workflow has no cloud identity in a stranger's
template (`skills_publish_wif_provider` and `skills_publish_service_account` blank), and how to
publish by hand from a signed-in machine until one is set.
- **The page before a cluster exists.** A kubeconfig with nothing to read used to be
"unknown": no App card, no Install Gojira, though terraform would make the cluster. When
the env file says `GOJIRA_TERRAFORM=1` and names a `CLUSTER`, the page now says "no cluster
Expand Down Expand Up @@ -143,6 +148,10 @@ releases yet; everything is under Unreleased.

### Fixed

- **The stranger's kobo says its open room is on purpose.** `examples/stack/kobo-config.template.yaml`
left `allow_unauthenticated` unset beside an empty `iap_audience`, so kobo 0.3.86 logged an ERROR
at every boot (its issue #198: an open room must never be silent). The template sets it, with the
line to swap for `iap_audience` behind a sign-in proxy.
- **Install Gojira was gated on a checkout the stranger no longer has.** Since the release is
fetched at `gojira.version`, a new profile has no `gojira_repo`; the page still required one
for the button and said "Set the profile's Gojira checkout". The env file is the only gate.
Expand Down
2 changes: 2 additions & 0 deletions examples/stack/kobo-config.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ workdir: /data/work
db_url: sqlite:////data/kobo.db
ui_dist: /srv/ui
iap_audience: "" # empty: no sign-in proxy; reach the room through a port-forward
allow_unauthenticated: true # says the open room is on purpose; without it kobo logs an ERROR at every boot.
# Behind a sign-in proxy: set iap_audience and drop this line.
# The same GitHub App Gojira uses (install.md step 2): its id and the id of its
# installation on your org, both read when the Secret is written; and where the
# Secret kobo-github mounts the key.
Expand Down
55 changes: 48 additions & 7 deletions stack/preflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ def check_tools(stack: Stack, target: Target, which: Callable[[str], str | None]
return out


def _org_repos(stack: Stack, target: Target) -> list[tuple[str, str]]:
"""(app, org repo) for every app whose config template names an `org_repo`:
the repo the app reads its org-wide config from at boot and makes on its
first run when it is not there (kobo's <org>/kobo-config)."""
def _template_docs(stack: Stack, target: Target) -> list[tuple[str, dict]]:
"""(app, parsed YAML) for every config template the stack fills with the
four things: what the app will read at boot, seen before it boots."""
import yaml

from stack.site import fill
Expand All @@ -112,9 +111,50 @@ def _org_repos(stack: Stack, target: Target) -> list[tuple[str, str]]:
doc = yaml.safe_load(fill(path.read_text(), target.values)) or {}
except (ValueError, yaml.YAMLError):
continue # the four are not set yet, or not YAML: nothing to name
repo = doc.get("org_repo") if isinstance(doc, dict) else None
if isinstance(repo, str) and "/" in repo:
out.append((app.name, repo))
if isinstance(doc, dict):
out.append((app.name, doc))
return out


def _org_repos(stack: Stack, target: Target) -> list[tuple[str, str]]:
"""(app, org repo) for every app whose config template names an `org_repo`:
the repo the app reads its org-wide config from at boot and makes on its
first run when it is not there (kobo's <org>/kobo-config)."""
out = []
for app, doc in _template_docs(stack, target):
repo = doc.get("org_repo")
if isinstance(repo, str) and "/" in repo:
out.append((app, repo))
return out


def check_skills(stack: Stack, target: Target, github: GitHubClient) -> list[Check]:
"""What an assembled agent can be given: none ship with kobo. Skills live in
<org>/<skills_repo> (made by kobo's first run) and reach the room only through
that repo's publish workflow, which signs in to the bucket with the identity
the template names in skills_publish_wif_provider + skills_publish_service_account.
A stranger's template leaves both blank (the stranger run, 2026-12-01: the
bootstrap made tenishai/kobo-skills with `workload_identity_provider:` empty;
the catalog came up with skills=0), so the row says where skills go and that a
merged one will not arrive until an identity is set or someone publishes by hand."""
out = []
for app, doc in _template_docs(stack, target):
org, name, bucket = doc.get("github_org"), doc.get("skills_repo"), doc.get("skills_bucket")
if not (isinstance(org, str) and isinstance(name, str) and org and name):
continue
repo = f"{org}/{name}"
there = "exists" if github.repo_exists(repo) else f"{app}'s first run makes it"
provider, account = doc.get("skills_publish_wif_provider"), doc.get("skills_publish_service_account")
what = f"{app}: skills {repo}"
if provider and account:
out.append(Check(what, "ok", f"{there}; a merged skill is published to {bucket} as {account}"))
else:
out.append(Check(what, "warn", f"none ship with {app}; they go in {repo} ({there}), and its publish "
f"workflow has no cloud identity (skills_publish_wif_provider and "
f"skills_publish_service_account are blank in the template): a merged "
f"skill reaches {bucket} only when one is set, or by hand from a "
f"signed-in machine: `python .github/scripts/publish_skills.py "
f"--bucket {bucket}` in a clone of {repo}"))
return out


Expand Down Expand Up @@ -293,6 +333,7 @@ def preflight(stack: Stack, target: Target, which: Callable[[str], str | None] =
gh = GhCLI(target.env)
out += check_github(stack, gh)
out += check_org_repos(stack, target, gh)
out += check_skills(stack, target, gh)
except ToolError as exc:
out.append(Check("gh login", "fail", str(exc)))
# The cluster row: a missing namespace is a different case from an unreadable
Expand Down
31 changes: 31 additions & 0 deletions tests/test_preflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,37 @@ def test_the_org_config_repo_an_app_reads_at_boot_is_a_row(tmp_path):
assert check_org_repos(stack, target, gh) == []


def test_skills_are_a_row_naming_where_they_go_and_the_missing_publisher(tmp_path):
"""Shaz: "where are the skills coming from?" None ship with kobo; they go in
<org>/kobo-skills and reach the bucket through that repo's publish workflow,
which has no cloud identity in a stranger's template. The row says so, and
says how to publish by hand until one is set."""
from stack.preflight import check_skills
(tmp_path / "kobo.tmpl").write_text('github_org: "{org}"\nskills_repo: kobo-skills\n'
'skills_bucket: "{project}-kobo-skills"\n')
stack, target = _stack(tmp_path, """
apps:
- {name: kobo, repo: o/kobo, image: r/kobo:v1, deploy_repo: "acme/infra-kobo-deploy",
secrets: {kobo-config: {config.yaml: "template:kobo.tmpl"}}}
""")
target.values = {"org": "acme", "project": "acme-agents", "region": "us-central1", "cluster": "gojira-sandbox"}
gh = FakeGitHub()
row = _by(check_skills(stack, target, gh), "kobo: skills acme/kobo-skills")
assert row.status == "warn" and "none ship with kobo" in row.detail
assert "kobo's first run makes it" in row.detail and "--bucket acme-agents-kobo-skills" in row.detail
gh.repos["acme/kobo-skills"] = {"README.md": ""}
row = _by(check_skills(stack, target, gh), "kobo: skills acme/kobo-skills")
assert row.status == "warn" and "(exists)" in row.detail
(tmp_path / "kobo.tmpl").write_text('github_org: "{org}"\nskills_repo: kobo-skills\n'
'skills_bucket: "{project}-kobo-skills"\n'
'skills_publish_wif_provider: projects/1/locations/global/workloadIdentityPools/p/providers/g\n'
'skills_publish_service_account: skills@acme-agents.iam.gserviceaccount.com\n')
row = _by(check_skills(stack, target, gh), "kobo: skills acme/kobo-skills")
assert row.status == "ok" and "as skills@acme-agents.iam.gserviceaccount.com" in row.detail
target.values = {}
assert check_skills(stack, target, gh) == []


def test_no_cluster_yet_is_a_warn_naming_what_install_gojira_makes(tmp_path, monkeypatch):
"""The stranger's Check before the cluster exists said FAIL "has no namespace
'gojira'. Is KUBECONFIG the install's…": a riddle for a cluster terraform has
Expand Down
Loading