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,169 +1,168 @@
1
1
  #!/usr/bin/env bash
2
- # Écriture sûre de l'état des modules (#417) : le seul endroit qui pose,
3
- # remplace ou retire une ligne de $ETAT. Un verrou mkdir empêche deux
4
- # écritures simultanées, le temporaire est créé dans le dossier de l'état
5
- # (le mv reste atomique : le fichier n'est jamais absent ni incomplet pour
6
- # un lecteur) et une copie de secours $ETAT.prec précède chaque
7
- # remplacement. Le même fichier crée l'état quand il manque : ancien état
8
- # global repris une fois, copie de secours restaurée, état reconstruit
9
- # depuis le cluster des services, sinon première installation.
10
- # Bibliothèque sourcée : l'appelant définit ETAT.
11
- # etat_ecrire <clé> <valeur> pose ou remplace la ligne <clé>=<valeur>
12
- # etat_retirer <clé> retire la ligne <clé>=
13
- # etat_poser <fichier> remplace tout l'état par ce fichier
14
- # etat_verrou_prendre / etat_verrou_lacher verrou d'écriture
15
- # etat_recouvrement_* état restauré ou reconstruit (étape 4)
16
- # etat_initialiser [modules…] crée l'état s'il manque
17
-
18
- # Verrou d'écriture (#476) : etat_verrou_prendre, etat_verrou_lacher
2
+ # Safe write of the module state (#417): the only place that sets, replaces
3
+ # or removes a line of $ETAT. A mkdir lock prevents two simultaneous writes,
4
+ # the temporary file is created in the state folder (the mv stays atomic: the
5
+ # file is never missing or incomplete for a reader) and a backup copy
6
+ # $ETAT.prec precedes each replacement. The same file creates the state when
7
+ # it is missing: former global state taken over once, backup copy restored,
8
+ # state rebuilt from the services cluster, otherwise first installation.
9
+ # Sourced library: the caller defines ETAT (file name kept: shared by callers).
10
+ # state_write <key> <value> sets or replaces the line <key>=<value>
11
+ # state_remove <key> removes the line <key>=
12
+ # state_replace <file> replaces the whole state with this file
13
+ # state_lock_take / state_lock_release write lock
14
+ # state_recovery_* state restored or rebuilt (step 4)
15
+ # state_init [modules…] creates the state if it is missing
16
+
17
+ # Write lock (#476): state_lock_take, state_lock_release
19
18
  # shellcheck source=SCRIPTDIR/etat-verrou.sh
20
19
  # shellcheck disable=SC1091
21
20
  . "$(dirname "${BASH_SOURCE[0]}")/etat-verrou.sh"
22
21
 
