devzone 0.59.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.devcontainer/agent-erreurs.sh +72 -56
  2. package/.devcontainer/agent-etat-json.sh +45 -43
  3. package/.devcontainer/agent-modele.sh +3 -3
  4. package/.devcontainer/agent-session.sh +122 -125
  5. package/.devcontainer/agent-workspace.sh +53 -53
  6. package/.devcontainer/agent.sh +107 -109
  7. package/.devcontainer/argocd/argocd.sh +4 -16
  8. package/.devcontainer/catalogue/app.sh +1 -1
  9. package/.devcontainer/catalogue/catalogue-veilleur.sh +2 -2
  10. package/.devcontainer/catalogue/mysql/mysql.sh +1 -13
  11. package/.devcontainer/catalogue.sh +4 -16
  12. package/.devcontainer/cluster.sh +1 -1
  13. package/.devcontainer/command-aliases.sh +78 -114
  14. package/.devcontainer/devzone +34 -48
  15. package/.devcontainer/etat-json.sh +162 -162
  16. package/.devcontainer/etat-verrou.sh +25 -24
  17. package/.devcontainer/etat.sh +122 -123
  18. package/.devcontainer/gitlab/gitlab.sh +1 -13
  19. package/.devcontainer/gitlab/installation.sh +3 -3
  20. package/.devcontainer/gitlab/secrets.sh +1 -1
  21. package/.devcontainer/gitlab/test-gitlab.sh +1 -1
  22. package/.devcontainer/help.sh +4 -3
  23. package/.devcontainer/memoire.sh +58 -58
  24. package/.devcontainer/metrics-server.sh +52 -51
  25. package/.devcontainer/paquets.sh +0 -12
  26. package/.devcontainer/password.sh +88 -87
  27. package/.devcontainer/ports-auto.sh +6 -6
  28. package/.devcontainer/ports.sh +1 -13
  29. package/.devcontainer/postgres/postgres.sh +1 -13
  30. package/.devcontainer/services-admin.sh +3 -3
  31. package/.devcontainer/skills/devzone/SKILL.md +2 -2
  32. package/README.md +13 -3
  33. package/charts/devzone-workspace/templates/statefulset.yaml +3 -0
  34. package/manage/devzone +61 -569
  35. package/manage/scripts/argocd-services.sh +2 -2
  36. package/manage/scripts/devzone-create.sh +138 -0
  37. package/manage/scripts/devzone-manifest.sh +171 -0
  38. package/manage/scripts/devzone-update.sh +222 -0
  39. package/manage/scripts/migrer.sh +2 -6
  40. package/manage/scripts/workspace-aliases.sh +4 -31
  41. package/manage/workspace.sh +7 -12
  42. package/package.json +1 -1
@@ -1,73 +1,73 @@
1
1
  #!/usr/bin/env bash
2
- # Sortie machine de devzone status (--json) : objet JSON stable et versionné.
3
- # Sourcé par devzone : réutilise ses fonctions (valeur, description, …), ne
4
- # réécrit pas etat(). Construit uniquement avec jq (échappement garanti).
2
+ # Machine output of devzone status (--json): stable, versioned JSON object.
3
+ # Sourced by devzone: reuses its functions (valeur, description, …), does not
4
+ # rewrite etat(). Built only with jq. JSON keys are a contract: French names kept.
5
5
 
6
- # Ajoute une entrée à $erreurs : la rubrique qui a échoué et pourquoi.
7
- ajouter_erreur() {
8
- erreurs="$(jq -c --arg k "$1" --arg v "$2" '. + {($k): $v}' <<<"$erreurs")"
6
+ # Adds an entry to $errors: the section that failed and why.
7
+ add_error() {
8
+ errors="$(jq -c --arg k "$1" --arg v "$2" '. + {($k): $v}' <<<"$errors")"
9
9
  }
10
10
 
11
- # Ajoute une alerte (code, message, commande devzone à lancer) à $alertes_json.
12
- append_alerte() {
13
- local code="$1" message="$2" commande="${3:-}"
14
- alertes_json="$(jq -c \
11
+ # Adds an alert (code, message, devzone command to run) to $alerts_json.
12
+ append_alert() {
13
+ local code="$1" message="$2" command="${3:-}"
14
+ alerts_json="$(jq -c \
15
15
  --arg code "$code" \
16
16
  --arg message "$message" \
17
- --arg commande "$commande" \
18
- '. + [{code:$code,message:$message,commande:(if $commande=="" then null else $commande end)}]' \
19
- <<<"$alertes_json")"
17
+ --arg command "$command" \
18
+ '. + [{code:$code,message:$message,commande:(if $command=="" then null else $command end)}]' \
19
+ <<<"$alerts_json")"
20
20
  }
