Showing 2 changed files with 35 additions and 8 deletions
+18 -0
.doc/development-log.md
@@ -120,3 +120,21 @@ Scop:
120 120
 
121 121
 - compatibilitate mai bună cu password managere și autofill mobil
122 122
 - fără a complica interfața vizibilă
123
+
124
+## 2026-06-08 - Post-Commit Development Deploy Uses the Deploy Script
125
+
126
+Observație: hook-ul local `post-commit` care făcea `git push jumper-runtime HEAD:main` era prea fragil pentru development. Jumper este un checkout live, iar `receive.denyCurrentBranch=updateInstead` refuză push-ul dacă working tree-ul runtime are orice modificare locală în fișiere versionate. Asta făcea propagarea la commit impredictibilă și era ușor să testezi altă versiune decât ultimul commit local.
127
+
128
+Decizie:
129
+
130
+- `post-commit` nu mai împinge direct în repo-ul runtime de pe jumper
131
+- hook-ul creează un worktree temporar curat la commit-ul exact (`HEAD`)
132
+- hook-ul rulează `scripts/deploy_to_jumper.sh` din acel worktree
133
+- deploy-ul continuă să nu copieze implicit `config/`
134
+- `BUILD` este scris din commit-ul exact și devine sursa vizibilă pentru ce versiune rulează
135
+
136
+Scop:
137
+
138
+- după un commit pe `main`, versiunea testată pe jumper este commit-ul tocmai creat
139
+- starea Git dirty din runtime nu mai blochează deploy-ul de development
140
+- badge-ul de build și meta tag-ul `xdev-build` devin verificarea rapidă pentru ce rulează
+17 -8
scripts/deploy_to_jumper.sh
@@ -80,13 +80,15 @@ ssh "$TARGET_HOST" "command -v rsync >/dev/null 2>&1" || {
80 80
 
81 81
 perl -c scripts/host_manager.pl >/dev/null
82 82
 perl -c scripts/mdns_host_seed.pl >/dev/null
83
-BUILD_REVISION="$(git rev-parse --short=12 HEAD)"
84
-BUILD_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
85
-BUILD_DIRTY=0
86
-if [[ -n "$(git status --porcelain)" ]]; then
87
-    BUILD_DIRTY=1
83
+BUILD_REVISION="${BUILD_REVISION:-$(git rev-parse --short=12 HEAD)}"
84
+BUILD_BRANCH="${BUILD_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}"
85
+if [[ -z "${BUILD_DIRTY+x}" ]]; then
86
+    BUILD_DIRTY=0
87
+    if [[ -n "$(git status --porcelain)" ]]; then
88
+        BUILD_DIRTY=1
89
+    fi
88 90
 fi
89
-BUILD_DEPLOYED_AT="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
91
+BUILD_DEPLOYED_AT="${BUILD_DEPLOYED_AT:-$(date -u '+%Y-%m-%dT%H:%M:%SZ')}"
90 92
 
91 93
 rsync_args=(-az --delete)
92 94
 if [[ "$DRY_RUN" -eq 1 ]]; then
@@ -115,8 +117,15 @@ printf 'revision=%s\nbranch=%s\ndirty=%s\ndeployed_at=%s\n' \
115 117
 ssh "$TARGET_HOST" "cd '$TARGET_DIR' && perl -c scripts/host_manager.pl >/dev/null && perl -c scripts/mdns_host_seed.pl >/dev/null"
116 118
 
117 119
 if [[ "$RESTART" -eq 1 ]]; then
118
-    ssh "$TARGET_HOST" "sudo -n systemctl restart host-manager && systemctl is-active host-manager >/dev/null"
120
+    ssh "$TARGET_HOST" "sudo -n systemctl restart host-manager"
119 121
 fi
120 122
 
121
-ssh "$TARGET_HOST" "curl -fsS http://127.0.0.1:8088/healthz >/dev/null"
123
+ssh "$TARGET_HOST" "for attempt in {1..20}; do
124
+    if systemctl is-active host-manager >/dev/null && curl -fsS http://127.0.0.1:8088/healthz >/dev/null; then
125
+        exit 0
126
+    fi
127
+    sleep 0.5
128
+done
129
+systemctl status host-manager --no-pager
130
+exit 1"
122 131
 echo "Deployed to $TARGET_HOST:$TARGET_DIR"