Skip to content

feat(install): auto-add invoking user to kukeon group + surface re-login (step 3) - #1307

Merged
eminwux merged 1 commit into
mainfrom
feat/install-add-user-to-kukeon-group
Jun 14, 2026
Merged

feat(install): auto-add invoking user to kukeon group + surface re-login (step 3)#1307
eminwux merged 1 commit into
mainfrom
feat/install-add-user-to-kukeon-group

Conversation

@eminwux

@eminwux eminwux commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • kuke init creates the kukeon group and lands the daemon socket root:kukeon 0o660, but never adds the invoking operator to the group β€” so the very first kuke client command the install banner suggests hits dial kukeond ... permission denied. This wires the installer to close that gap automatically while it still holds root.
  • New grant_group_membership (runs after init, inside do_install): when a non-root $SUDO_USER is present, usermod -aG kukeon "$SUDO_USER". Idempotent β€” an already-member user is a clean no-op via an id -nG | grep -qxF membership check, never an error. Skipped cleanly when run directly as root (no $SUDO_USER, or $SUDO_USER=root) and when the group doesn't exist yet (e.g. KUKE_SKIP_INIT=1). This is a real privilege grant, so it is scoped strictly to the interactive installer's $SUDO_USER β€” never silently to other accounts.
  • New print_group_note (called from print_next_steps): surfaces the re-login requirement before the first client command, with newgrp kukeon as the no-logout shortcut. States explicitly whether the user was just added vs already a member (KUKE_GROUP_GRANT records the outcome); prints nothing on a direct-root install.
  • Regenerated the docs/site/install.sh mirror via make install.sh (the installer.yaml CI sync check is satisfied).

Coordinates with merged step 2 (#1245), which also edits print_next_steps β€” different lines (step 2 fixed the advertised commands; this adds the group/re-login note ahead of them). Per the issue's Notes, standalone kuke init auto-add is explicitly out of scope (a separate follow-up question); this covers the curl … | install.sh onboarding path only.

Test plan

  • bash -n scripts/install.sh β€” syntax OK (script is set -euo pipefail).
  • make install.sh + diff scripts/install.sh docs/site/install.sh β€” mirror byte-identical (the installer.yaml sync-check job).
  • bash scripts/install.sh --check β€” exits 0, prereq path unaffected (the installer.yaml --check job).
  • Isolated branch tests of grant_group_membership (stubbed getent/id/usermod): direct-root β†’ skipped (no usermod); $SUDO_USER=root β†’ skipped; non-member β†’ added (usermod -aG kukeon invoked); already-member β†’ already (no usermod). Confirmed the membership detector uses whole-line fixed-string match (grep -qxF) so kukeon can't match a kukeon-* group.
  • Isolated render of print_group_note for all three KUKE_GROUP_GRANT states β€” added/already print the correct guidance, skipped prints nothing.
  • AC item 5 β€” full hand-verification (fresh sudo install β†’ newgrp kukeon β†’ first kuke get … succeeds without EACCES) β€” not run on the dev host: it mutates a real account's group membership and runs kuke init against live containerd/cgroups, which would clobber unrelated host state. The constituent logic (each grant branch + the note for each state) is verified above in isolation; the end-to-end smoke is best run by the reviewer on a clean host.

Note on the named CI test target: the Go suite (make test, .github/workflows/test.yaml) is path-filtered to **/*.go / go.mod / go.sum and does not trigger on this shell-only diff. The CI surface that gates this change is .github/workflows/installer.yaml (sync check + --check), both green locally above.

Acceptance criteria

  • On a fresh sudo-driven install, $SUDO_USER is added to the kukeon group automatically; re-running is idempotent (already-member is a no-op).
  • Skipped cleanly when there is no non-root $SUDO_USER (direct-root install).
  • The success message states the group was granted and tells the operator to newgrp kukeon (or re-login) before the first client command, with explicit just-added vs already-member wording.
  • The docs/site/ install-script mirror matches.
  • Verified by hand end-to-end β€” deferred to a clean host (destructive: mutates a real user's groups + runs kuke init); logic verified in isolation instead. See test plan.

Closes #1246

@eminwux eminwux added ready-for-review PR is handed off to the reviewer agent in-review Reviewer agent is actively reading this PR and removed ready-for-review PR is handed off to the reviewer agent labels Jun 14, 2026
@eminwux

eminwux commented Jun 14, 2026

Copy link
Copy Markdown
Owner Author

PR #1307 Review β€” feat(install): auto-add invoking user to kukeon group + surface re-login

LGTM β€” closes the post-install dial kukeond ... permission denied gap by adding $SUDO_USER to the kukeon group while still root, correctly scoped to the sudo invoker and idempotent.

Checked and clean: grant_group_membership runs after kuke init creates the group; direct-root / SUDO_USER=root / KUKE_SKIP_INIT (group absent) all skip with state skipped so print_group_note prints nothing; the id -nG | tr | grep -qxF detector is a correct whole-line match; every pipeline sits in an if so set -euo pipefail won't trip; the usermod-fails branch warns instead of aborting; mirror docs/site/install.sh is byte-identical and all commits verified.

One non-blocking note: AC item 5 (fresh sudo install β†’ newgrp kukeon β†’ first kuke get without EACCES) is deferred as destructive β€” worth running on a clean host before merge, per the test plan.

@eminwux eminwux added ready-to-merge Reviewed and ready to merge and removed in-review Reviewer agent is actively reading this PR labels Jun 14, 2026
@eminwux
eminwux merged commit 8c923b4 into main Jun 14, 2026
7 checks passed
@eminwux
eminwux deleted the feat/install-add-user-to-kukeon-group branch June 14, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Reviewed and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install: auto-add invoking user to kukeon group + surface re-login (step 3)

1 participant