21
21
 
22
- # État complet du poste en JSON : reprend chaque rubrique de etat() avec les
23
- # mêmes commandes, en isolant chaque calcul (échec → valeur null et erreurs).
24
- etat_json() {
25
- local erreurs='{}'
26
- local alertes_json='[]'
22
+ # Full state of the machine in JSON: repeats each section of etat() with the
23
+ # same commands, isolating each computation (failure → null value and errors).
24
+ state_json() {
25
+ local errors='{}'
26
+ local alerts_json='[]'
27
27
  local dv_raw="" dvp_raw=""
28
- local id_nom="" id_email="" id_ok=false id_commande=""
29
- local plat_nom plat_url="" github_json="null"
30
- local outils_retards_json='[]' outils_commande=""
31
- local modules_json='[]' m actif desc ef content etat_val echec_val commande_val s argocd_repo=""
32
- local docker_hote=false docker_hote_actif=false relais_source
33
- local services_cluster="" services_distant=false
34
- local travail_ctx="" travail_interne=false ctx_hote=""
35
- local clusters_services_raw="" clusters_travail_raw="" clusters_commande=""
28
+ local id_name="" id_email="" id_ok=false id_command=""
29
+ local platform_name platform_url="" github_json="null"
30
+ local tools_late_json='[]' tools_command=""
31
+ local modules_json='[]' m active desc failure_file content state_value failure_value command_value out argocd_repo=""
32
+ local docker_host=false docker_host_active=false relay_source
33
+ local services_cluster="" services_remote=false
34
+ local work_ctx="" work_internal=false host_ctx=""
35
+ local clusters_services_raw="" clusters_work_raw="" clusters_command=""
36
36
  local ports_json='[]' ports_out
37
37
  local applications_json='[]'
38
- local identifiants_raw=""
39
- local retards_out paquet figee installee count
40
- local relais_marque paquets_marque paquets_noms n chemin wt_out
41
- local gh_statut gh_code
38
+ local credentials_raw=""
39
+ local late_out package frozen installed count
40
+ local relay_marker packages_marker packages_names n path wt_out
41
+ local gh_status gh_code
42
42
 
43
43
  if v="$(version_du_dossier 2>/dev/null)"; then
44
44
  dv_raw="$v"
45
45
  else
46
- ajouter_erreur devzone "version_du_dossier indisponible"
46
+ add_error devzone "version_du_dossier unavailable"
47
47
  fi
48
48
  dvp_raw="$(version_publiee 2>/dev/null || true)"
49
49
 
50
- id_nom="$(git config --get user.name 2>/dev/null || true)"
50
+ id_name="$(git config --get user.name 2>/dev/null || true)"
51
51
  id_email="$(git config --get user.email 2>/dev/null || true)"
52
- if [ -n "$id_nom" ] && [ -n "$id_email" ]; then
52
+ if [ -n "$id_name" ] && [ -n "$id_email" ]; then
53
53
  id_ok=true
54
54
  else
55
- id_commande='gh auth login -s workflow (automatique), ou git config --file ~/.config/git/config user.name "<nom>" et user.email "<email>"'
55
+ id_command='gh auth login -s workflow (automatic), or git config --file ~/.config/git/config user.name "<name>" and user.email "<email>"'
56
56
  fi
57
57
 
58
- plat_nom="$(plateforme_lue)"
59
- if [ "$plat_nom" = gitlab ]; then
60
- plat_url="$(url_gitlab_lue)"
58
+ platform_name="$(plateforme_lue)"
59
+ if [ "$platform_name" = gitlab ]; then
60
+ platform_url="$(url_gitlab_lue)"
61
61
  else
62
- plat_url=""
62
+ platform_url=""
63
63
  fi
64
- if [ "$plat_nom" = github ]; then
65
- gh_statut="$(gh auth status 2>&1)" && gh_code=0 || gh_code=$?
64
+ if [ "$platform_name" = github ]; then
65
+ gh_status="$(gh auth status 2>&1)" && gh_code=0 || gh_code=$?
66
66
  if [ "$gh_code" -ne 0 ]; then
67
67
  github_json="null"
68
- ajouter_erreur github "gh auth status a échoué"
68
+ add_error github "gh auth status failed"
69
69
  else
70
- if printf '%s\n' "$gh_statut" | grep -q "Token scopes:" && ! printf '%s\n' "$gh_statut" | grep -q "'workflow'"; then
70
+ if printf '%s\n' "$gh_status" | grep -q "Token scopes:" && ! printf '%s\n' "$gh_status" | grep -q "'workflow'"; then
71
71
  github_json="$(jq -cn '{connecte:true,workflow:false,commande:"gh auth refresh -h github.com -s workflow"}')"
72
72
  else
73
73
  github_json="$(jq -cn '{connecte:true,workflow:true,commande:null}')"
@@ -77,134 +77,134 @@ etat_json() {
77
77
  github_json="null"
78
78
  fi
79
79
 
80
- if retards_out="$(outils_retard 2>/dev/null)"; then
81
- outils_retards_json='[]'
82
- while IFS= read -r ligne; do
83
- [ -n "$ligne" ] || continue
80
+ if late_out="$(outils_retard 2>/dev/null)"; then
81
+ tools_late_json='[]'
82
+ while IFS= read -r line; do
83
+ [ -n "$line" ] || continue
84
84
  # shellcheck disable=SC2086
85
- set -- $ligne
86
- paquet="${1:-}"; figee="${2:-}"; installee="${3:-}"
87
- [ -n "$paquet" ] || continue
88
- outils_retards_json="$(jq -c \
89
- --arg p "$paquet" --arg f "$figee" --arg i "$installee" \
90
- '. + [{paquet:$p,figee:$f,installee:$i}]' <<<"$outils_retards_json")"
91
- done <<<"$retards_out"
92
- count="$(jq 'length' <<<"$outils_retards_json" 2>/dev/null || echo 0)"
85
+ set -- $line
86
+ package="${1:-}"; frozen="${2:-}"; installed="${3:-}"
87
+ [ -n "$package" ] || continue
88
+ tools_late_json="$(jq -c \
89
+ --arg p "$package" --arg f "$frozen" --arg i "$installed" \
90
+ '. + [{paquet:$p,figee:$f,installee:$i}]' <<<"$tools_late_json")"
91
+ done <<<"$late_out"
92
+ count="$(jq 'length' <<<"$tools_late_json" 2>/dev/null || echo 0)"
93
93
  if [ "$count" -gt 0 ]; then
94
- outils_commande="devzone apply"
94
+ tools_command="devzone apply"
95
95
  fi
96
96
  else
97
- outils_retards_json="null"
98
- ajouter_erreur outils "outils_retard indisponible"
97
+ tools_late_json="null"
98
+ add_error outils "outils_retard unavailable"
99
99
  fi
100
100
 
101
101
  modules_json='[]'
102
102
  for m in "${MODULES[@]}"; do
103
- actif=false
104
- [ "$(valeur "$m")" = on ] && actif=true
103
+ active=false
104
+ [ "$(valeur "$m")" = on ] && active=true
105
105
  desc="$(description "$m")"
106
- echec_val=""
107
- etat_val=""
108
- commande_val=""
106
+ failure_value=""
107
+ state_value=""
108
+ command_value=""
109
109
  if dans_pod && service_module "$m"; then
110
110
  # Kubernetes workspace pod (#528): presence by the cluster DNS,
111
111
  # installation from the workstation; no failure marker read here
112
112
  if service_present "$m"; then
113
- etat_val="active: $(service_dns "$m")"
114
- elif [ "$actif" = true ]; then
115
- etat_val="not in the cluster"
116
- commande_val="devzone workspace services enable $m"
113
+ state_value="active: $(service_dns "$m")"
114
+ elif [ "$active" = true ]; then
115
+ state_value="not in the cluster"
116
+ command_value="devzone workspace services enable $m"
117
117
  else
118
- etat_val="facultatif"
119
- commande_val="devzone workspace services enable $m"
118
+ state_value="optional"
119
+ command_value="devzone workspace services enable $m"
120
120
  fi
121
- elif [ "$actif" = true ]; then
122
- ef="$(fichier_echec "$m")"
123
- if [ -f "$ef" ]; then
124
- content="$(cat "$ef" 2>/dev/null || true)"
125
- echec_val="$content"
126
- etat_val="en échec"
127
- commande_val="devzone apply"
121
+ elif [ "$active" = true ]; then
122
+ failure_file="$(fichier_echec "$m")"
123
+ if [ -f "$failure_file" ]; then
124
+ content="$(cat "$failure_file" 2>/dev/null || true)"
125
+ failure_value="$content"
126
+ state_value="failed"
127
+ command_value="devzone apply"
128
128
  elif [ "$m" = gitlab ]; then
129
- if s="$(bash "$ICI/gitlab/gitlab.sh" status 2>/dev/null)"; then
130
- etat_val="$s"
129
+ if out="$(bash "$ICI/gitlab/gitlab.sh" status 2>/dev/null)"; then
130
+ state_value="$out"
131
131
  else
132
- etat_val=""
133
- ajouter_erreur modules "gitlab.sh status indisponible"
132
+ state_value=""
133
+ add_error modules "gitlab.sh status unavailable"
134
134
  fi
135
135
  elif [ "$m" = postgres ] || [ "$m" = llm ]; then
136
- if s="$(bash "$ICI/$m/$m.sh" status 2>/dev/null)"; then
137
- etat_val="$s"
136
+ if out="$(bash "$ICI/$m/$m.sh" status 2>/dev/null)"; then
137
+ state_value="$out"
138
138
  else
139
- etat_val=""
140
- ajouter_erreur modules "$m.sh etat indisponible"
139
+ state_value=""
140
+ add_error modules "$m.sh state unavailable"
141
141
  fi
142
142
  elif [ "$m" = argocd ]; then
143
- if s="$(bash "$ICI/argocd/argocd.sh" status 2>/dev/null)"; then
144
- etat_val="$s"
143
+ if out="$(bash "$ICI/argocd/argocd.sh" status 2>/dev/null)"; then
144
+ state_value="$out"
145
145
  else
146
- etat_val=""
147
- ajouter_erreur modules "argocd.sh status indisponible"
146
+ state_value=""
147
+ add_error modules "argocd.sh status unavailable"
148
148
  fi
149
149
  elif [ "$m" = mysql ]; then
150
- if s="$(bash "$ICI/catalogue/mysql/mysql.sh" status 2>/dev/null)"; then
151
- etat_val="$s"
150
+ if out="$(bash "$ICI/catalogue/mysql/mysql.sh" status 2>/dev/null)"; then
151
+ state_value="$out"
152
152
  else
153
- etat_val=""
154
- ajouter_erreur modules "mysql.sh status indisponible"
153
+ state_value=""
154
+ add_error modules "mysql.sh status unavailable"
155
155
  fi
156
156
  else
157
- etat_val="actif"
157
+ state_value="active"
158
158
  fi
159
159
  else
160
- etat_val="facultatif"
161
- commande_val="devzone enable $m"
160
+ state_value="optional"
161
+ command_value="devzone enable $m"
162
162
  fi
163
163
  modules_json="$(jq -c \
164
- --arg nom "$m" \
165
- --argjson actif "$actif" \
164
+ --arg name "$m" \
165
+ --argjson active "$active" \
166
166
  --arg description "$desc" \
167
- --arg etat "$etat_val" \
168
- --arg echec "$echec_val" \
169
- --arg commande "$commande_val" \
170
- '. + [{nom:$nom,actif:$actif,description:$description,etat:(if $etat=="" then null else $etat end),echec:(if $echec=="" then null else $echec end),commande:(if $commande=="" then null else $commande end)}]' \
167
+ --arg state "$state_value" \
168
+ --arg failure "$failure_value" \
169
+ --arg command "$command_value" \
170
+ '. + [{nom:$name,actif:$active,description:$description,etat:(if $state=="" then null else $state end),echec:(if $failure=="" then null else $failure end),commande:(if $command=="" then null else $command end)}]' \
171
171
  <<<"$modules_json")"
