fix(#3500): make the swarm-controller forge account a site admin
This commit is contained in:
parent
aca39072d5
commit
582b5cf83d
1 changed files with 12 additions and 2 deletions
|
|
@ -991,12 +991,22 @@ in
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Idempotent by query, same reasoning as the SSO unit: assert
|
# Idempotent by query, same reasoning as the SSO unit: assert
|
||||||
# the effect, not the command's exit code.
|
# the effect, not the command's exit code. `--admin`: the
|
||||||
|
# controller creates repos in the agents org on the swarm's
|
||||||
|
# behalf, which needs org-admin standing to do at all. Only
|
||||||
|
# applies to a fresh account — `forgejo admin` has no
|
||||||
|
# in-place "promote to admin" verb (checked: `admin user`
|
||||||
|
# offers create/list/change-password/delete/
|
||||||
|
# generate-access-token/must-change-password/reset-mfa and
|
||||||
|
# nothing else), and mara's call was not to delete+recreate
|
||||||
|
# an already-provisioned non-admin account to work around
|
||||||
|
# that (every hive from before this fix has one) — she
|
||||||
|
# promotes those by hand instead.
|
||||||
if ! forgejo admin user list | grep -qE "[[:space:]]${swarmControllerForgeUser}[[:space:]]"; then
|
if ! forgejo admin user list | grep -qE "[[:space:]]${swarmControllerForgeUser}[[:space:]]"; then
|
||||||
forgejo admin user create \
|
forgejo admin user create \
|
||||||
--username ${lib.escapeShellArg swarmControllerForgeUser} \
|
--username ${lib.escapeShellArg swarmControllerForgeUser} \
|
||||||
--email ${lib.escapeShellArg "${swarmControllerForgeUser}@hyperhive.local"} \
|
--email ${lib.escapeShellArg "${swarmControllerForgeUser}@hyperhive.local"} \
|
||||||
--random-password --must-change-password=false
|
--admin --random-password --must-change-password=false
|
||||||
echo "created forge account ${swarmControllerForgeUser}"
|
echo "created forge account ${swarmControllerForgeUser}"
|
||||||
fi
|
fi
|
||||||
if ! forgejo admin user list | grep -qE "[[:space:]]${swarmControllerForgeUser}[[:space:]]"; then
|
if ! forgejo admin user list | grep -qE "[[:space:]]${swarmControllerForgeUser}[[:space:]]"; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue