Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

Commit 30b4305

Browse files
committed
forgejo crash from trying to create user, since forgejo should do that for us
1 parent 0a09ba9 commit 30b4305

2 files changed

Lines changed: 1 addition & 54 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "smol_k8s_lab"
3-
version = "6.4.4"
3+
version = "6.4.5"
44
description = "CLI and TUI to quickly install slimmer Kubernetes distros and then manage apps declaratively using Argo CD"
55
authors = ["Jesse Hitch <jessebot@linux.com>",
66
"Max Roby <emax@cloudydev.net>"]

smol_k8s_lab/k8s_apps/social/forgejo.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -175,66 +175,13 @@ def configure_forgejo(argocd: ArgoCD,
175175
# wait for all the forgejo apps to come up, give it extra time
176176
argocd.sync_app(app='forgejo-web-app', sleep_time=4)
177177
argocd.wait_for_app('forgejo-web-app')
178-
179-
# create admin credentials
180-
password = create_user(forgejo_admin_username,
181-
forgejo_admin_email,
182-
cfg['argo']['namespace'])
183-
if bitwarden:
184-
sub_header("Creating secrets in Bitwarden")
185-
bitwarden.create_login(
186-
name='forgejo-admin-credentials',
187-
item_url=forgejo_hostname,
188-
user=forgejo_admin_username,
189-
password=password,
190-
fields=[create_custom_field("email", forgejo_admin_email)]
191-
)
192178
else:
193179
log.info("forgejo already installed 🎉")
194180

195181
if bitwarden and init_enabled:
196182
refresh_bweso(argocd, forgejo_hostname, bitwarden)
197183

198184

199-
def create_user(user: str, email: str, pod_namespace: str) -> str:
200-
"""
201-
given a username, email, and namespace of the forgejo pod, we'll create a
202-
new forgejo user using a kubectl exec command and then we return
203-
their autogenerated password
204-
"""
205-
sub_header(f"Creating a forgejo user for: {user}")
206-
# first, go get the exact name of the pod we need to exec a command on
207-
pod_cmd = (
208-
f"kubectl get pods -n {pod_namespace} "
209-
"-l app.kubernetes.io/instance=forgejo-web-app,app.kubernetes.io/component=web"
210-
" --no-headers "
211-
"-o custom-columns=NAME:.metadata.name"
212-
)
213-
pod = subproc([pod_cmd]).rstrip()
214-
log.info(f"forgejo web app pod is: {pod}")
215-
216-
# generate a random password
217-
password = create_password()
218-
219-
# then run the user creation command
220-
cmd = (f'kubectl exec -n {pod_namespace} {pod} -- /bin/sh -c "./forgejo '
221-
'--config-path ../config/config.yaml admin account create '
222-
f'--username {user} --email {email} --password \'{password}\'"')
223-
224-
# then process the output from the command
225-
subproc([cmd], shell=True, universal_newlines=True)
226-
227-
# then run the user promotion (to admin) command
228-
cmd = (f'kubectl exec -n {pod_namespace} {pod} -- /bin/sh -c '
229-
'"./forgejo --config-path ../config/config.yaml admin '
230-
f'account promote --username {user}"')
231-
232-
# then process the output from the command
233-
subproc([cmd], shell=True, universal_newlines=True).split()[3]
234-
235-
return password
236-
237-
238185
def refresh_bweso(argocd: ArgoCD,
239186
forgejo_hostname: str,
240187
bitwarden: BwCLI) -> None:

0 commit comments

Comments
 (0)