23
- # Abandon sous verrou : le temporaire part, le verrou est lâché
24
- etat_echec() {
22
+ # Abort under lock: the temporary file goes, the lock is released
23
+ state_abort() {
25
24
  rm -f "${1:-}"
26
- etat_verrou_lacher
25
+ state_lock_release
27
26
  return 1
28
27
  }
29
28
 
30
- # Copie de secours de l'état courant, avant remplacement
31
- etat_sauvegarder() {
29
+ # Backup copy of the current state, before replacement
30
+ state_backup() {
32
31
  [ -f "$ETAT" ] || return 0
33
32
  cp "$ETAT" "${ETAT}.prec"
34
33
  }
35
34
 
36
- # L'état sans la ligne $1, écrit dans le fichier temporaire $2
37
- etat_filtrer() {
38
- local cle="$1" dst="$2" code=0
35
+ # The state without the line $1, written to the temporary file $2
36
+ state_filter() {
37
+ local key="$1" dst="$2" code=0
39
38
  [ -f "$ETAT" ] || return 0
40
- grep -vE "^${cle}=" "$ETAT" >"$dst" || code=$?
39
+ grep -vE "^${key}=" "$ETAT" >"$dst" || code=$?
41
40
  [ "$code" -le 1 ] || return 1
42
41
  return 0
43
42
  }
44
43
 
45
- # Sous verrou : remplace tout l'état par un fichier, $ETAT.prec sauvegardé
46
- etat_poser() {
44
+ # Under lock: replaces the whole state with a file, $ETAT.prec backed up
45
+ state_replace() {
47
46
  local src="$1" tmp
48
47
  [ -f "$src" ] || return 1
49
- etat_verrou_prendre || return 1
50
- etat_sauvegarder || { etat_verrou_lacher; return 1; }
51
- tmp="$(mktemp "${ETAT}.XXXXXX")" || { etat_verrou_lacher; return 1; }
52
- cat "$src" >"$tmp" || { etat_echec "$tmp"; return 1; }
53
- mv "$tmp" "$ETAT" || { etat_echec "$tmp"; return 1; }
54
- etat_verrou_lacher
48
+ state_lock_take || return 1
49
+ state_backup || { state_lock_release; return 1; }
50
+ tmp="$(mktemp "${ETAT}.XXXXXX")" || { state_lock_release; return 1; }
51
+ cat "$src" >"$tmp" || { state_abort "$tmp"; return 1; }
52
+ mv "$tmp" "$ETAT" || { state_abort "$tmp"; return 1; }
53
+ state_lock_release
55
54
  return 0
56
55
  }
57
56
 
58
- # Sous verrou : nouvelle valeur d'une clé, sans perdre les autres lignes
59
- etat_ecrire() {
60
- local cle="$1" valeur="$2" tmp
61
- etat_verrou_prendre || return 1
62
- etat_sauvegarder || { etat_verrou_lacher; return 1; }
63
- tmp="$(mktemp "${ETAT}.XXXXXX")" || { etat_verrou_lacher; return 1; }
64
- etat_filtrer "$cle" "$tmp" || { etat_echec "$tmp"; return 1; }
65
- printf '%s=%s\n' "$cle" "$valeur" >>"$tmp" || { etat_echec "$tmp"; return 1; }
66
- mv "$tmp" "$ETAT" || { etat_echec "$tmp"; return 1; }
67
- etat_verrou_lacher
57
+ # Under lock: new value of a key, without losing the other lines
58
+ state_write() {
59
+ local key="$1" value="$2" tmp
60
+ state_lock_take || return 1
61
+ state_backup || { state_lock_release; return 1; }
62
+ tmp="$(mktemp "${ETAT}.XXXXXX")" || { state_lock_release; return 1; }
63
+ state_filter "$key" "$tmp" || { state_abort "$tmp"; return 1; }
64
+ printf '%s=%s\n' "$key" "$value" >>"$tmp" || { state_abort "$tmp"; return 1; }
65
+ mv "$tmp" "$ETAT" || { state_abort "$tmp"; return 1; }
66
+ state_lock_release
68
67
  return 0
69
68
  }
70
69
 
71
- # Sous verrou : retire une clé (#417) ; sans état, rien à retirer
72
- etat_retirer() {
73
- local cle="$1" tmp
74
- etat_verrou_prendre || return 1
75
- [ -f "$ETAT" ] || { etat_verrou_lacher; return 0; }
76
- etat_sauvegarder || { etat_verrou_lacher; return 1; }
77
- tmp="$(mktemp "${ETAT}.XXXXXX")" || { etat_verrou_lacher; return 1; }
78
- etat_filtrer "$cle" "$tmp" || { etat_echec "$tmp"; return 1; }
79
- mv "$tmp" "$ETAT" || { etat_echec "$tmp"; return 1; }
80
- etat_verrou_lacher
70
+ # Under lock: removes a key (#417); without state, nothing to remove
71
+ state_remove() {
72
+ local key="$1" tmp
73
+ state_lock_take || return 1
74
+ [ -f "$ETAT" ] || { state_lock_release; return 0; }
75
+ state_backup || { state_lock_release; return 1; }
76
+ tmp="$(mktemp "${ETAT}.XXXXXX")" || { state_lock_release; return 1; }
77
+ state_filter "$key" "$tmp" || { state_abort "$tmp"; return 1; }
78
+ mv "$tmp" "$ETAT" || { state_abort "$tmp"; return 1; }
79
+ state_lock_release
81
80
  return 0
82
81
  }
83
82
 
84
- # Signale un état restauré ou reconstruit : les veilleurs attendent (#417)
85
- etat_recouvrement_marquer() {
83
+ # Marks a restored or rebuilt state: the watchers wait (#417)
84
+ state_recovery_mark() {
86
85
  date +%s >"${ETAT}.recouvre" 2>/dev/null || true
87
86
  }
88
87
 
89
- # 0 (à attendre) moins de 60 s après une restauration ou une reconstruction
90
- etat_recouvrement_attente() {
91
- local marque
88
+ # 0 (to wait) less than 60 s after a restore or a rebuild
89
+ state_recovery_wait() {
90
+ local mark
92
91
  [ -f "${ETAT}.recouvre" ] || return 1
93
- marque="$(cat "${ETAT}.recouvre" 2>/dev/null || true)"
94
- case "$marque" in
92
+ mark="$(cat "${ETAT}.recouvre" 2>/dev/null || true)"
93
+ case "$mark" in
95
94
  '' | *[!0-9]*) return 1 ;;
96
95
  esac
97
- [ "$(( $(date +%s) - marque ))" -lt 60 ]
96
+ [ "$(( $(date +%s) - mark ))" -lt 60 ]
98
97
  }
99
98
 
100
- # 0 si l'état restauré ou reconstruit n'est pas encore confirmé (#417)
101
- etat_recouvrement_en_attente() {
99
+ # 0 if the restored or rebuilt state is not yet confirmed (#417)
100
+ state_recovery_pending() {
102
101
  [ -f "${ETAT}.recouvre" ]
103
102
  }
104
103
 
105
- # L'utilisateur a confirmé l'état (devzone apply) : plus de garde
106
- etat_recouvrement_confirmer() {
104
+ # The user confirmed the state (devzone apply): no more guard
105
+ state_recovery_confirm() {
107
106
  rm -f "${ETAT}.recouvre" 2>/dev/null || true
108
107
  return 0
109
108
  }
110
109
 
111
- # Première installation (#417) : l'état par défaut, écrit d'un bloc
112
- etat_defaut() {
110
+ # First installation (#417): the default state, written in one go
111
+ state_default() {
113
112
  local stage code=0
114
113
  stage="$(mktemp)" || return 1
115
114
  printf 'ia=off\nkubernetes=off\ngitlab=off\n' >"$stage"
116
- etat_poser "$stage" || code=$?
115
+ state_replace "$stage" || code=$?
117
116
  rm -f "$stage"
118
117
  return "$code"
119
118
  }
120
119
 
121
- # Contexte de l'hôte (KUBECONFIG de l'hôte) qui pointe sur le cluster donné :
122
- # le cluster= de l'état attend ce contexte, pas « devzone » (cluster des services)
123
- contexte_hote_du_cluster() {
124
- local cluster="$1" hote ctx
125
- hote="${DEVZONE_KUBE_HOTE:-$HOME/.kube/hote.config}"
120
+ # Host context (host KUBECONFIG) that points to the given cluster: the
121
+ # cluster= line of the state expects this context, not "devzone" (services cluster)
122
+ host_context_of_cluster() {
123
+ local cluster="$1" host ctx
124
+ host="${DEVZONE_KUBE_HOTE:-$HOME/.kube/hote.config}"
126
125
  while IFS= read -r ctx; do
127
126
  [ -n "$ctx" ] || continue
128
- # Le contexte « devzone » est posé sur le cluster des services : on
129
- # cherche le contexte de l'hôte qui y pointe
127
+ # The "devzone" context is set on the services cluster: we look for the
128
+ # host context that points to it
130
129
  [ "$ctx" = devzone ] && continue
131
- if [ "$(KUBECONFIG="$hote" kubectl config view -o jsonpath="{.contexts[?(@.name=\"$ctx\")].context.cluster}" 2>/dev/null || true)" = "$cluster" ]; then
130
+ if [ "$(KUBECONFIG="$host" kubectl config view -o jsonpath="{.contexts[?(@.name==\"$ctx\")].context.cluster}" 2>/dev/null || true)" = "$cluster" ]; then
132
131
  echo "$ctx"
133
132
  return 0
134
133
  fi
135
- done < <(KUBECONFIG="$hote" kubectl config get-contexts -o name 2>/dev/null)
134
+ done < <(KUBECONFIG="$host" kubectl config get-contexts -o name 2>/dev/null)
136
135
  return 1
137
136
  }
138
137
 
139
- # État absent sans copie de secours (#417, étape 3) : reconstruit depuis les
140
- # namespaces étiquetés devzone du cluster des services (module à on si son
141
- # namespace existe, cluster= du contexte devzone) ; rend 1 sinon.
142
- etat_reconstruire() {
143
- local nss m v stage vu=0 code=0 cluster_ctx cluster_hote etiquette
144
- etiquette="${CLUSTER_ETIQUETTE:-app.kubernetes.io/managed-by=devzone}"
138
+ # State missing without backup copy (#417, step 3): rebuilt from the namespaces
139
+ # labelled devzone of the services cluster (module on if its namespace exists,
140
+ # cluster= of the devzone context); returns 1 otherwise.
141
+ state_rebuild() {
142
+ local namespaces m v stage seen=0 code=0 cluster_ctx cluster_host label
143
+ label="${CLUSTER_ETIQUETTE:-app.kubernetes.io/managed-by=devzone}"
145
144
  command -v kubectl >/dev/null 2>&1 || return 1
146
- nss="$(kubectl get namespaces -l "$etiquette" -o name 2>/dev/null || true)"
147
- [ -n "$nss" ] || return 1
145
+ namespaces="$(kubectl get namespaces -l "$label" -o name 2>/dev/null || true)"
146
+ [ -n "$namespaces" ] || return 1
148
147
  stage="$(mktemp)" || return 1
149
148
  for m in "$@"; do
150
149
  v=off
151
- printf '%s\n' "$nss" | grep -qx "namespace/devzone-$m" && { v=on; vu=1; }
150
+ printf '%s\n' "$namespaces" | grep -qx "namespace/devzone-$m" && { v=on; seen=1; }
152
151
  printf '%s=%s\n' "$m" "$v" >>"$stage" || code=1
153
152
  done
154
- # Contexte devzone -> cluster des services ; le cluster= attend le contexte
155
- # réel de l'hôte qui y pointe (ex. docker-desktop). Sans hôte : aucune ligne.
156
- cluster_ctx="$(kubectl config view -o jsonpath="{.contexts[?(@.name=\"devzone\")].context.cluster}" 2>/dev/null || true)"
157
- cluster_hote=""
153
+ # devzone context -> services cluster; the cluster= expects the real host
154
+ # context that points to it (e.g. docker-desktop). Without host: no line.
155
+ cluster_ctx="$(kubectl config view -o jsonpath="{.contexts[?(@.name==\"devzone\")].context.cluster}" 2>/dev/null || true)"
156
+ cluster_host=""
158
157
  if [ -n "$cluster_ctx" ]; then
159
- cluster_hote="$(contexte_hote_du_cluster "$cluster_ctx")"
160
- if [ -n "$cluster_hote" ]; then
161
- printf 'cluster=%s\n' "$cluster_hote" >>"$stage" || code=1
158
+ cluster_host="$(host_context_of_cluster "$cluster_ctx")"
159
+ if [ -n "$cluster_host" ]; then
160
+ printf 'cluster=%s\n' "$cluster_host" >>"$stage" || code=1
162
161
  fi
163
162
  fi
164
- if [ "$code" -eq 0 ] && [ "$vu" -eq 1 ] && etat_poser "$stage"; then
165
- echo "devzone : état reconstruit depuis les namespaces du cluster des services : $ETAT (confirmez par devzone apply)" >&2
166
- [ -n "$cluster_hote" ] || echo "devzone : aucun contexte d'hôte ne pointe sur le cluster des services : pas de ligne cluster= dans $ETAT" >&2
163
+ if [ "$code" -eq 0 ] && [ "$seen" -eq 1 ] && state_replace "$stage"; then
164
+ echo "devzone : state rebuilt from the namespaces of the services cluster: $ETAT (confirm with devzone apply)" >&2
165
+ [ -n "$cluster_host" ] || echo "devzone : no host context points to the services cluster: no cluster= line in $ETAT" >&2
167
166
  rm -f "$stage"
168
167
  return 0
169
168
  fi
@@ -171,50 +170,50 @@ etat_reconstruire() {
171
170
  return 1
172
171
  }
173
172
 
174
- # Premier démarrage (aucun état) : ancien état global repris une fois, sinon
175
- # copie de secours restaurée, sinon état reconstruit, sinon tout désactivé
176
- etat_initialiser() {
173
+ # First start (no state): former global state taken over once, otherwise backup
174
+ # copy restored, otherwise state rebuilt, otherwise everything disabled
175
+ state_init() {
177
176
  [ -f "$ETAT" ] && return 0
178
177
 
179
- # Migration : ancien état global (~/.config/devzone/modules) vers l'état
180
- # de l'instance ; déplacé, pas copié : le premier devzone démarré après
181
- # la mise à jour garde ses choix
178
+ # Migration: former global state (~/.config/devzone/modules) to the state of
179
+ # the instance; moved, not copied: the first devzone started after the update
180
+ # keeps its choices
182
181
  if [ -f "$HOME/.config/devzone/modules" ]; then
183
- if etat_poser "$HOME/.config/devzone/modules"; then
182
+ if state_replace "$HOME/.config/devzone/modules"; then
184
183
  rm -f "$HOME/.config/devzone/modules"
185
184
  return 0
186
185
  fi
187
186
  fi
188
187
 
189
- etat_verrou_prendre || return 1
188
+ state_lock_take || return 1
190
189
  if [ -f "$ETAT" ]; then
191
- etat_verrou_lacher
190
+ state_lock_release
192
191
  return 0
193
192
  fi
194
- # 1. Copie de secours laissée par la dernière écriture (#417)
195
- if [ -f "${ETAT}.prec" ] && etat_poser "${ETAT}.prec"; then
196
- echo "devzone : état restauré depuis la copie de secours : $ETAT (confirmez par devzone apply)" >&2
197
- etat_recouvrement_marquer
198
- etat_verrou_lacher
193
+ # 1. Backup copy left by the last write (#417)
194
+ if [ -f "${ETAT}.prec" ] && state_replace "${ETAT}.prec"; then
195
+ echo "devzone : state restored from the backup copy: $ETAT (confirm with devzone apply)" >&2
196
+ state_recovery_mark
197
+ state_lock_release
199
198
  return 0
200
199
  fi
201
- # 2. Reconstruction depuis le cluster des services (#417)
202
- if etat_reconstruire "$@"; then
203
- etat_recouvrement_marquer
204
- etat_verrou_lacher
200
+ # 2. Rebuild from the services cluster (#417)
201
+ if state_rebuild "$@"; then
202
+ state_recovery_mark
203
+ state_lock_release
205
204
  return 0
206
205
  fi
207
- # 3. Première installation : tout désactivé (#417)
208
- if ! etat_defaut; then
209
- etat_verrou_lacher
206
+ # 3. First installation: everything disabled (#417)
207
+ if ! state_default; then
208
+ state_lock_release
210
209
  return 1
211
210
  fi
212
- etat_verrou_lacher
213
- # Connexion déjà établie par une autre devzone (volumes partagés) :
214
- # signalée une seule fois, à la création de l'état de cette instance ;
215
- # stderr : initialiser est aussi appelé dans $(valeur …)
211
+ state_lock_release
212
+ # Connection already set up by another devzone (shared volumes): reported
213
+ # once, when the state of this instance is created; stderr: init is also
214
+ # called inside $(value …)
216
215
  if [ -f "$HOME/.claude/.credentials.json" ] || [ -f "$HOME/.local/share/opencode/auth.json" ]; then
217
- echo "devzone : connexion Claude Code/opencode partagée trouvée : devzone enable ia pour l'utiliser ici" >&2
216
+ echo "devzone : shared Claude Code/opencode connection found: devzone enable ia to use it here" >&2
218
217
  fi
219
218
  return 0
220
219
  }
@@ -17,18 +17,6 @@ RACINE="${DEVZONE_RACINE:-$(dirname "$(dirname "$ICI")")}"
17
17
  # shellcheck source=SCRIPTDIR/../isolement.sh
18
18
  # shellcheck disable=SC1091
19
19
  . "$ICI/../isolement.sh"
20
- # English command names are accepted (#557) : a copied script may miss the file
21
- # shellcheck source=SCRIPTDIR/../command-aliases.sh
22
- # shellcheck disable=SC1091
23
- if [ -f "$ICI/../command-aliases.sh" ]; then
24
- . "$ICI/../command-aliases.sh"
25
- fi
26
- # Subcommand and options become their canonical English names ; the old
27
- # French names warn on use (#557)
28
- if command -v canonical_args >/dev/null 2>&1; then
29
- canonical_args gitlab "$@"
30
- set -- "${ARGS_CANONICAL[@]+"${ARGS_CANONICAL[@]}"}"
31
- fi
32
20
 
33
21
  # ---- Variables de délai (secondes) ----
34
22
  # GITLAB_ATTENTE : attente globale d'installation (défaut 1200)
@@ -40,7 +28,7 @@ GITLAB_SECRETS_DIR="$RACINE/workspace/.gitlab"
40
28
 
41
29
  # Vue regroupée des identifiants : un échec n'empêche jamais l'opération
42
30
  regenerer_identifiants() {
43
- password_regenerer ||
31
+ password_regenerate ||
44
32
  echo "devzone : gitlab : identifiants regroupés non mis à jour (devzone passwords)" >&2
45
33
  }
46
34
 
@@ -6,8 +6,8 @@
6
6
  # Le chart enveloppe charts/devzone-gitlab (#538) porte les dépendances et les
7
7
  # valeurs ; chart.sh (helm direct) et argocd.sh (Application) l'installent.
8
8
 
9
- # Shared memory check of the services cluster (#608): quantite_ki,
10
- # memoire_cluster_ki and verifier_memoire_module.
9
+ # Shared memory check of the services cluster (#608): quantity_ki,
10
+ # memory_cluster_ki and check_module_memory.
11
11
  # shellcheck source=SCRIPTDIR/../memoire.sh
12
12
  # shellcheck disable=SC1091
13
13
  . "$ICI/../memoire.sh"
@@ -36,7 +36,7 @@ gitlab_namespace_preparer() {
36
36
  # l'accès (relais web/SSH, /etc/hosts) et le seed des données de test.
37
37
  gitlab_installer() {
38
38
  echo "▶ Vérification de la mémoire allouable du cluster des services…"
39
- verifier_memoire_module gitlab 8 || return 2
39
+ check_module_memory gitlab 8 || return 2
40
40
 
41
41
  mkdir -p "$GITLAB_SECRETS_DIR"
42
42
  gitlab_namespace_preparer
@@ -89,7 +89,7 @@ puts \"OK\""
89
89
  mkdir -p "$GITLAB_SECRETS_DIR" || return 1
90
90
  (umask 077 && printf '%s' "$mdp" >"$fichier") || return 1
91
91
  chmod 600 "$fichier"
92
- password_regenerer ||
92
+ password_regenerate ||
93
93
  echo "devzone : gitlab : identifiants regroupés non mis à jour (devzone passwords)" >&2
94
94
  printf '%s\n' "$RACINE/.password"
95
95
  }
@@ -150,7 +150,7 @@ etape_module() {
150
150
  # pipeline resterait en attente).
151
151
  etape_etat() {
152
152
  local etat
153
- etat="$(bash "$GITLAB" etat 2>&1 || true)"
153
+ etat="$(bash "$GITLAB" status 2>&1 || true)"
154
154
  if [[ "$etat" != *"prêt"* ]]; then
155
155
  RAISON="état : ${etat:-illisible}"
156
156
  return 1
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env bash
2
2
  # Help of devzone (devzone --help, #557), sourced by devzone : English command
3
- # names first ; the French names are still accepted and warn (deprecated).
3
+ # names only ; the French names are refused and print the new name (#695).
4
4
  # devzone_aide prints the list, indented like the other usage texts.
5
5
  devzone_aide() {
6
6
  cat <<'AIDE'
7
7
  Optional modules of devzone, enabled on demand, without rebuild:
8
8
  devzone state of the modules
9
+ devzone --version version of the workspace image (DEVZONE_VERSION)
9
10
  devzone platform GitHub (default) or GitLab
10
11
  devzone platform github back to GitHub: glab and config removed
11
12
  devzone platform gitlab GitLab, [--url URL] (default: gitlab module)
@@ -21,7 +22,7 @@ devzone_aide() {
21
22
  devzone test-bash32 run the bats tests under bash 3.2 (Docker container)
22
23
  devzone test-gitlab end-to-end test of the GitLab module and platform
23
24
  devzone agent <folder> <instructions> drive opencode with the instructions file
24
- devzone ai | ia list the host (Ollama) models detected and the default model
25
+ devzone ai list the host (Ollama) models detected and the default model
25
26
  devzone ticket <n> [--repo devzone|repowarden] ticket worktree (ticket done <n> removes it)
26
27
  devzone build <folder> [--tag <name>] build an image in the Kubernetes workspace (BuildKit)
27
28
  devzone enable postgres [--context CTX] [--confirm CTX] shared PostgreSQL, cluster of choice
@@ -38,6 +39,6 @@ devzone_aide() {
38
39
  devzone port [<n>|--close <n>] relay of a container port to the workstation
39
40
  devzone passwords regenerate .password and print its path
40
41
  devzone packages [add|remove|apply] … system packages kept after a rebuild
41
- Old French names are still accepted (deprecated).
42
+ Old French names are refused and print the new name (see the reference).
42
43
  AIDE
43
44
  }
@@ -2,35 +2,35 @@
2
2
  # Memory check of the services cluster (#608, #612): a module refuses its
3
3
  # installation when the allocatable memory of the nodes is below its minimum.
4
4
  # Sourced by the modules (gitlab, llm) and by the tests; bash 3.2 (macOS).
5
- # quantite_ki <quantite> Kubernetes quantity in Ki
6
- # memoire_cluster_ki allocatable memory of the cluster, in Ki
7
- # verifier_memoire_module <module> <minimum_go> [astuce]
8
- # Messages in French. Return 0 when the memory is enough, 2 when it is not or
5
+ # quantity_ki <quantity> Kubernetes quantity in Ki
6
+ # memory_cluster_ki allocatable memory of the cluster, in Ki
7
+ # check_module_memory <module> <minimum_gi> [hint]
8
+ # Messages in English. Return 0 when the memory is enough, 2 when it is not or
9
9
  # when the cluster is unreachable.
10
10
 
11
- # Globals written by memoire_cluster_ki (#612) and read by
12
- # verifier_memoire_module, which calls the function directly: a call written
13
- # memoire="$(memoire_cluster_ki)" would run it in a subshell and lose them.
14
- # Callers that only need the number keep using $(memoire_cluster_ki): the
11
+ # Globals written by memory_cluster_ki (#612) and read by
12
+ # check_module_memory, which calls the function directly: a call written
13
+ # memory="$(memory_cluster_ki)" would run it in a subshell and lose them.
14
+ # Callers that only need the number keep using $(memory_cluster_ki): the
15
15
  # value is still printed on stdout (argocd, gitlab, llm are unaffected).
16
- # MEMOIRE_KI same value as on stdout, in Ki
17
- # MEMOIRE_REGLE "maximum" when every node is a kind node (the nodes share
18
- # one VM), "somme" otherwise
19
- MEMOIRE_KI=""
20
- MEMOIRE_REGLE=""
16
+ # MEMORY_KI same value as on stdout, in Ki
17
+ # MEMORY_RULE "maximum" when every node is a kind node (the nodes share
18
+ # one VM), "sum" otherwise
19
+ MEMORY_KI=""
20
+ MEMORY_RULE=""
21
21
 
22
22
  # Converts a Kubernetes memory quantity (Ki, Mi, Gi, Ti, K, M, G, bytes)
23
23
  # into Ki, to total the allocatable memory of the nodes.
24
- quantite_ki() {
25
- local q="${1:-}" nombre
24
+ quantity_ki() {
25
+ local q="${1:-}" number
26
26
  case "$q" in
27
- *Ki) nombre="${q%Ki}"; echo $((nombre)) ;;
28
- *Mi) nombre="${q%Mi}"; echo $((nombre * 1024)) ;;
29
- *Gi) nombre="${q%Gi}"; echo $((nombre * 1024 * 1024)) ;;
30
- *Ti) nombre="${q%Ti}"; echo $((nombre * 1024 * 1024 * 1024)) ;;
31
- *K | *k) nombre="${q%[Kk]}"; echo $((nombre * 1000 / 1024)) ;;
32
- *M) nombre="${q%M}"; echo $((nombre * 1000 * 1000 / 1024)) ;;
33
- *G) nombre="${q%G}"; echo $((nombre * 1000 * 1000 * 1000 / 1024)) ;;
27
+ *Ki) number="${q%Ki}"; echo $((number)) ;;
28
+ *Mi) number="${q%Mi}"; echo $((number * 1024)) ;;
29
+ *Gi) number="${q%Gi}"; echo $((number * 1024 * 1024)) ;;
30
+ *Ti) number="${q%Ti}"; echo $((number * 1024 * 1024 * 1024)) ;;
31
+ *K | *k) number="${q%[Kk]}"; echo $((number * 1000 / 1024)) ;;
32
+ *M) number="${q%M}"; echo $((number * 1000 * 1000 / 1024)) ;;
33
+ *G) number="${q%G}"; echo $((number * 1000 * 1000 * 1000 / 1024)) ;;
34
34
  *)
35
35
  case "$q" in
36
36
  '' | *[!0-9]*) echo 0 ;;
@@ -46,67 +46,67 @@ quantite_ki() {
46
46
  # line (#612). A kind cluster runs on a single Docker daemon: its nodes share
47
47
  # the memory of one VM and each of them declares the whole VM, so adding them
48
48
  # up lies. When every providerID starts with "kind://" the greatest node
49
- # memory is returned (MEMOIRE_REGLE=maximum); as soon as one node has no such
50
- # prefix or an empty providerID the sum is returned (MEMOIRE_REGLE=somme), as
49
+ # memory is returned (MEMORY_RULE=maximum); as soon as one node has no such
50
+ # prefix or an empty providerID the sum is returned (MEMORY_RULE=sum), as
51
51
  # before. Known limit, documented: k3d and minikube in Docker mode share a VM
52
52
  # too but are not kind, they stay on the sum. A line without the separator
53
53
  # carries the memory alone, so it is a node without providerID (sum).
54
- memoire_cluster_ki() {
55
- local sortie ligne providerID memoire noeud total=0 max=0 n=0 tous_kind=1
56
- MEMOIRE_KI=""
57
- MEMOIRE_REGLE=""
58
- sortie="$(compte_admin "$(compte_ctx)" get nodes \
54
+ memory_cluster_ki() {
55
+ local output line providerID memory node total=0 max=0 n=0 all_kind=1
56
+ MEMORY_KI=""
57
+ MEMORY_RULE=""
58
+ output="$(compte_admin "$(compte_ctx)" get nodes \
59
59
  -o jsonpath='{range .items[*]}{.spec.providerID}{"|"}{.status.allocatable.memory}{"\n"}{end}' 2>/dev/null)" || return 1
60
- [ -n "$sortie" ] || return 1
61
- while IFS= read -r ligne; do
62
- [ -n "$ligne" ] || continue
63
- case "$ligne" in
60
+ [ -n "$output" ] || return 1
61
+ while IFS= read -r line; do
62
+ [ -n "$line" ] || continue
63
+ case "$line" in
64
64
  *'|'*)
65
- providerID="${ligne%%|*}"
66
- memoire="${ligne#*|}"
65
+ providerID="${line%%|*}"
66
+ memory="${line#*|}"
67
67
  ;;
68
68
  *)
69
69
  providerID=""
70
- memoire="$ligne"
70
+ memory="$line"
71
71
  ;;
72
72
  esac
73
- noeud="$(quantite_ki "$memoire")"
74
- total=$((total + noeud))
75
- if [ "$noeud" -gt "$max" ]; then max="$noeud"; fi
73
+ node="$(quantity_ki "$memory")"
74
+ total=$((total + node))
75
+ if [ "$node" -gt "$max" ]; then max="$node"; fi
76
76
  case "$providerID" in
77
77
  kind://*) ;;
78
- *) tous_kind=0 ;;
78
+ *) all_kind=0 ;;
79
79
  esac
80
80
  n=$((n + 1))
81
- done <<<"$sortie"
82
- if [ "$n" -gt 0 ] && [ "$tous_kind" -eq 1 ]; then
83
- MEMOIRE_REGLE="maximum"
84
- MEMOIRE_KI="$max"
81
+ done <<<"$output"
82
+ if [ "$n" -gt 0 ] && [ "$all_kind" -eq 1 ]; then
83
+ MEMORY_RULE="maximum"
84
+ MEMORY_KI="$max"
85
85
  else
86
- MEMOIRE_REGLE="somme"
87
- MEMOIRE_KI="$total"
86
+ MEMORY_RULE="sum"
87
+ MEMORY_KI="$total"
88
88
  fi
89
- echo "$MEMOIRE_KI"
89
+ echo "$MEMORY_KI"
90
90
  }
91
91
 
92
- # Refuses the installation of <module> under <minimum_go> GiB of allocatable
92
+ # Refuses the installation of <module> under <minimum_gi> GiB of allocatable
93
93
  # memory. The message says the minimum, the available memory and how to enlarge
94
- # the cluster; [astuce] adds an optional hint (for example --preset light).
94
+ # the cluster; [hint] adds an optional hint (for example --preset light).
95
95
  # On a kind cluster (#612) the available memory is the one of a single node
96
96
  # and the message says so. Return 0 when the memory is enough, 2 when it is
97
97
  # not or the cluster is unreachable.
98
- verifier_memoire_module() {
99
- local nom_module="$1" minimum_go="$2" astuce="${3:-}" memoire precision=""
100
- if ! memoire_cluster_ki >/dev/null; then
101
- echo "devzone : ${nom_module} : cluster des services injoignable : devzone cluster" >&2
98
+ check_module_memory() {
99
+ local module_name="$1" minimum_gi="$2" hint="${3:-}" memory precision=""
100
+ if ! memory_cluster_ki >/dev/null; then
101
+ echo "devzone : ${module_name} : services cluster unreachable: devzone cluster" >&2
102
102
  return 2
103
103
  fi
104
- memoire="$MEMOIRE_KI"
105
- if [ "$MEMOIRE_REGLE" = "maximum" ]; then
106
- precision=" (mémoire d'un seul nœud : cluster kind, VM partagée)"
104
+ memory="$MEMORY_KI"
105
+ if [ "$MEMORY_RULE" = "maximum" ]; then
106
+ precision=" (memory of a single node: kind cluster, shared VM)"
107
107
  fi
108
- if [ "$memoire" -lt "$((minimum_go * 1048576))" ]; then
109
- echo "devzone : ${nom_module} : il faut au moins ${minimum_go} Go de mémoire allouable dans le cluster (disponible : $((memoire / 1048576)) Go)${precision} ; agrandir le cluster (Docker Desktop → Settings → Resources) puis relancer : devzone enable ${nom_module}${astuce:+ ; astuce : ${astuce}}" >&2
108
+ if [ "$memory" -lt "$((minimum_gi * 1048576))" ]; then
109
+ echo "devzone : ${module_name} : at least ${minimum_gi} GiB of allocatable memory is needed in the cluster (available: $((memory / 1048576)) GiB)${precision} ; enlarge the cluster (Docker Desktop → Settings → Resources) then retry: devzone enable ${module_name}${hint:+ ; hint: ${hint}}" >&2
110
110
  return 2
111
111
  fi
112
112
  return 0