devzone 2.0.0 → 3.0.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 (90) hide show
  1. package/.devcontainer/agent-errors.sh +6 -6
  2. package/.devcontainer/agent-pod-manifest.sh +4 -4
  3. package/.devcontainer/agent-session.sh +2 -2
  4. package/.devcontainer/agent-state-json.sh +2 -2
  5. package/.devcontainer/agent-workspace.sh +1 -1
  6. package/.devcontainer/agent.sh +7 -7
  7. package/.devcontainer/ai/host-models.sh +2 -2
  8. package/.devcontainer/ai/plugins/devzone-guard-v2.js +3 -3
  9. package/.devcontainer/ai/plugins/devzone-guard.js +3 -3
  10. package/.devcontainer/argocd/argocd.sh +90 -89
  11. package/.devcontainer/argocd/catalog-argocd.sh +2 -2
  12. package/.devcontainer/argocd/services-hook.sh +3 -3
  13. package/.devcontainer/argocd/services.sh +1 -1
  14. package/.devcontainer/catalog/app.sh +114 -116
  15. package/.devcontainer/catalog/catalog-watcher.sh +62 -62
  16. package/.devcontainer/catalog/mysql/app.conf +1 -1
  17. package/.devcontainer/catalog/mysql/install.sh +40 -40
  18. package/.devcontainer/catalog/mysql/mysql.sh +141 -141
  19. package/.devcontainer/catalog/mysql/volume.sh +39 -39
  20. package/.devcontainer/catalog.sh +112 -112
  21. package/.devcontainer/chart-direct.sh +1 -1
  22. package/.devcontainer/cluster.sh +216 -218
  23. package/.devcontainer/clusters.sh +41 -41
  24. package/.devcontainer/devzone +92 -1495
  25. package/.devcontainer/devzone-ai-guard.sh +76 -0
  26. package/.devcontainer/devzone-ai.sh +201 -0
  27. package/.devcontainer/devzone-cluster.sh +210 -0
  28. package/.devcontainer/devzone-modules.sh +126 -0
  29. package/.devcontainer/devzone-platform.sh +189 -0
  30. package/.devcontainer/devzone-repair.sh +94 -0
  31. package/.devcontainer/devzone-services.sh +241 -0
  32. package/.devcontainer/devzone-skill.sh +97 -0
  33. package/.devcontainer/devzone-status.sh +140 -0
  34. package/.devcontainer/devzone-version.sh +78 -0
  35. package/.devcontainer/git-identity.sh +28 -0
  36. package/.devcontainer/gitlab/chart.sh +2 -2
  37. package/.devcontainer/gitlab/gitlab.sh +81 -82
  38. package/.devcontainer/gitlab/installation.sh +109 -109
  39. package/.devcontainer/gitlab/secrets.sh +47 -47
  40. package/.devcontainer/gitlab/seed.sh +77 -77
  41. package/.devcontainer/gitlab/test-gitlab.sh +242 -243
  42. package/.devcontainer/help.sh +1 -1
  43. package/.devcontainer/isolation.sh +30 -30
  44. package/.devcontainer/kind-wrapper.sh +17 -17
  45. package/.devcontainer/kube-account.sh +112 -113
  46. package/.devcontainer/kube-config.sh +45 -46
  47. package/.devcontainer/{invite-kube.sh → kube-prompt.sh} +6 -6
  48. package/.devcontainer/kube-reachable.sh +40 -40
  49. package/.devcontainer/memory.sh +1 -1
  50. package/.devcontainer/metrics-server.sh +2 -2
  51. package/.devcontainer/opencode.jsonc +2 -2
  52. package/.devcontainer/packages.sh +136 -135
  53. package/.devcontainer/password.sh +1 -1
  54. package/.devcontainer/ports-auto.sh +152 -153
  55. package/.devcontainer/ports-json.sh +16 -15
  56. package/.devcontainer/ports.sh +126 -122
  57. package/.devcontainer/post-create.sh +52 -52
  58. package/.devcontainer/postgres/postgres.sh +174 -174
  59. package/.devcontainer/rename-legacy-files.sh +103 -0
  60. package/.devcontainer/services-admin.sh +3 -3
  61. package/.devcontainer/skills/devzone/SKILL.md +40 -41
  62. package/.devcontainer/startup.sh +48 -49
  63. package/.devcontainer/state-gitops.sh +1 -1
  64. package/.devcontainer/state-json.sh +36 -62
  65. package/.devcontainer/state.sh +2 -2
  66. package/.devcontainer/workspace-init.sh +16 -2
  67. package/Makefile +1 -1
  68. package/README.md +195 -194
  69. package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
  70. package/manage/devzone +5 -7
  71. package/manage/scripts/argocd-workspace.sh +1 -1
  72. package/manage/scripts/check-names.sh +6 -5
  73. package/manage/scripts/create-cluster.sh +1 -1
  74. package/manage/scripts/create-mode.sh +2 -2
  75. package/manage/scripts/devzone-create.sh +3 -3
  76. package/manage/scripts/devzone-manifest.sh +1 -1
  77. package/manage/scripts/devzone-update.sh +12 -8
  78. package/manage/scripts/launch.sh +7 -48
  79. package/manage/scripts/migrate-revert.sh +3 -3
  80. package/manage/scripts/migrate.sh +7 -13
  81. package/manage/scripts/ports-apps.sh +1 -1
  82. package/manage/scripts/ports-workspace.sh +7 -7
  83. package/manage/scripts/uninstall.sh +8 -8
  84. package/manage/scripts/workspace-egress.sh +2 -2
  85. package/manage/scripts/workspace-update.sh +5 -2
  86. package/manage/scripts/workspace-wait.sh +2 -2
  87. package/package.json +1 -1
  88. package/.devcontainer/docker-relay.sh +0 -149
  89. package/.devcontainer/docker-without-host.sh +0 -12
  90. package/.devcontainer/git-identite.sh +0 -28
@@ -1,71 +1,71 @@
1
1
  #!/usr/bin/env bash
2
- # Volumes MySQL (#440) : choix, liste et suppression des PVC -mysql-0.
2
+ # MySQL volumes (#440): choice, listing and deletion of the -mysql-0 PVCs.
3
3
 
4
- # Liste les PVC du namespace mysql dont le nom finit par -mysql-0
4
+ # Lists the PVCs of the namespace whose name ends with -mysql-0
5
5
  mysql_volumes() {
6
6
  local ns="$1"
7
7
  kubectl --context devzone -n "$ns" get pvc -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' 2>/dev/null |
8
8
  grep -E '\-mysql-0$' || true
9
9
  }
10
10
 
11
- # Préfixe de claim : 1 PVC → son préfixe, 0 → donnees, >1 → refus (code 2)
12
- mysql_claim_choisir() {
13
- local ns="$1" liste nb
14
- liste="$(mysql_volumes "$ns")"
15
- if [ -z "$liste" ]; then echo donnees; return 0; fi
16
- nb="$(printf '%s\n' "$liste" | grep -c .)"
17
- if [ "$nb" -eq 1 ]; then echo "${liste%-mysql-0}"; return 0; fi
18
- echo "devzone : catalogue mysql : plusieurs volumes trouvés :" >&2
19
- printf '%s\n' "$liste" | sed 's/^/ /' >&2
20
- echo "devzone : catalogue mysql : choisir avec devzone mysql volume <nom>" >&2
11
+ # Claim prefix: 1 PVC -> its prefix, 0 -> donnees, >1 -> refusal (code 2)
12
+ mysql_claim_choose() {
13
+ local ns="$1" list count
14
+ list="$(mysql_volumes "$ns")"
15
+ if [ -z "$list" ]; then echo donnees; return 0; fi
16
+ count="$(printf '%s\n' "$list" | grep -c .)"
17
+ if [ "$count" -eq 1 ]; then echo "${list%-mysql-0}"; return 0; fi
18
+ echo "devzone : catalog mysql : several volumes found:" >&2
19
+ printf '%s\n' "$list" | sed 's/^/ /' >&2
20
+ echo "devzone : catalog mysql : choose one with devzone mysql volume <name>" >&2
21
21
  return 2
22
22
  }
23
23
 
24
- # Claim porté par le StatefulSet (vide si absent)
25
- mysql_claim_monte() {
24
+ # Claim carried by the StatefulSet (empty if absent)
25
+ mysql_claim_mounted() {
26
26
  local ns="$1"
27
27
  kubectl --context devzone -n "$ns" get statefulset mysql \
28
28
  -o jsonpath='{.spec.volumeClaimTemplates[0].metadata.name}' 2>/dev/null || true
29
29
  }
30
30
 
31
- # Sous-commande volume : liste ou sélectionne/supprime un PVC
31
+ # volume subcommand: lists, or selects/deletes a PVC
32
32
  mysql_volume() {
33
- local ns="$1" nom="" oui="" supprimer="" arg reponse pvc monte claim
33
+ local ns="$1" name="" yes="" delete="" arg answer pvc mounted claim
34
34
  shift
35
35
  for arg in "$@"; do
36
36
  case "$arg" in
37
- --delete) supprimer=1 ;;
38
- --yes) oui=1 ;;
39
- *) nom="$arg" ;;
37
+ --delete) delete=1 ;;
38
+ --yes) yes=1 ;;
39
+ *) name="$arg" ;;
40
40
  esac
41
41
  done
42
- if [ -n "$supprimer" ]; then
43
- [ -n "$nom" ] || refuse "volume --delete : nom manquant"
44
- pvc="$nom"
42
+ if [ -n "$delete" ]; then
43
+ [ -n "$name" ] || refuse "volume --delete: missing name"
44
+ pvc="$name"
45
45
  [[ "$pvc" == *-mysql-0 ]] || pvc="$pvc-mysql-0"
46
- monte="$(mysql_claim_monte "$ns")"
47
- [ "${pvc%-mysql-0}" != "$monte" ] || refuse "volume monté, suppression refusée : $nom"
48
- if [ -z "$oui" ]; then
49
- cluster_interactif || refuse "confirmation impossible sans terminal : devzone mysql volume --delete $nom --yes"
50
- printf 'Supprimer le volume %s ? [o/N] ' "$pvc" >&2
51
- read -r reponse || reponse=""
52
- case "$reponse" in
53
- o | O | oui) ;;
54
- *) echo "Abandon : rien n'a été supprimé."; return 0 ;;
46
+ mounted="$(mysql_claim_mounted "$ns")"
47
+ [ "${pvc%-mysql-0}" != "$mounted" ] || refuse "mounted volume, deletion refused: $name"
48
+ if [ -z "$yes" ]; then
49
+ cluster_interactive || refuse "confirmation needs a terminal: devzone mysql volume --delete $name --yes"
50
+ printf 'Delete volume %s? [y/N] ' "$pvc" >&2
51
+ read -r answer || answer=""
52
+ case "$answer" in
53
+ y | Y | yes) ;;
54
+ *) echo "Aborted: nothing was deleted."; return 0 ;;
55
55
  esac
56
56
  fi
57
57
  kubectl --context devzone -n "$ns" delete pvc "$pvc" >/dev/null
58
- echo "✔ volume $pvc supprimé"
58
+ echo "✔ volume $pvc deleted"
59
59
  return 0
60
60
  fi
61
- if [ -z "$nom" ]; then
62
- monte="$(mysql_claim_monte "$ns")"
63
- mysql_volumes "$ns" | awk -v m="$monte-mysql-0" 'NF { mark = ($0 == m) ? " (monté)" : ""; printf " %s%s\n", $0, mark; n++ } END { if (!n) print " (aucun volume)" }'
61
+ if [ -z "$name" ]; then
62
+ mounted="$(mysql_claim_mounted "$ns")"
63
+ mysql_volumes "$ns" | awk -v m="$mounted-mysql-0" 'NF { mark = ($0 == m) ? " (mounted)" : ""; printf " %s%s\n", $0, mark; n++ } END { if (!n) print " (no volume)" }'
64
64
  return 0
65
65
  fi
66
- contexte >/dev/null
67
- installe || refuse "module inactif : devzone enable mysql"
68
- claim="$nom"
66
+ module_context >/dev/null
67
+ installed || refuse "module disabled: devzone enable mysql"
68
+ claim="$name"
69
69
  [[ "$claim" == *-mysql-0 ]] && claim="${claim%-mysql-0}"
70
- mysql_installer_claim "$ns" "$claim"
70
+ mysql_install_claim "$ns" "$claim"
71
71
  }
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env bash
2
- # Catalogue d'applications (#414) : une application préconfigurée par dossier
3
- # .devcontainer/catalog/<app>/ (app.conf ; le chart charts/devzone-<app>, #559), installée dans le
4
- # cluster des services de devzone sous son namespace de app.conf ; l'état
5
- # voulu est la ligne <app>=on|off de .devzone.modules.
2
+ # Application catalog (#414): one preconfigured application per folder
3
+ # .devcontainer/catalog/<app>/ (app.conf; the chart charts/devzone-<app>, #559),
4
+ # installed in the devzone services cluster under the namespace of its app.conf;
5
+ # the wanted state is the line <app>=on|off of .devzone.modules.
6
6
  # catalog.sh sync | apply | list | resume | json | remove <app>
7
7
  set -euo pipefail
8
8
 
9
9
  ICI="$(cd "$(dirname "$0")" && pwd)"
10
- RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
11
- ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
10
+ RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
11
+ ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
12
12
  # shellcheck source=SCRIPTDIR/cluster.sh
13
13
  # shellcheck disable=SC1091
14
14
  . "$ICI/cluster.sh"
@@ -25,38 +25,38 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
25
25
  # shellcheck disable=SC1091
26
26
  . "$ICI/catalog/app.sh"
27
27
 
28
- refuse() { echo "devzone : catalogue : $*" >&2; exit 2; }
28
+ refuse() { echo "devzone : catalog : $*" >&2; exit 2; }
29
29
 
30
- # Dossier du catalogue (surchargeable par les tests)
31
- dossier_catalogue() { echo "${DEVZONE_CATALOGUE:-$ICI/catalog}"; }
30
+ # Catalog folder (overridable by the tests)
31
+ catalog_dir() { echo "${DEVZONE_CATALOG:-$ICI/catalog}"; }
32
32
 
33
- # Applications du catalogue : dossiers pourvus d'un app.conf, triés
34
- catalogue_apps() {
33
+ # Catalog applications: folders holding an app.conf, sorted
34
+ catalog_apps() {
35
35
  local d
36
- for d in "$(dossier_catalogue)"/*; do
36
+ for d in "$(catalog_dir)"/*; do
37
37
  [ -f "$d/app.conf" ] || continue
38
38
  echo "${d##*/}"
39
39
  done | LC_ALL=C sort
40
40
  }
41
41
 
42
- # Clé de app.conf (nom, description, image, port, mémoire, taille, namespace)
43
- app_lire() {
44
- grep -E "^$2=" "$(dossier_catalogue)/$1/app.conf" 2>/dev/null | tail -1 | cut -d= -f2- || true
42
+ # app.conf key (name, description, image, port, memoire, taille, namespace)
43
+ app_read() {
44
+ grep -E "^$2=" "$(catalog_dir)/$1/app.conf" 2>/dev/null | tail -1 | cut -d= -f2- || true
45
45
  }
46
46
 
47
- # Namespace de l'application : celui de app.conf (requis)
48
- app_ns() {
47
+ # Application namespace: the one of app.conf (required)
48
+ app_namespace() {
49
49
  local ns
50
- ns="$(app_lire "$1" namespace)"
51
- [ -n "$ns" ] || refuse "namespace manquant dans app.conf de $1"
50
+ ns="$(app_read "$1" namespace)"
51
+ [ -n "$ns" ] || refuse "missing namespace in app.conf of $1"
52
52
  echo "$ns"
53
53
  }
54
54
 
55
- # Marque d'échec d'une application : même schéma que fichier_echec des modules
56
- fichier_echec() { echo "$ETAT-echec-$1"; }
55
+ # Failure marker of an application: same scheme as the failure file of the modules
56
+ failure_file() { echo "$ETAT-failed-$1"; }
57
57
 
58
- # État voulu : on si la ligne <app>=on existe, off par défaut
59
- voulu() {
58
+ # Wanted state: on if the line <app>=on exists, off by default
59
+ wanted() {
60
60
  local v
61
61
  v="$(grep -E "^$1=" "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true)"
62
62
  [ "$v" = on ] && echo on || echo off
@@ -66,166 +66,166 @@ voulu() {
66
66
  # service resolves in the cluster DNS (no RBAC needed, #515). Elsewhere: labelled
67
67
  # namespace and StatefulSet of the app name; reading the namespaces is reserved
68
68
  # to the administrator (#430). Nothing without a chosen cluster or when absent.
69
- presente() {
69
+ present() {
70
70
  local ctx ns
71
- ns="$(app_ns "$1")"
71
+ ns="$(app_namespace "$1")"
72
72
  if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
73
73
  # In the pod there is no kubeconfig and the limited service account
74
74
  # cannot list StatefulSets (#430): presence is the cluster DNS
75
75
  # resolving the service, no RBAC needed, the pod service account
76
76
  # stays limited
77
- getent hosts "$(app_lire "$1" nom).${ns}.svc" >/dev/null 2>&1
77
+ getent hosts "$(app_read "$1" name).${ns}.svc" >/dev/null 2>&1
78
78
  return
79
79
  fi
80
- ctx="$(cluster_lu)"
80
+ ctx="$(cluster_saved)"
81
81
  [ -n "$ctx" ] || return 1
82
- compte_admin "$ctx" get namespace "$ns" >/dev/null 2>&1 &&
82
+ account_admin "$ctx" get namespace "$ns" >/dev/null 2>&1 &&
83
83
  kubectl --context devzone -n "$ns" get statefulset "$1" >/dev/null 2>&1
84
84
  }
85
85
 
86
- # Application prête : le StatefulSet compte une réplique prête
87
- app_prete() {
86
+ # Application ready: the StatefulSet has one ready replica
87
+ app_ready() {
88
88
  local ns
89
- ns="$(app_ns "$1")"
89
+ ns="$(app_namespace "$1")"
90
90
  [ "$(kubectl --context devzone -n "$ns" get statefulset "$1" \
91
91
  -o jsonpath='{.status.readyReplicas}' 2>/dev/null || true)" = 1 ]
92
92
  }
93
93
 
94
- # Ajoute à l'état les lignes <app>=off des applications absentes (une fois
95
- # chacune, jamais une ligne existante modifiée), précédées une fois du
96
- # commentaire ; la lecture et l'écriture tiennent le même verrou (#417) :
97
- # une écriture concurrente ne peut pas être perdue entre les deux
98
- catalogue_synchroniser() (
99
- local app entete manque="" tmp
94
+ # Adds to the state the <app>=off lines of the absent applications (once each,
95
+ # an existing line is never changed), preceded once by the comment; reading and
96
+ # writing hold the same lock (#417): a concurrent write cannot be lost between the two
97
+ catalog_sync() (
98
+ local app header missing="" tmp
100
99
  [ -f "$ETAT" ] || return 0
101
- entete="# Applications du catalogue : passer à on pour installer (devzone catalog)"
100
+ header="# Catalog applications: set to on to install (devzone catalog)"
102
101
  state_lock_take || return 1
103
- # Le verrou est rendu à la sortie, y compris sur une erreur sous set -e
102
+ # The lock is released on exit, including on an error under set -e
104
103
  trap 'state_lock_release' EXIT
105
104
  while IFS= read -r app; do
106
105
  [ -n "$app" ] || continue
107
106
  grep -qE "^${app}=" "$ETAT" 2>/dev/null && continue
108
- manque="${manque}${manque:+$'\n'}${app}=off"
109
- done <<<"$(catalogue_apps)"
110
- [ -n "$manque" ] || return 0
107
+ missing="${missing}${missing:+$'\n'}${app}=off"
108
+ done <<<"$(catalog_apps)"
109
+ [ -n "$missing" ] || return 0
111
110
  tmp="$(mktemp)"
112
111
  {
113
112
  cat "$ETAT"
114
- grep -qF "$entete" "$ETAT" || echo "$entete"
115
- echo "$manque"
113
+ grep -qF -e "$header" "$ETAT" || echo "$header"
114
+ echo "$missing"
116
115
  } >"$tmp"
117
116
  state_replace "$tmp"
118
117
  rm -f "$tmp"
119
118
  )
120
119
 
121
- # État réel d'une application : disponible, attendue, installée, echec
122
- app_etat() {
120
+ # Real state of an application: available, expected, installed, failed. These
121
+ # values are the etat field of devzone status --json: keep them
122
+ app_state() {
123
123
  local app="$1"
124
- if [ "$(voulu "$app")" != on ]; then
125
- echo disponible
126
- elif [ -f "$(fichier_echec "$app")" ]; then
127
- echo echec
128
- elif presente "$app"; then
129
- echo installée
124
+ if [ "$(wanted "$app")" != on ]; then
125
+ echo available
126
+ elif [ -f "$(failure_file "$app")" ]; then
127
+ echo failed
128
+ elif present "$app"; then
129
+ echo installed
130
130
  else
131
- echo attendue
131
+ echo expected
132
132
  fi
133
133
  }
134
134
 
135
- # devzone catalog : nom, état (off, on installée, on en échec), description
136
- catalogue_lister() {
137
- local app etat etiquette
135
+ # devzone catalog: name, state (off, on installed, on failed), description
136
+ catalog_list() {
137
+ local app state label
138
138
  while IFS= read -r app; do
139
139
  [ -n "$app" ] || continue
140
- etat="$(app_etat "$app")"
141
- case "$etat" in
142
- disponible) etiquette='off disponible' ;;
143
- installée) etiquette="on installée" ;;
144
- echec) etiquette="on en échec" ;;
145
- *) etiquette="on attendue" ;;
140
+ state="$(app_state "$app")"
141
+ case "$state" in
142
+ available) label='off available' ;;
143
+ installed) label='on installed' ;;
144
+ failed) label='on failed' ;;
145
+ *) label='on expected' ;;
146
146
  esac
147
- printf ' %-12s %-14s %s\n' "$app" "$etiquette" "$(app_lire "$app" description)"
148
- done <<<"$(catalogue_apps)"
147
+ printf ' %-12s %-14s %s\n' "$app" "$label" "$(app_read "$app" description)"
148
+ done <<<"$(catalog_apps)"
149
149
  }
150
150
 
151
- # Relais de l application installee : etat de son script, sinon pid du relais
152
- app_relais_arrete() {
153
- local app="$1" script etat
151
+ # Relay of the installed application: state of its script, else the relay pid
152
+ app_relay_stopped() {
153
+ local app="$1" script state
154
154
  if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
155
155
  # In the pod, no relay: the access goes through the workspace ports
156
156
  return 1
157
157
  fi
158
158
  script="$ICI/catalog/$app/$app.sh"
159
159
  if [ -f "$script" ]; then
160
- etat="$(bash "$script" status 2>/dev/null || true)"
161
- case "$etat" in *"relais arrêté"*) return 0 ;; esac
160
+ state="$(bash "$script" status 2>/dev/null || true)"
161
+ case "$state" in *"relay stopped"*) return 0 ;; esac
162
162
  fi
163
- ! relais_actif "$app"
163
+ ! relay_active "$app"
164
164
  }
165
165
 
166
- # Lignes Applications du récapitulatif de devzone : ○ disponible, ✔ installée
167
- # (adresse du relais), ✖ en échec, ⚠ attendue
168
- catalogue_resume() {
166
+ # Application lines of devzone's summary: ○ available, ✔ installed (relay
167
+ # address), ✖ failed, ⚠ expected
168
+ catalog_summary() {
169
169
  local app
170
170
  while IFS= read -r app; do
171
171
  [ -n "$app" ] || continue
172
- case "$(app_etat "$app")" in
173
- disponible) printf ' ○ application %-12s disponible, %s : devzone enable %s\n' \
174
- "$app" "$(app_lire "$app" description)" "$app" ;;
175
- installée)
176
- if app_relais_arrete "$app"; then
177
- printf ' ⚠ application %-12s installée, relais arrêté : devzone repair\n' "$app"
172
+ case "$(app_state "$app")" in
173
+ available) printf ' ○ application %-12s available, %s: devzone enable %s\n' \
174
+ "$app" "$(app_read "$app" description)" "$app" ;;
175
+ installed)
176
+ if app_relay_stopped "$app"; then
177
+ printf ' ⚠ application %-12s installed, relay stopped: devzone repair\n' "$app"
178
178
  else
179
179
  if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
180
- printf ' ✔ application %-12s installée : local access: devzone workspace ports\n' "$app"
180
+ printf ' ✔ application %-12s installed: local access: devzone workspace ports\n' "$app"
181
181
  else
182
- printf ' ✔ application %-12s installée : 127.0.0.1:%s\n' \
183
- "$app" "$(app_lire "$app" port)"
182
+ printf ' ✔ application %-12s installed: 127.0.0.1:%s\n' \
183
+ "$app" "$(app_read "$app" port)"
184
184
  fi
185
185
  fi ;;
186
- attendue) printf ' ⚠ application %-12s attendue : devzone apply\n' "$app" ;;
187
- *) printf ' ✖ application %s en échec : %s : devzone apply\n' \
188
- "$app" "$(head -1 "$(fichier_echec "$app")")" ;;
186
+ expected) printf ' ⚠ application %-12s expected: devzone apply\n' "$app" ;;
187
+ *) printf ' ✖ application %s failed: %s: devzone apply\n' \
188
+ "$app" "$(head -1 "$(failure_file "$app")")" ;;
189
189
  esac