172
172
  done
173
173
 
174
- # Option docker-hote (#432) : absente = on ; socket réellement monté
175
- # (même source que docker-relais.sh), peut différer jusqu'au make rebuild
174
+ # docker-hote option (#432): absent = on; socket really mounted (same
175
+ # source as docker-relais.sh), may differ until make rebuild
176
176
  # In the Kubernetes workspace (DEVZONE_WORKSPACE=kubernetes), the pod has
177
177
  # no Docker host socket: the socket is absent (#515)
178
178
  if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
179
- docker_hote=false
180
- docker_hote_actif=false
179
+ docker_host=false
180
+ docker_host_active=false
181
181
  else
182
182
  if [ "$(valeur docker-hote)" = on ]; then
183
- docker_hote=true
183
+ docker_host=true
184
184
  fi
185
- relais_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
186
- if [ -e "$relais_source" ]; then
187
- docker_hote_actif=true
185
+ relay_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
186
+ if [ -e "$relay_source" ]; then
187
+ docker_host_active=true
188
188
  fi
189
189
  fi
190
190
 
191
191
  services_cluster="$(cluster_lu)"
192
192
  if [ -n "$services_cluster" ] && ! cluster_est_local "$services_cluster"; then
193
- services_distant=true
193
+ services_remote=true
194
194
  fi
