Skip to content

🐛 fix(demo): headless Forgejo 11 bootstrap (INSTALL_LOCK) - #255

Merged
konih merged 1 commit into
mainfrom
fix/demo-forgejo-install-lock
Aug 4, 2026
Merged

konih merged 1 commit into
mainfrom
fix/demo-forgejo-install-lock

Conversation

@konih

@konih konih commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Forgejo 11 returns 404 on /api/v1/install — hero bootstrap + GIF demo-up failed after the wait fix
  • Manifest: INSTALL_LOCK + demo SECRET_KEY/INTERNAL_TOKEN + sqlite; probe /api/v1/version
  • Bootstrap: wait for version API, forgejo admin user create, then repo/token as before

Test plan

  • bash hack/test/demo_03_hero_smoke_test.sh
  • Local task demo-up + GIF record
  • CI hero-demo-smoke

/api/v1/install is gone; web wizard blocked hero smoke and GIF recording.
Set INSTALL_LOCK + sqlite via env, probe /api/v1/version, create admin
with forgejo CLI.
Copilot AI lite review requested due to automatic review settings August 4, 2026 21:52
@konih
konih merged commit 97d175f into main Aug 4, 2026
2 checks passed
@konih
konih deleted the fix/demo-forgejo-install-lock branch August 4, 2026 21:52
Copilot stopped reviewing on behalf of konih due to an error August 4, 2026 21:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the hero demo Forgejo deployment and bootstrap flow to support Forgejo v11 by running headless (INSTALL_LOCK) and avoiding the removed /api/v1/install endpoint.

Changes:

  • Configure Forgejo to run headless via INSTALL_LOCK and update probes to use /api/v1/version.
  • Update bootstrap script to wait on the version endpoint and create the admin user via forgejo admin.
  • Update smoke test assertions to validate the new headless/bootstrap approach.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
hack/test/demo_03_hero_smoke_test.sh Adjusts smoke checks to enforce headless INSTALL_LOCK setup and v11-compatible bootstrap behavior.
hack/demo/hero/manifests/forgejo.yaml Enables headless Forgejo via env vars and switches readiness/startup probes to /api/v1/version.
hack/demo/hero/bootstrap-forgejo.sh Removes web-install step and creates the admin user via Forgejo CLI after waiting for the API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to +43
- name: FORGEJO__security__INSTALL_LOCK
value: "true"
# Demo-only; not a production secret. Required when INSTALL_LOCK=true.
- name: FORGEJO__security__SECRET_KEY
value: "kollect-hero-demo-secret-key-not-for-prod"
- name: FORGEJO__security__INTERNAL_TOKEN
value: "kollect-hero-demo-internal-token-not-for-prod"
Comment on lines +169 to +170
awk '/^_wait_forgejo\(\)/,/^}/' "${BOOTSTRAP}" | grep -v '^[[:space:]]*#' | grep -Eq 'api/v1/version' ||
fail "_wait_forgejo must curl /api/v1/version once INSTALL_LOCK serves the API"
Comment on lines +160 to +161
grep -Eq 'FORGEJO__security__INSTALL_LOCK' "${FORGEJO_MANIFEST}" ||
fail "forgejo manifest must set INSTALL_LOCK (skip web wizard; /api/v1/install removed)"
Comment on lines +34 to 51
_ensure_admin() {
if kubectl exec -n "$HERO_FORGEJO_NS" deploy/forgejo -- \
curl -fsS "${_internal_url}/api/v1/settings/api" >/dev/null 2>&1; then
_hero_log "Forgejo already installed."
curl -fsS -u "${HERO_FORGEJO_USER}:${HERO_FORGEJO_PASS}" \
"${_internal_url}/api/v1/user" >/dev/null 2>&1; then
_hero_log "Admin user ${HERO_FORGEJO_USER} already exists."
return 0
fi

_hero_log "Running Forgejo first-time install..."
kubectl exec -n "$HERO_FORGEJO_NS" deploy/forgejo -- curl -fsS -X POST \
"${_internal_url}/api/v1/install" \
-H 'Content-Type: application/json' \
-d "$(cat <<EOF
{
"db_type": "sqlite3",
"db_host": "localhost:3306",
"db_user": "",
"db_passwd": "",
"db_name": "gitea",
"ssl_mode": "disable",
"db_path": "/data/gitea.db",
"app_name": "Forgejo",
"repo_root_path": "/data/git/repositories",
"lfs_root_path": "/data/git/lfs",
"run_user": "git",
"domain": "forgejo.forgejo.svc.cluster.local",
"ssh_domain": "forgejo.forgejo.svc.cluster.local",
"port": 3000,
"http_port": 3000,
"root_url": "${_internal_url}/",
"log_level": "Info",
"admin_name": "${HERO_FORGEJO_USER}",
"admin_passwd": "${HERO_FORGEJO_PASS}",
"admin_confirm_passwd": "${HERO_FORGEJO_PASS}",
"admin_email": "[email protected]"
}
EOF
)"
_hero_log "Creating Forgejo admin user ${HERO_FORGEJO_USER}..."
# forgejo admin speaks to the sqlite DB; config is generated from env by the entrypoint.
kubectl exec -n "$HERO_FORGEJO_NS" deploy/forgejo -- \
forgejo admin user create \
--admin \
--username "${HERO_FORGEJO_USER}" \
--password "${HERO_FORGEJO_PASS}" \
--email "[email protected]" \
--must-change-password=false
}
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants