feat: APPS_DIR environment layer (Plan 14 step 2)

new-service/delete-service read and write $GITOPS_DIR/$APPS_DIR (default apps-homelab)
instead of the literal apps/; FORGEJO_URL moves to git.holtlabs.xyz.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nholtware 2026-11-11 14:01:32 -06:00
parent 5b4987a371
commit 11c68770e1
5 changed files with 23 additions and 19 deletions

View file

@ -88,13 +88,13 @@ gitops_sync
((!PUBLIC)) || cf_require
if [[ -n $API_APP ]]; then
[[ -f $GITOPS_DIR/apps/$API_APP.yaml && -d $GITOPS_DIR/manifests/$API_APP ]] ||
[[ -f $GITOPS_DIR/$APPS_DIR/$API_APP.yaml && -d $GITOPS_DIR/manifests/$API_APP ]] ||
die "--api $API_APP: no such service in gitops (create it first)"
[[ $(app_namespace "$API_APP") == "$API_APP" ]] ||
die "--api $API_APP: not a backend (its namespace is '$(app_namespace "$API_APP")')"
fi
if [[ -f $GITOPS_DIR/apps/$NAME.yaml && $(app_namespace "$NAME") != "$NS" ]]; then
die "gitops apps/$NAME.yaml exists with namespace '$(app_namespace "$NAME")', expected '$NS'"
if [[ -f $GITOPS_DIR/$APPS_DIR/$NAME.yaml && $(app_namespace "$NAME") != "$NS" ]]; then
die "gitops $APPS_DIR/$NAME.yaml exists with namespace '$(app_namespace "$NAME")', expected '$NS'"
fi
ok "validated $NAME (kind=$KIND ns=$NS postgres=$WITH_PG redis=$WITH_REDIS api=${API_APP:--})"
@ -148,7 +148,7 @@ else
fi
# ------------------------------------------------------------ 5. gitops manifests
# apps/<name>.yaml is written only after CI's first image exists (step 7), so
# $APPS_DIR/<name>.yaml is written only after CI's first image exists (step 7), so
# ArgoCD never syncs `newTag: latest` before there is an image to pull (the
# migrate-Job ImagePullBackOff caveat from Plan 04).
# public_block DIR: keep (markers only) or strip the `# __PUBLIC_BEGIN__..END__` host rule.
@ -281,17 +281,17 @@ else
fi
# ------------------------------------------------------------ 8. register with ArgoCD
if [[ -f $GITOPS_DIR/apps/$NAME.yaml ]]; then
ok "gitops apps/$NAME.yaml exists"
if [[ -f $GITOPS_DIR/$APPS_DIR/$NAME.yaml ]]; then
ok "gitops $APPS_DIR/$NAME.yaml exists"
else
is_dry || git_auth -C "$GITOPS_DIR" pull -q --ff-only origin main
if is_dry; then
dry "write $GITOPS_DIR/apps/$NAME.yaml (namespace $NS)"
dry "write $GITOPS_DIR/$APPS_DIR/$NAME.yaml (namespace $NS)"
else
sed "s/__APP__/$NAME/g; s/__NS__/$NS/g" "$GITOPS_DIR/templates/$KIND/application.yaml.tmpl" \
>"$GITOPS_DIR/apps/$NAME.yaml"
>"$GITOPS_DIR/$APPS_DIR/$NAME.yaml"
fi
gitops_commit_push "feat($NAME): register ArgoCD application" "apps/$NAME.yaml"
gitops_commit_push "feat($NAME): register ArgoCD application" "$APPS_DIR/$NAME.yaml"
fi
# Don't wait for ArgoCD's 3-min poll.
argocd_refresh root