195
195
  clusters_services_raw="$services_cluster"
196
- travail_ctx="$(kubectl config current-context 2>/dev/null || true)"
197
- case "$travail_ctx" in
196
+ work_ctx="$(kubectl config current-context 2>/dev/null || true)"
197
+ case "$work_ctx" in
198
198
  kind-gitlab* | kind-devzone*)
199
- ctx_hote="$(KUBECONFIG="${DEVZONE_KUBE_HOTE:-$HOME/.kube/hote.config}" kubectl config current-context 2>/dev/null || true)"
200
- if [ -n "$ctx_hote" ] && cluster_joignable "$ctx_hote" 2>/dev/null; then
201
- travail_interne=true
199
+ host_ctx="$(KUBECONFIG="${DEVZONE_KUBE_HOTE:-$HOME/.kube/hote.config}" kubectl config current-context 2>/dev/null || true)"
200
+ if [ -n "$host_ctx" ] && cluster_joignable "$host_ctx" 2>/dev/null; then
201
+ work_internal=true
202
202
  fi
203
203
  ;;
204
204
  esac
205
- clusters_travail_raw="$travail_ctx"
206
- if [ "$travail_interne" = true ]; then
207
- clusters_commande="devzone use $ctx_hote"
205
+ clusters_work_raw="$work_ctx"
206
+ if [ "$work_internal" = true ]; then
207
+ clusters_command="devzone use $host_ctx"
208
208
  fi
209
209
 
210
210
  if ports_out="$(bash "$ICI/ports.sh" list --json 2>/dev/null)"; then
@@ -212,47 +212,47 @@ etat_json() {
212
212
  ports_json="$ports_out"
213
213
  else
214
214
  ports_json="null"
215
- ajouter_erreur ports "sortie ports illisible"
215
+ add_error ports "ports output unreadable"
216
216
  fi
217
217
  else
218
218
  ports_json="null"
219
- ajouter_erreur ports "ports.sh indisponible"
219
+ add_error ports "ports.sh unavailable"
220
220
  fi
221
221
 
222
222
  applications_json="$(bash "$ICI/catalogue.sh" json 2>/dev/null || echo '[]')"
223
223
  if ! printf '%s' "$applications_json" | jq -e . >/dev/null 2>&1; then
224
224
  applications_json='[]'
225
- ajouter_erreur modules "catalogue.sh json indisponible"
225
+ add_error modules "catalogue.sh json unavailable"
226
226
  fi
227
227
 
228
228
  if [ -f "$RACINE/.password" ]; then
229
- identifiants_raw="$RACINE/.password"
229
+ credentials_raw="$RACINE/.password"
230
230
  fi
231
231
 
232
- relais_marque="${DEVZONE_RELAIS_MARQUE:-/tmp/devzone-relais-docker.echec}"
233
- if [ -f "$relais_marque" ]; then
234
- msg="$(head -1 "$relais_marque" 2>/dev/null || true)"
235
- append_alerte relais_docker "$msg" "devzone repair"
232
+ relay_marker="${DEVZONE_RELAIS_MARQUE:-/tmp/devzone-relais-docker.echec}"
233
+ if [ -f "$relay_marker" ]; then
234
+ msg="$(head -1 "$relay_marker" 2>/dev/null || true)"
235
+ append_alert relais_docker "$msg" "devzone repair"
236
236
  fi
237
- paquets_marque="${DEVZONE_PAQUETS_MARQUE:-/tmp/devzone-paquets.echec}"
238
- if [ -f "$paquets_marque" ]; then
239
- paquets_noms=""
237
+ packages_marker="${DEVZONE_PAQUETS_MARQUE:-/tmp/devzone-paquets.echec}"
238
+ if [ -f "$packages_marker" ]; then
239
+ packages_names=""
240
240
  while IFS= read -r n; do
241
241
  [ -n "$n" ] || continue
242
- paquets_noms="${paquets_noms:+$paquets_noms, }$n"
243
- done < "$paquets_marque"
244
- append_alerte paquets "$paquets_noms" "devzone packages"
242
+ packages_names="${packages_names:+$packages_names, }$n"
243
+ done < "$packages_marker"
244
+ append_alert paquets "$packages_names" "devzone packages"
245
245
  fi
246
246
  wt_out="$(worktrees_absents 2>/dev/null || true)"
247
- while IFS= read -r chemin; do
248
- [ -n "$chemin" ] || continue
249
- append_alerte worktree "$chemin absent ici (créé hors du conteneur ?)" ""
247
+ while IFS= read -r path; do
248
+ [ -n "$path" ] || continue
249
+ append_alert worktree "$path missing here (created outside the container?)" ""
250
250
  done <<<"$wt_out"
251
251
  if [ -n "$services_cluster" ] && ! cluster_est_local "$services_cluster"; then
252
- append_alerte cluster_distant "cluster distant : $services_cluster — services sur un cluster distant" ""
252
+ append_alert cluster_distant "remote cluster: $services_cluster — services on a remote cluster" ""
253
253
  fi
254
- if [ "$travail_interne" = true ]; then
255
- append_alerte cluster_interne "cluster de travail : $travail_ctx (cluster interne de devzone)" "devzone use $ctx_hote"
254
+ if [ "$work_internal" = true ]; then
255
+ append_alert cluster_interne "work cluster: $work_ctx (devzone internal cluster)" "devzone use $host_ctx"
256
256
  fi
257
257
 
258
258
  argocd_repo="$(conf_get argocd repo)"
@@ -262,47 +262,47 @@ etat_json() {
262
262
  --arg dv "$dv_raw" \
263
263
  --arg dvp "$dvp_raw" \
264
264
  --argjson id_ok "$id_ok" \
265
- --arg id_nom "$id_nom" \
265
+ --arg id_name "$id_name" \
266
266
  --arg id_email "$id_email" \
267
- --arg id_commande "$id_commande" \
268
- --arg plat_nom "$plat_nom" \
269
- --arg plat_url "$plat_url" \
267
+ --arg id_command "$id_command" \
268
+ --arg platform_name "$platform_name" \
269
+ --arg platform_url "$platform_url" \
270
270
  --argjson github "$github_json" \
271
- --argjson retards "$outils_retards_json" \
272
- --arg outils_commande "$outils_commande" \
271
+ --argjson tools_late "$tools_late_json" \
272
+ --arg tools_command "$tools_command" \
273
273
  --argjson modules "$modules_json" \
274
274
  --arg argocd_repo "$argocd_repo" \
275
- --argjson docker_hote "$docker_hote" \
276
- --argjson docker_hote_actif "$docker_hote_actif" \
275
+ --argjson docker_host "$docker_host" \
276
+ --argjson docker_host_active "$docker_host_active" \
277
277
  --arg clusters_services "$clusters_services_raw" \
278
- --argjson services_distant "$services_distant" \
279
- --arg clusters_travail "$clusters_travail_raw" \
280
- --argjson travail_interne "$travail_interne" \
281
- --arg clusters_commande "$clusters_commande" \
278
+ --argjson services_remote "$services_remote" \
279
+ --arg clusters_work "$clusters_work_raw" \
280
+ --argjson work_internal "$work_internal" \
281
+ --arg clusters_command "$clusters_command" \
282
282
  --argjson ports "$ports_json" \
283
283
  --argjson applications "$applications_json" \
284
- --arg identifiants "$identifiants_raw" \
285
- --argjson alertes "$alertes_json" \
286
- --argjson erreurs "$erreurs" \
284
+ --arg credentials "$credentials_raw" \
285
+ --argjson alerts "$alerts_json" \
286
+ --argjson errors "$errors" \
287
287
  '{
288
288
  schema: $schema,
289
289
  devzone: { version: (if $dv=="" then null else $dv end), disponible: (if $dvp=="" then null else $dvp end) },
290
- identite_git: { ok: $id_ok, nom: (if $id_nom=="" then null else $id_nom end), email: (if $id_email=="" then null else $id_email end), commande: (if $id_commande=="" then null else $id_commande end) },
291
- plateforme: { nom: $plat_nom, url: (if $plat_url=="" then null else $plat_url end), github: $github },
290
+ identite_git: { ok: $id_ok, nom: (if $id_name=="" then null else $id_name end), email: (if $id_email=="" then null else $id_email end), commande: (if $id_command=="" then null else $id_command end) },
291
+ plateforme: { nom: $platform_name, url: (if $platform_url=="" then null else $platform_url end), github: $github },
292
292
  argocd_repo: (if $argocd_repo == "" then null else $argocd_repo end),
293
- outils: { retards: $retards, commande: (if $outils_commande=="" then null else $outils_commande end) },
293
+ outils: { retards: $tools_late, commande: (if $tools_command=="" then null else $tools_command end) },
294
294
  modules: $modules,
295
- docker_hote: $docker_hote,
296
- docker_hote_actif: $docker_hote_actif,
297
- clusters: { services: (if $clusters_services=="" then null else $clusters_services end), services_distant: $services_distant, travail: (if $clusters_travail=="" then null else $clusters_travail end), travail_interne: $travail_interne, commande: (if $clusters_commande=="" then null else $clusters_commande end) },
295
+ docker_hote: $docker_host,
296
+ docker_hote_actif: $docker_host_active,
297
+ clusters: { services: (if $clusters_services=="" then null else $clusters_services end), services_distant: $services_remote, travail: (if $clusters_work=="" then null else $clusters_work end), travail_interne: $work_internal, commande: (if $clusters_command=="" then null else $clusters_command end) },
298
298
  ports: $ports,
299
299
  applications: (if $applications=="" then null else $applications end),
300
- identifiants: (if $identifiants=="" then null else $identifiants end),
301
- alertes: $alertes,
302
- erreurs: $erreurs
300
+ identifiants: (if $credentials=="" then null else $credentials end),
301
+ alertes: $alerts,
302
+ erreurs: $errors
303
303
  }'
304
304
  }