190
- done <<<"$(catalogue_apps)"
191
- app_mysql_volumes_inutilises 2>/dev/null || true
190
+ done <<<"$(catalog_apps)"
191
+ app_unused_mysql_volumes 2>/dev/null || true
192
192
  }
193
193
 
194
- # Rubrique applications de devzone status --json : mêmes champs que modules
195
- catalogue_json() {
196
- local app actif etat echec cmd json='[]'
194
+ # Applications section of devzone status --json: same fields as the modules
195
+ catalog_json() {
196
+ local app active state failure cmd json='[]'
197
197
  while IFS= read -r app; do
198
198
  [ -n "$app" ] || continue
199
- actif=false
200
- [ "$(voulu "$app")" = on ] && actif=true
201
- etat="$(app_etat "$app")"
202
- echec=""
199
+ active=false
200
+ [ "$(wanted "$app")" = on ] && active=true
201
+ state="$(app_state "$app")"
202
+ failure=""
203
203
  cmd="devzone apply"
204
- case "$etat" in
205
- disponible) cmd="devzone enable $app" ;;
206
- installée) cmd="devzone disable $app" ;;
207
- echec) echec="$(head -1 "$(fichier_echec "$app")")" ;;
204
+ case "$state" in
205
+ available) cmd="devzone enable $app" ;;
206
+ installed) cmd="devzone disable $app" ;;
207
+ failed) failure="$(head -1 "$(failure_file "$app")")" ;;
208
208
  esac
209
- json="$(jq -cn --argjson avant "$json" --arg nom "$app" --argjson actif "$actif" \
210
- --arg description "$(app_lire "$app" description)" \
211
- --arg etat "$etat" --arg port "$(app_lire "$app" port)" \
212
- --arg echec "$echec" --arg commande "$cmd" \
213
- '$avant + [{nom:$nom,actif:$actif,description:$description,port:$port,etat:$etat,echec:(if $echec=="" then null else $echec end),commande:(if $commande=="" then null else $commande end)}]')"
214
- done <<<"$(catalogue_apps)"
209
+ json="$(jq -cn --argjson before "$json" --arg name "$app" --argjson active "$active" \
210
+ --arg description "$(app_read "$app" description)" \
211
+ --arg state "$state" --arg port "$(app_read "$app" port)" \
212
+ --arg failure "$failure" --arg command "$cmd" \
213
+ '$before + [{name:$name,active:$active,description:$description,port:$port,state:$state,failed:(if $failure=="" then null else $failure end),command:(if $command=="" then null else $command end)}]')"
214
+ done <<<"$(catalog_apps)"
215
215
  printf '%s\n' "$json"
216
216
  }
217
217
 
218
218
  case "${1:-}" in
219
- sync) catalogue_synchroniser ;;
220
- apply) catalogue_appliquer ;;
221
- list) catalogue_lister ;;
222
- resume) catalogue_resume ;;
223
- json) catalogue_json ;;
224
- # Retrait d'une application : StatefulSet et service, volume gardé (#441)
225
- remove) app_desinstaller "$2" ;;
219
+ sync) catalog_sync ;;
220
+ apply) catalog_apply ;;
221
+ list) catalog_list ;;
222
+ resume) catalog_summary ;;
223
+ json) catalog_json ;;
224
+ # Removal of an application: StatefulSet and service, volume kept (#441)
225
+ remove) app_remove "$2" ;;
226
226
  -h | --help | aide) sed -n '2,6p' "$0" | sed 's/^# \{0,1\}//' ;;
227
227
  *)
228
- echo "devzone : catalogue : sync | apply | list | resume | json | remove <app>" >&2
228
+ echo "devzone : catalog : sync | apply | list | resume | json | remove <app>" >&2
229
229
  exit 1
230
230
  ;;
231
231
  esac
@@ -33,7 +33,7 @@ chart_install() {
33
33
  shift 2
34
34
  chart="$CHART_CODE/charts/devzone-$svc"
35
35
  if [ ! -f "$chart/Chart.yaml" ]; then
36
- echo "✖ $svc : chart charts/devzone-$svc missing (manage/docs/reference.md#charts-de-devzone)" >&2
36
+ echo "✖ $svc : chart charts/devzone-$svc missing (manage/docs/reference.md#devzone-charts)" >&2
37
37
  return 2
38
38
  fi
39
39
  sets=()