305
305
 
306
306
  if [ "${BASH_SOURCE[0]}" = "$0" ]; then
307
- etat_json
307
+ state_json
308
308
  fi
@@ -1,52 +1,53 @@
1
1
  #!/usr/bin/env bash
2
- # Verrou d'écriture de l'état des modules, sourcé par etat.sh (#417 et #476)
3
- # etat_verrou_prendre / etat_verrou_lacher verrou d'écriture
2
+ # Write lock of the module state, sourced by etat.sh (#417 and #476)
3
+ # state_lock_take / state_lock_release write lock
4
4
 
5
- # Verrou exclusif (mkdir) : une seule écriture à la fois. Le détenteur
6
- # disparu est deviné par l'âge du dossier (aucun kill) et le compteur rend
7
- # le verrou reprenable dans le même processus (initialiser puis ecrire).
8
- etat_verrou_prendre() {
9
- local age debut
10
- [ "${ETAT_VERROU_PROF:-0}" -gt 0 ] && { ETAT_VERROU_PROF=$((ETAT_VERROU_PROF + 1)); return 0; }
5
+ # Exclusive lock (mkdir): one write at a time. A vanished holder is guessed
6
+ # from the age of the folder (no kill) and the depth counter makes the lock
7
+ # re-takeable within the same process (init then write).
8
+ state_lock_take() {
9
+ local age start
10
+ [ "${STATE_LOCK_DEPTH:-0}" -gt 0 ] && { STATE_LOCK_DEPTH=$((STATE_LOCK_DEPTH + 1)); return 0; }
11
11
  mkdir -p "$(dirname "$ETAT")" || return 1
12
- debut="$(date +%s)"
12
+ start="$(date +%s)"
13
13
  while ! mkdir "${ETAT}.verrou" 2>/dev/null; do
14
14
  age="$(stat -c %Y "${ETAT}.verrou" 2>/dev/null || stat -f %m "${ETAT}.verrou" 2>/dev/null || true)"
15
15
  if [ -n "$age" ] && [ "$(( $(date +%s) - age ))" -gt 30 ]; then
16
16
  rm -rf "${ETAT}.verrou"
17
17
  continue
18
18
  fi
19
- if [ "$(( $(date +%s) - debut ))" -ge 10 ]; then
20
- echo "devzone : état verrouillé ailleurs : ${ETAT}.verrou" >&2
19
+ if [ "$(( $(date +%s) - start ))" -ge 10 ]; then
20
+ echo "devzone : state locked elsewhere: ${ETAT}.verrou" >&2
21
21
  return 1
22
22
  fi
23
23
  sleep 1
24
24
  done
25
- # flock sérialise l'écriture quand il existe (Linux), mkdir reste seul garde-fou sous macOS (#476, même motif que #461).
25
+ # flock serializes the write when it exists (Linux); mkdir stays the only
26
+ # guard on macOS (#476, same pattern as #461).
26
27
  if command -v flock >/dev/null 2>&1; then
27
28
  if { exec 8>"${ETAT}.lock"; } && flock -w 10 8; then
28
- ETAT_VERROU_FLOCK=1
29
+ STATE_LOCK_FLOCK=1
29
30
  else
30
31
  rm -rf "${ETAT}.verrou" 2>/dev/null || true
31
- echo "devzone : état verrouillé ailleurs (flock) : ${ETAT}.lock" >&2
32
+ echo "devzone : state locked elsewhere (flock): ${ETAT}.lock" >&2
32
33
  return 1
33
34
  fi
34
35
  fi
35
- ETAT_VERROU_PROF=1
36
+ STATE_LOCK_DEPTH=1
36
37
  return 0
37
38
  }
38
39
 
39
- # Rend le verrou pris par ce processus ; profondeur > 1 : détenu encore
40
- etat_verrou_lacher() {
41
- local prof="${ETAT_VERROU_PROF:-0}"
42
- [ "$prof" -gt 0 ] || return 0
43
- [ "$prof" -gt 1 ] && { ETAT_VERROU_PROF=$((prof - 1)); return 0; }
44
- ETAT_VERROU_PROF=0
45
- if [ "${ETAT_VERROU_FLOCK:-0}" = 1 ]; then
40
+ # Releases the lock taken by this process; depth > 1: still held
41
+ state_lock_release() {
42
+ local depth="${STATE_LOCK_DEPTH:-0}"
43
+ [ "$depth" -gt 0 ] || return 0
44
+ [ "$depth" -gt 1 ] && { STATE_LOCK_DEPTH=$((depth - 1)); return 0; }
45
+ STATE_LOCK_DEPTH=0
46
+ if [ "${STATE_LOCK_FLOCK:-0}" = 1 ]; then
46
47
  flock -u 8 2>/dev/null || true
47
48
  exec 8>&-
48
- ETAT_VERROU_FLOCK=0
49
+ STATE_LOCK_FLOCK=0
49
50
  fi
50
51
  rm -rf "${ETAT}.verrou" 2>/dev/null || true
51
52
  return 0
52
- }
53
+ }