devzone 2.0.0 → 4.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 (100) 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/command-aliases.sh +17 -8
  25. package/.devcontainer/devzone +93 -1496
  26. package/.devcontainer/devzone-ai-guard.sh +76 -0
  27. package/.devcontainer/devzone-ai.sh +201 -0
  28. package/.devcontainer/devzone-cluster.sh +210 -0
  29. package/.devcontainer/devzone-modules.sh +126 -0
  30. package/.devcontainer/devzone-platform.sh +189 -0
  31. package/.devcontainer/devzone-repair.sh +94 -0
  32. package/.devcontainer/devzone-services.sh +241 -0
  33. package/.devcontainer/devzone-skill.sh +97 -0
  34. package/.devcontainer/devzone-status.sh +140 -0
  35. package/.devcontainer/devzone-version.sh +78 -0
  36. package/.devcontainer/git-identity.sh +28 -0
  37. package/.devcontainer/gitlab/chart.sh +2 -2
  38. package/.devcontainer/gitlab/gitlab.sh +81 -82
  39. package/.devcontainer/gitlab/installation.sh +109 -109
  40. package/.devcontainer/gitlab/secrets.sh +47 -47
  41. package/.devcontainer/gitlab/seed.sh +77 -77
  42. package/.devcontainer/gitlab/test-gitlab.sh +242 -243
  43. package/.devcontainer/help.sh +1 -1
  44. package/.devcontainer/isolation.sh +30 -30
  45. package/.devcontainer/kind-wrapper.sh +17 -17
  46. package/.devcontainer/kube-account.sh +112 -113
  47. package/.devcontainer/kube-config.sh +45 -46
  48. package/.devcontainer/{invite-kube.sh → kube-prompt.sh} +6 -6
  49. package/.devcontainer/kube-reachable.sh +40 -40
  50. package/.devcontainer/memory.sh +1 -1
  51. package/.devcontainer/metrics-server.sh +2 -2
  52. package/.devcontainer/opencode.jsonc +2 -2
  53. package/.devcontainer/packages.sh +136 -135
  54. package/.devcontainer/password.sh +1 -1
  55. package/.devcontainer/ports-auto.sh +152 -153
  56. package/.devcontainer/ports-json.sh +16 -15
  57. package/.devcontainer/ports.sh +126 -122
  58. package/.devcontainer/post-create.sh +52 -52
  59. package/.devcontainer/postgres/postgres.sh +174 -174
  60. package/.devcontainer/rename-legacy-files.sh +103 -0
  61. package/.devcontainer/services-admin.sh +3 -3
  62. package/.devcontainer/skills/devzone/SKILL.md +40 -41
  63. package/.devcontainer/startup.sh +48 -49
  64. package/.devcontainer/state-gitops.sh +1 -1
  65. package/.devcontainer/state-json.sh +36 -62
  66. package/.devcontainer/state.sh +2 -2
  67. package/.devcontainer/workspace-init.sh +16 -2
  68. package/Makefile +1 -1
  69. package/README.md +191 -195
  70. package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
  71. package/manage/devzone +7 -11
  72. package/manage/scripts/argocd-workspace.sh +1 -1
  73. package/manage/scripts/{check-charts.sh → ci/check-charts.sh} +1 -1
  74. package/manage/scripts/{check-english.sh → ci/check-english.sh} +1 -1
  75. package/manage/scripts/{check-go-layout.sh → ci/check-go-layout.sh} +1 -1
  76. package/manage/scripts/{check-names.sh → ci/check-names.sh} +7 -6
  77. package/manage/scripts/{check-utf8-vars.sh → ci/check-utf8-vars.sh} +1 -1
  78. package/manage/scripts/{versions.sh → ci/versions.sh} +8 -8
  79. package/manage/scripts/create-cluster.sh +1 -1
  80. package/manage/scripts/create-mode.sh +11 -18
  81. package/manage/scripts/devzone-create.sh +7 -35
  82. package/manage/scripts/devzone-manifest.sh +1 -1
  83. package/manage/scripts/devzone-update.sh +12 -8
  84. package/manage/scripts/launch.sh +7 -48
  85. package/manage/scripts/ports-apps.sh +1 -1
  86. package/manage/scripts/ports-workspace.sh +7 -7
  87. package/manage/scripts/poste.sh +6 -7
  88. package/manage/scripts/uninstall.sh +8 -8
  89. package/manage/scripts/workspace-egress.sh +2 -2
  90. package/manage/scripts/workspace-update.sh +5 -2
  91. package/manage/scripts/workspace-wait.sh +2 -2
  92. package/manage/workspace.sh +2 -12
  93. package/package.json +1 -1
  94. package/.devcontainer/docker-relay.sh +0 -149
  95. package/.devcontainer/docker-without-host.sh +0 -12
  96. package/.devcontainer/git-identite.sh +0 -28
  97. package/manage/scripts/docker-workstation.sh +0 -73
  98. package/manage/scripts/migrate-revert.sh +0 -60
  99. package/manage/scripts/migrate.sh +0 -243
  100. /package/manage/scripts/{ci-dns.sh → ci/ci-dns.sh} +0 -0
@@ -35,10 +35,10 @@ cause_label() {
35
35
  esac
36
36
  }
37
37
 
38
- # Duration of an exclusion in seconds: country 7 days (DEVZONE_AGENT_ECART_PAYS), the others 1 h.
38
+ # Duration of an exclusion in seconds: country 7 days (DEVZONE_AGENT_COUNTRY_EXCLUSION), the others 1 h.
39
39
  exclusion_duration() {
40
40
  case "$1" in
41
- pays) echo "${DEVZONE_AGENT_ECART_PAYS:-604800}" ;;
41
+ pays) echo "${DEVZONE_AGENT_COUNTRY_EXCLUSION:-604800}" ;;
42
42
  *) echo 3600 ;;
43
43
  esac
44
44
  }
@@ -78,18 +78,18 @@ network_reachable() {
78
78
  getent hosts opencode.ai >/dev/null 2>&1 && curl -sI --max-time 5 https://opencode.ai >/dev/null 2>&1
79
79
  }
80
80
 
81
- # Waits for the network to come back: a try every DEVZONE_AGENT_RESEAU_PAS s, for
82
- # DEVZONE_AGENT_RESEAU_MAX s at most. Returns 0 when it is back.
81
+ # Waits for the network to come back: a try every DEVZONE_AGENT_NETWORK_STEP s, for
82
+ # DEVZONE_AGENT_NETWORK_MAX s at most. Returns 0 when it is back.
83
83
  network_wait() {
84
84
  local end
85
- end=$(( $(date +%s) + ${DEVZONE_AGENT_RESEAU_MAX:-1800} ))
85
+ end=$(( $(date +%s) + ${DEVZONE_AGENT_NETWORK_MAX:-1800} ))
86
86
  echo "=== network down, waiting" >>"$AGENT_JOURNAL"
87
87
  while [ "$(date +%s)" -lt "$end" ]; do
88
88
  if network_reachable; then
89
89
  echo "=== network back" >>"$AGENT_JOURNAL"
90
90
  return 0
91
91
  fi
92
- sleep "${DEVZONE_AGENT_RESEAU_PAS:-30}"
92
+ sleep "${DEVZONE_AGENT_NETWORK_STEP:-30}"
93
93
  done
94
94
  return 1
95
95
  }
@@ -12,8 +12,8 @@ DEVZONE_AGENT_POD_CPU_LIMIT="${DEVZONE_AGENT_POD_CPU_LIMIT:-2}"
12
12
  DEVZONE_AGENT_POD_MEM_LIMIT="${DEVZONE_AGENT_POD_MEM_LIMIT:-4Gi}"
13
13
  DEVZONE_AGENT_POD_TIMEOUT="${DEVZONE_AGENT_POD_TIMEOUT:-$((DEVZONE_AGENT_POD_ACTIVE_DEADLINE_SECONDS + 120))}"
14
14
  # Projects root, read by the launcher only (no trailing slash). The pod keeps
15
- # /workspaces/projets in its own environment (DEVZONE_RACINE in the manifest).
16
- AGENT_POD_ROOT="${DEVZONE_RACINE:-/workspaces/projets}"
15
+ # /workspaces/projets in its own environment (DEVZONE_ROOT in the manifest).
16
+ AGENT_POD_ROOT="${DEVZONE_ROOT:-/workspaces/projets}"
17
17
  # Module state file on the workspace volume (subPath .devzone.modules, read-only in the pod).
18
18
  # shellcheck disable=SC2034 # read by agent-pod.sh
19
19
  AGENT_POD_MODULES_FILE="${DEVZONE_AGENT_POD_MODULES_FILE:-${AGENT_POD_ROOT}/.devzone.modules}"
@@ -193,7 +193,7 @@ agent_pod_build_manifest() {
193
193
  printf '%s\n' " value: \"${ws_path}\""
194
194
  printf '%s\n' " - name: DEVZONE_WORKSPACE"
195
195
  printf '%s\n' " value: \"kubernetes\""
196
- printf '%s\n' " - name: DEVZONE_RACINE"
196
+ printf '%s\n' " - name: DEVZONE_ROOT"
197
197
  printf '%s\n' " value: \"/workspaces/projets\""; agent_pod_egress_manifest_lines "$egress_mode"
198
198
  printf '%s\n' " resources:"
199
199
  printf '%s\n' " limits:"
@@ -230,7 +230,7 @@ agent_pod_build_manifest() {
230
230
  printf '%s\n' " mountPath: /workspaces/projets/workspace"
231
231
  printf '%s\n' " command: [\"/bin/bash\", \"-lc\"]"
232
232
  printf '%s\n' " args:"
233
- printf '%s\n' " - 'devzone agent --local ${folder} /agent-consigne/consigne.md; code=\$?; cat \"\$DEVZONE_RACINE/workspace/.agents/${AGENT_POD_SESSION_LABEL}.log\" 2>/dev/null; exit \$code'"
233
+ printf '%s\n' " - 'devzone agent --local ${folder} /agent-consigne/consigne.md; code=\$?; cat \"\$DEVZONE_ROOT/workspace/.agents/${AGENT_POD_SESSION_LABEL}.log\" 2>/dev/null; exit \$code'"
234
234
  printf '%s\n' " volumes:"
235
235
  printf '%s\n' " - name: workspace"
236
236
  printf '%s\n' " persistentVolumeClaim:"
@@ -47,7 +47,7 @@ lock_trace() {
47
47
  # which of the two launches succeeded in mkdir.
48
48
  lock_take() {
49
49
  local end age lock_pid
50
- end=$(( $(date +%s) + ${DEVZONE_AGENT_VERROU_MAX:-10} ))
50
+ end=$(( $(date +%s) + ${DEVZONE_AGENT_LOCK_MAX:-10} ))
51
51
  while ! mkdir "$AGENT_ETAT/verrou" 2>/dev/null; do
52
52
  # A lock is orphaned only by its age: the rank is held for a few milliseconds,
53
53
  # 30 s can only be a stop to take over; otherwise wait, then give up (code 1).
@@ -73,7 +73,7 @@ lock_take() {
73
73
  if command -v flock >/dev/null 2>&1; then
74
74
  # exec in an if makes a failure a condition instead of killing the shell
75
75
  # (bash 3.2 and GNU alike); without flock, mkdir remains the only guard (macOS).
76
- if { exec 9>"$AGENT_ETAT/rang.lock"; } && flock -w "${DEVZONE_AGENT_VERROU_MAX:-10}" 9; then
76
+ if { exec 9>"$AGENT_ETAT/rang.lock"; } && flock -w "${DEVZONE_AGENT_LOCK_MAX:-10}" 9; then
77
77
  AGENT_LOCK_FLOCK=1
78
78
  else
79
79
  lock_release
@@ -14,7 +14,7 @@ while [ -L "$SOURCE" ]; do
14
14
  esac
15
15
  done
16
16
  ICI="$(cd -P "$(dirname "$SOURCE")" && pwd)"
17
- RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
17
+ RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
18
18
 
19
19
  # shellcheck source=agent-errors.sh
20
20
  # shellcheck disable=SC1091
@@ -26,7 +26,7 @@ RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
26
26
  # shellcheck disable=SC1091
27
27
  . "$ICI/agent-session.sh"
28
28
 
29
- AGENT_ETAT="${DEVZONE_AGENT_ETAT:-$HOME/.local/state/oc-lancer}"
29
+ AGENT_ETAT="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
30
30
 
31
31
  # UTC ISO-8601 date of an epoch, GNU then BSD date: the fin field of the exclusions.
32
32
  iso() {
@@ -73,7 +73,7 @@ agent_workspace() {
73
73
  echo "devzone agent: Kubernetes workspace (pod devzone-workspace-0, $in_pod); --local for the container"
74
74
  agent_kc cp "$brief" "devzone-workspace-0:/tmp/devzone-agent-$name.md" -c workspace
75
75
  # shellcheck disable=SC2016 # the pod shell expands MODEL_OPT, not this one
76
- agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_RACINE="$pod_root" MODEL_OPT="$MODELE_LISTE" bash -lc 'devzone agent ${MODEL_OPT:+--modele "$MODEL_OPT"} "$1" "$2"' _ "$in_pod" "/tmp/devzone-agent-$name.md" || code=$?
76
+ agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_ROOT="$pod_root" MODEL_OPT="$MODELE_LISTE" bash -lc 'devzone agent ${MODEL_OPT:+--modele "$MODEL_OPT"} "$1" "$2"' _ "$in_pod" "/tmp/devzone-agent-$name.md" || code=$?
77
77
  journal="$(journal_of "$name")"
78
78
  mkdir -p "$(dirname "$journal")"
79
79
  if ! agent_kc exec devzone-workspace-0 -c workspace -- cat "$pod_root/workspace/.agents/$name.log" >>"$journal"; then
@@ -15,7 +15,7 @@ while [ -L "$SOURCE" ]; do
15
15
  esac
16
16
  done
17
17
  ICI="$(cd -P "$(dirname "$SOURCE")" && pwd)"
18
- RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
18
+ RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
19
19
  # shellcheck source=agent-errors.sh disable=SC1091
20
20
  . "$ICI/agent-errors.sh"
21
21
  # shellcheck source=agent-rights.sh disable=SC1091
@@ -34,12 +34,12 @@ FREE_MODELS=(big-pickle deepseek-v4.1-flash-free hy4-flash-free nemotron-3.5-sup
34
34
  # shellcheck source=agent-pod.sh disable=SC1091
35
35
  . "$ICI/agent-pod.sh"
36
36
  SILENCE="${DEVZONE_AGENT_SILENCE:-45}"
37
- FROZEN="${DEVZONE_AGENT_FIGEE:-600}"
38
- AGENT_ETAT="${DEVZONE_AGENT_ETAT:-$HOME/.local/state/oc-lancer}"
37
+ FROZEN="${DEVZONE_AGENT_FROZEN:-600}"
38
+ AGENT_ETAT="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
39
39
  # Pause between read and write of the rank (tests only): active only when
40
- # DEVZONE_AGENT_PAUSE_RANG is set under bats; never a pause by default.
40
+ # DEVZONE_AGENT_PAUSE_RANK is set under bats; never a pause by default.
41
41
  PAUSE_RANK=0
42
- if [ -n "${DEVZONE_AGENT_PAUSE_RANG:-}" ] && [ -n "${BATS_TEST_TMPDIR:-}" ]; then PAUSE_RANK="$DEVZONE_AGENT_PAUSE_RANG"; fi
42
+ if [ -n "${DEVZONE_AGENT_PAUSE_RANK:-}" ] && [ -n "${BATS_TEST_TMPDIR:-}" ]; then PAUSE_RANK="$DEVZONE_AGENT_PAUSE_RANK"; fi
43
43
  # Retries of the same session for a network cause, per model, before the next model
44
44
  NETWORK_RETRIES=3
45
45
  refuse() { echo "devzone agent: $*" >&2; exit 2; }
@@ -104,7 +104,7 @@ agent_launch() {
104
104
  if [ "$(error_cause "$(error_lines "$new")")" != "quota" ]; then started=1; break; fi
105
105
  fi
106
106
  if [ $(( $(date +%s) - start_t )) -ge "$SILENCE" ]; then break; fi
107
- sleep "${DEVZONE_AGENT_PAS:-1}"
107
+ sleep "${DEVZONE_AGENT_STEP:-1}"
108
108
  done
109
109
  if [ "$discard" = 1 ]; then resume; i=$(( i + 1 )); continue; fi
110
110
  if kill -0 "$pid" 2>/dev/null && [ "$started" = 0 ]; then
@@ -127,7 +127,7 @@ agent_launch() {
127
127
  size="$(wc -c <"$journal")"
128
128
  while kill -0 "$pid" 2>/dev/null; do
129
129
  if session_fatal_error "$pid" "$journal" "$offset" "$m" "$folder"; then discard=1; break; fi
130
- sleep "${DEVZONE_AGENT_PAS:-1}"
130
+ sleep "${DEVZONE_AGENT_STEP:-1}"
131
131
  now="$(date +%s)"
132
132
  if [ "$(wc -c <"$journal")" -gt "$size" ]; then
133
133
  size="$(wc -c <"$journal")"
@@ -9,7 +9,7 @@
9
9
  # host-models.sh check update check of each model (delegates to host-check.sh)
10
10
  # host-models.sh rapport report (delegates to host-check.sh)
11
11
  # Default URL: http://host.docker.internal:11434, overridable with DEVZONE_OLLAMA_URL.
12
- # Measurements: DEVZONE_IA_MESURES, else ~/.config/devzone/ia-mesures.json
12
+ # Measurements: DEVZONE_AI_MEASURES, else ~/.config/devzone/ia-mesures.json
13
13
  # ({"<model>": {"reussite": 0..1, "tok_s": n, "date": "..."}}).
14
14
  # Short timeout; exits 0 and writes nothing when Ollama does not answer.
15
15
  # bash 3.2 (macOS). Code and comments in English.
@@ -18,7 +18,7 @@ set -euo pipefail
18
18
  URL="${DEVZONE_OLLAMA_URL:-http://host.docker.internal:11434}"
19
19
  URL="${URL%/}"
20
20
  FILE="$HOME/.config/opencode/config.json"
21
- MESURES="${DEVZONE_IA_MESURES:-$HOME/.config/devzone/ia-mesures.json}"
21
+ MESURES="${DEVZONE_AI_MEASURES:-$HOME/.config/devzone/ia-mesures.json}"
22
22
 
23
23
  # True when a model is an embedding model (Ollama details.type, or a name
24
24
  # containing "embed", case-insensitive).
@@ -2,7 +2,7 @@
2
2
  // Each shell tool call is checked by docker-guard.sh. Exit code 2: error shown
3
3
  // to the agent with stderr message. Script absent or failing: nothing blocked.
4
4
  // The installed copy (devzone enable ia) replaces the placeholder below with
5
- // the script path; DEVZONE_DOCKER_GARDE overrides it. The script is resolved
5
+ // the script path; DEVZONE_DOCKER_GUARD overrides it. The script is resolved
6
6
  // from the plugin location itself (.devcontainer/ai/plugins -> ../docker-guard.sh).
7
7
  // opencode 1.x also loads default exports with an id; without ctx.tool.hook the
8
8
  // 1.x guard in devzone-guard.js remains active.
@@ -11,10 +11,10 @@ import { existsSync } from "node:fs"
11
11
  import { fileURLToPath } from "node:url"
12
12
  import { dirname, join } from "node:path"
13
13
 
14
- const INSTALLED = process.env.DEVZONE_DOCKER_GARDE || "__DEVZONE_DOCKER_GARDE__"
14
+ const INSTALLED = process.env.DEVZONE_DOCKER_GUARD || "__DEVZONE_DOCKER_GUARD__"
15
15
 
16
16
  function guardScript() {
17
- if (INSTALLED && INSTALLED.indexOf("__DEVZONE_DOCKER_GARDE__") !== 0 && existsSync(INSTALLED)) {
17
+ if (INSTALLED && INSTALLED.indexOf("__DEVZONE_DOCKER_GUARD__") !== 0 && existsSync(INSTALLED)) {
18
18
  return INSTALLED
19
19
  }
20
20
  const script = join(dirname(fileURLToPath(import.meta.url)), "..", "docker-guard.sh")
@@ -2,17 +2,17 @@
2
2
  // Each shell tool call is checked by docker-guard.sh. Exit code 2: error shown
3
3
  // to the agent with stderr message. Script absent or failing: nothing blocked.
4
4
  // The installed copy (devzone enable ia) replaces the placeholder below with
5
- // the script path; DEVZONE_DOCKER_GARDE overrides it. The script is resolved
5
+ // the script path; DEVZONE_DOCKER_GUARD overrides it. The script is resolved
6
6
  // from the plugin location itself (.devcontainer/ai/plugins -> ../docker-guard.sh).
7
7
  import { spawnSync } from "node:child_process"
8
8
  import { existsSync } from "node:fs"
9
9
  import { fileURLToPath } from "node:url"
10
10
  import { dirname, join } from "node:path"
11
11
 
12
- const INSTALLED = process.env.DEVZONE_DOCKER_GARDE || "__DEVZONE_DOCKER_GARDE__"
12
+ const INSTALLED = process.env.DEVZONE_DOCKER_GUARD || "__DEVZONE_DOCKER_GUARD__"
13
13
 
14
14
  function guardScript() {
15
- if (INSTALLED && INSTALLED.indexOf("__DEVZONE_DOCKER_GARDE__") !== 0 && existsSync(INSTALLED)) {
15
+ if (INSTALLED && INSTALLED.indexOf("__DEVZONE_DOCKER_GUARD__") !== 0 && existsSync(INSTALLED)) {
16
16
  return INSTALLED
17
17
  }
18
18
  const script = join(dirname(fileURLToPath(import.meta.url)), "..", "docker-guard.sh")
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env bash
2
- # Module argocd (#411) : Argo CD dans le cluster des services de devzone.
2
+ # Module argocd (#411): Argo CD in the devzone services cluster.
3
3
  # argocd.sh install | uninstall | status | relay-start | relay-stop
4
4
  # argocd.sh app add <repo url> [path] [--name N] [--revision R] | app list | app remove <N>
5
- # Namespace devzone-argocd isolé, relais 127.0.0.1:8443 dans le conteneur.
6
- # Mot de passe admin dans workspace/.argocd/admin.env (600), repris dans
7
- # .password ; jamais affiché.
5
+ # Isolated devzone-argocd namespace, relay 127.0.0.1:8443 in the container.
6
+ # Admin password in workspace/.argocd/admin.env (600), copied to .password;
7
+ # never displayed.
8
8
  set -euo pipefail
9
9
 
10
10
  ICI="$(cd "$(dirname "$0")" && pwd)"
11
- RACINE="${DEVZONE_RACINE:-$(dirname "$(dirname "$ICI")")}"
12
- # shellcheck disable=SC2034 # lu par cluster.sh (bibliothèque sourcée)
13
- ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
11
+ RACINE="${DEVZONE_ROOT:-$(dirname "$(dirname "$ICI")")}"
12
+ # shellcheck disable=SC2034 # read by cluster.sh (sourced library)
13
+ ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
14
14
  # shellcheck source=SCRIPTDIR/../cluster.sh
15
15
  # shellcheck disable=SC1091
16
16
  . "$ICI/../cluster.sh"
17
17
  # shellcheck source=SCRIPTDIR/../password.sh
18
18
  # shellcheck disable=SC1091
19
19
  . "$ICI/../password.sh"
20
- # Isolation réseau : namespace_isoler, posée avec le namespace devzone-argocd
20
+ # Network isolation: namespace_isolate, applied with the devzone-argocd namespace
21
21
  # shellcheck source=SCRIPTDIR/../isolation.sh
22
22
  # shellcheck disable=SC1091
23
23
  . "$ICI/../isolation.sh"
@@ -29,64 +29,64 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
29
29
 
30
30
  NS=devzone-argocd
31
31
  SECRETS="$RACINE/workspace/.argocd"
32
- # Version figée du chart argo-cd, port du relais et attente d'installation
32
+ # Pinned argo-cd chart version, relay port and install wait
33
33
  ARGOCD_VERSION="${ARGOCD_VERSION:-10.14.0}"
34
34
  ARGOCD_PORT="${ARGOCD_PORT:-8443}"
35
35
  ARGOCD_ATTENTE="${ARGOCD_ATTENTE:-600}"
36
36
 
37
- # Refus du module : message préfixé et code 2 (même convention que postgres)
37
+ # Module refusal: prefixed message and code 2 (same convention as postgres)
38
38
  refuse() { echo "devzone : argocd : $*" >&2; exit 2; }
39
39
 
40
- # Vue regroupée des identifiants : un échec n'empêche jamais l'opération
41
- regenerer_identifiants() {
40
+ # Grouped credentials view: a failure never blocks the operation
41
+ regenerate_credentials() {
42
42
  password_regenerate ||
43
- echo "devzone : argocd : identifiants regroupés non mis à jour (devzone passwords)" >&2
43
+ echo "devzone : argocd : grouped credentials not updated (devzone passwords)" >&2
44
44
  }
45
45
 
46
- # Refuse l'installation sous 1 Go de mémoire allouable dans le cluster ; le
47
- # message indique où agrandir le cluster et la commande à relancer.
48
- verifier_memoire() {
49
- local memoire
50
- if ! memoire="$(memory_cluster_ki)"; then
51
- echo "devzone : argocd : cluster des services injoignable : devzone cluster" >&2
46
+ # Refuses the install below 1 GB of allocatable memory in the cluster; the
47
+ # message says where to enlarge the cluster and the command to run again.
48
+ check_memory() {
49
+ local mem
50
+ if ! mem="$(memory_cluster_ki)"; then
51
+ echo "devzone : argocd : services cluster unreachable: devzone cluster" >&2
52
52
  return 2
53
53
  fi
54
- if [ "$memoire" -lt 1048576 ]; then
55
- echo "devzone : argocd : il faut au moins 1 Go de mémoire allouable dans le cluster (disponible : $((memoire / 1024)) Mo) ; agrandir le cluster (Docker Desktop → Settings → Resources) puis relancer : devzone enable argocd" >&2
54
+ if [ "$mem" -lt 1048576 ]; then
55
+ echo "devzone : argocd : at least 1 GB of allocatable memory is needed in the cluster (available: $((mem / 1024)) MB); enlarge the cluster (Docker Desktop → Settings → Resources) then run again: devzone enable argocd" >&2
56
56
  return 2
57
57
  fi
58
58
  }
59
59
 
60
- # Namespace présent dans le cluster des services : Argo CD est installé.
61
- # Lecture des namespaces réservée à l'administrateur (#430).
62
- installe() {
63
- compte_admin "$(compte_ctx)" get namespace "$NS" >/dev/null 2>&1
60
+ # Namespace present in the services cluster: Argo CD is installed.
61
+ # Reading namespaces is reserved to the administrator (#430).
62
+ is_installed() {
63
+ account_admin "$(account_context)" get namespace "$NS" >/dev/null 2>&1
64
64
  }
65
65
 
66
- # Crée le namespace et l'étiquette par l'administrateur, autorise le compte
67
- # limité puis pose la NetworkPolicy isolante du module (#430).
68
- preparer_namespace() {
66
+ # Creates the namespace and labels it through the administrator, allows the
67
+ # limited account, then applies the module's isolating NetworkPolicy (#430).
68
+ prepare_namespace() {
69
69
  local ctx
70
- ctx="$(compte_ctx)"
71
- compte_admin "$ctx" create namespace "$NS" --dry-run=client -o yaml |
72
- compte_admin "$ctx" apply -f - >/dev/null
73
- compte_admin "$ctx" label namespace "$NS" "$CLUSTER_ETIQUETTE" --overwrite >/dev/null
74
- compte_autoriser "$ctx" "$NS"
75
- namespace_isoler "$NS"
70
+ ctx="$(account_context)"
71
+ account_admin "$ctx" create namespace "$NS" --dry-run=client -o yaml |
72
+ account_admin "$ctx" apply -f - >/dev/null
73
+ account_admin "$ctx" label namespace "$NS" "$CLUSTER_LABEL" --overwrite >/dev/null
74
+ account_allow "$ctx" "$NS"
75
+ namespace_isolate "$NS"
76
76
  }
77
77
 
78
- # Lit le mot de passe initial dans le Secret du chart et l'écrit dans
79
- # workspace/.argocd/admin.env (600) ; le contenu n'est jamais affiché.
80
- enregistrer_admin() {
81
- local brut mdp
82
- if ! brut="$(kubectl --context devzone -n "$NS" get secret argocd-initial-admin-secret \
78
+ # Reads the initial password from the chart's Secret and writes it to
79
+ # workspace/.argocd/admin.env (600); the content is never displayed.
80
+ save_admin() {
81
+ local raw pw
82
+ if ! raw="$(kubectl --context devzone -n "$NS" get secret argocd-initial-admin-secret \
83
83
  -o jsonpath='{.data.password}' 2>/dev/null)"; then
84
- echo "devzone : argocd : secret argocd-initial-admin-secret introuvable" >&2
84
+ echo "devzone : argocd : secret argocd-initial-admin-secret not found" >&2
85
85
  return 1
86
86
  fi
87
- mdp="$(printf '%s' "$brut" | base64 -d 2>/dev/null || true)"
88
- if [ -z "$mdp" ]; then
89
- echo "devzone : argocd : mot de passe admin illisible dans le secret" >&2
87
+ pw="$(printf '%s' "$raw" | base64 -d 2>/dev/null || true)"
88
+ if [ -z "$pw" ]; then
89
+ echo "devzone : argocd : admin password unreadable in the secret" >&2
90
90
  return 1
91
91
  fi
92
92
  mkdir -p "$SECRETS"
@@ -96,71 +96,72 @@ enregistrer_admin() {
96
96
  cat >"$SECRETS/admin.env" <<ENV
97
97
  ARGOCD_URL=https://127.0.0.1:$ARGOCD_PORT
98
98
  ARGOCD_USER=admin
99
- ARGOCD_PASSWORD=$mdp
99
+ ARGOCD_PASSWORD=$pw
100
100
  ENV
101
101
  )
102
102
  chmod 600 "$SECRETS/admin.env"
103
103
  }
104
104
 
105
- # Installe Argo CD avec le chart figé, prépare le namespace, range le mot de
106
- # passe admin et lance le relais d'accès ; idempotent (upgrade --install).
107
- installer() {
108
- echo "▶ Vérification de la mémoire allouable du cluster des services…"
109
- verifier_memoire || return 2
110
- preparer_namespace
111
- echo "▶ Installation d'Argo CD $ARGOCD_VERSION dans $NS (chart charts/devzone-argocd)…"
105
+ # Installs Argo CD with the pinned chart, prepares the namespace, stores the
106
+ # admin password and starts the access relay; idempotent (upgrade --install).
107
+ do_install() {
108
+ echo "▶ Checking the allocatable memory of the services cluster…"
109
+ check_memory || return 2
110
+ prepare_namespace
111
+ echo "▶ Installing Argo CD $ARGOCD_VERSION in $NS (chart charts/devzone-argocd)…"
112
112
  # Wrapper chart: the dependency argo-cd (pinned in Chart.yaml) is built
113
113
  # first, then installed from the local chart (#538)
114
114
  helm dependency build "$RACINE/charts/devzone-argocd" >/dev/null
115
- compte_helm "$(compte_ctx)" upgrade --install argocd \
115
+ account_helm "$(account_context)" upgrade --install argocd \
116
116
  "$RACINE/charts/devzone-argocd" \
117
117
  --namespace "$NS" \
118
118
  --create-namespace \
119
119
  --timeout "${ARGOCD_ATTENTE}s" \
120
120
  --wait
121
- enregistrer_admin
122
- relais_lancer argocd devzone "$NS" svc/argocd-server "$ARGOCD_PORT:443"
123
- regenerer_identifiants
124
- echo "✔ module argocd prêt : https://127.0.0.1:$ARGOCD_PORT"
121
+ save_admin
122
+ relay_start argocd devzone "$NS" svc/argocd-server "$ARGOCD_PORT:443"
123
+ regenerate_credentials
124
+ echo "✔ argocd module ready: https://127.0.0.1:$ARGOCD_PORT"
125
125
  }
126
126
 
127
- # Désinstalle la release Helm et supprime le namespace ; les autres services
128
- # du cluster restent, sous helm direct. Le RoleBinding et le namespace partent
129
- # par l'administrateur (#430).
130
- desinstaller() {
127
+ # Uninstalls the Helm release and deletes the namespace; the other services
128
+ # of the cluster stay, under direct helm. The RoleBinding and the namespace
129
+ # are removed by the administrator (#430).
130
+ do_uninstall() {
131
131
  local ctx
132
- relais_arreter argocd
133
- if installe; then
134
- echo "▶ Suppression d'Argo CD sur le cluster des services…"
135
- if ! compte_helm "$(compte_ctx)" uninstall argocd -n "$NS" >/dev/null 2>&1; then
136
- echo "devzone : argocd : helm uninstall a échoué (release déjà absente ?)" >&2
132
+ relay_stop argocd
133
+ if is_installed; then
134
+ echo "▶ Deleting Argo CD on the services cluster…"
135
+ if ! account_helm "$(account_context)" uninstall argocd -n "$NS" >/dev/null 2>&1; then
136
+ echo "devzone : argocd : helm uninstall failed (release already absent?)" >&2
137
137
  fi
138
- ctx="$(compte_ctx)"
139
- compte_retirer "$ctx" "$NS" >/dev/null 2>&1 || true
140
- compte_admin "$ctx" delete namespace "$NS" --wait=true >/dev/null
138
+ ctx="$(account_context)"
139
+ account_remove "$ctx" "$NS" >/dev/null 2>&1 || true
140
+ account_admin "$ctx" delete namespace "$NS" --wait=true >/dev/null
141
141
  fi
142
142
  rm -rf "$SECRETS"
143
- echo "✔ module argocd désactivé ; les services restent, sous helm direct."
144
- regenerer_identifiants
143
+ echo "✔ argocd module disabled; the services stay, under direct helm."
144
+ regenerate_credentials
145
145
  }
146
146
 
147
- # État du module : désactivé sans namespace, prêt avec relais actif.
148
- etat() {
149
- if ! installe; then
150
- echo "désactivé"
147
+ # Module status: disabled without namespace, ready with the relay active.
148
+ # The status texts are read by devzone: keep them unchanged.
149
+ do_status() {
150
+ if ! is_installed; then
151
+ echo "disabled"
151
152
  return 0
152
153
  fi
153
- if ! relais_actif argocd; then
154
- echo "prêt, relais arrêté : devzone apply"
154
+ if ! relay_active argocd; then
155
+ echo "ready, relay stopped: devzone apply"
155
156
  else
156
- echo "prêt : https://127.0.0.1:$ARGOCD_PORT"
157
+ echo "ready: https://127.0.0.1:$ARGOCD_PORT"
157
158
  fi
158
159
  }
159
160
 
160
- # Relance le relais d'accès seulement si le namespace Argo CD existe.
161
- relais() {
162
- if installe; then
163
- relais_lancer argocd devzone "$NS" svc/argocd-server "$ARGOCD_PORT:443"
161
+ # Starts the access relay again only if the Argo CD namespace exists.
162
+ do_relay_start() {
163
+ if is_installed; then
164
+ relay_start argocd devzone "$NS" svc/argocd-server "$ARGOCD_PORT:443"
164
165
  fi
165
166
  }
166
167
 
@@ -192,26 +193,26 @@ ARGOCD_CONF="${DEVZONE_ARGOCD_CONF:-$RACINE/.argocd.conf}"
192
193
  argocd_kubectl() { kubectl --context devzone "$@"; }
193
194
 
194
195
  case "${1:-}" in
195
- install) installer ;;
196
- uninstall) desinstaller ;;
197
- status) etat ;;
198
- relay-start) relais ;;
199
- relay-stop) relais_arreter argocd ;;
196
+ install) do_install ;;
197
+ uninstall) do_uninstall ;;
198
+ status) do_status ;;
199
+ relay-start) do_relay_start ;;
200
+ relay-stop) relay_stop argocd ;;
200
201
  init)
201
202
  # GitOps repository of the user (#516): created or designated, then
202
203
  # the root Application when the module is installed
203
204
  gitops_init "${@:2}" || exit $?
204
- if installe; then gitops_root; fi
205
+ if is_installed; then gitops_root; fi
205
206
  ;;
206
207
  apply)
207
- installe || refuse "module off: devzone enable argocd"
208
+ is_installed || refuse "module off: devzone enable argocd"
208
209
  gitops_init && gitops_root && apps_reconcile
209
210
  ;;
210
211
  app)
211
212
  if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
212
213
  refuse "in the workspace pod, on the workstation: devzone workspace argocd app ${*:2}"
213
214
  fi
214
- installe || refuse "module off: devzone enable argocd"
215
+ is_installed || refuse "module off: devzone enable argocd"
215
216
  argocd_app "${@:2}"
216
217
  ;;
217
218
  *)
@@ -2,7 +2,7 @@
2
2
  # Argo CD for the catalogue applications in the container (#538): the module
3
3
  # mysql and the catalogue install their application as the Application
4
4
  # devzone-<app> (services.sh) when the module argocd is active, instead of
5
- # the manifest applied by hand. The namespace (compte_namespace of
5
+ # the manifest applied by hand. The namespace (account_namespace of
6
6
  # cluster.sh, isolation.sh) and the secret <app>-admin (mirror
7
7
  # workspace/.<app>/) stay created apart, out of Git; Argo CD holds the chart
8
8
  # charts/devzone-<app> of the devzone repository at the revision.
@@ -79,7 +79,7 @@ catalogue_argocd_active() {
79
79
  local app="$1"
80
80
  catalogue_argocd_module_on || return 1
81
81
  [ -d "$RACINE/charts/devzone-$app" ] || return 1
82
- compte_admin "$(compte_ctx)" get namespace devzone-argocd >/dev/null 2>&1 || return 1
82
+ account_admin "$(account_context)" get namespace devzone-argocd >/dev/null 2>&1 || return 1
83
83
  catalogue_argocd_load
84
84
  [ -n "$(argocd_revision)" ]
85
85
  }
@@ -16,11 +16,11 @@
16
16
 
17
17
  ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
18
  # RACINE: the code tree (libraries, charts); STATE_RACINE: the devzone folder
19
- # (workspace/ secrets, .argocd.conf), the same folder unless DEVZONE_RACINE says so
19
+ # (workspace/ secrets, .argocd.conf), the same folder unless DEVZONE_ROOT says so
20
20
  RACINE="$(dirname "$(dirname "$ICI")")"
21
- STATE_RACINE="${DEVZONE_RACINE:-$RACINE}"
21
+ STATE_RACINE="${DEVZONE_ROOT:-$RACINE}"
22
22
  # shellcheck disable=SC2034 # read by catalog-argocd.sh
23
- ETAT="${DEVZONE_ETAT:-$STATE_RACINE/.devzone.modules}"
23
+ ETAT="${DEVZONE_STATE:-$STATE_RACINE/.devzone.modules}"
24
24
  APP_CONF="$RACINE/.devcontainer/catalog/mysql/app.conf"
25
25
  HOOK_SERVICES="postgres mysql"
26
26
 
@@ -44,7 +44,7 @@ chart_require() {
44
44
  if [ -f "$chart/Chart.yaml" ] && grep -qxF "name: devzone-$svc" "$chart/Chart.yaml"; then
45
45
  return 0
46
46
  fi
47
- echo "✖ $svc : chart charts/devzone-$svc missing or misnamed (manage/docs/reference.md#charts-de-devzone)" >&2
47
+ echo "✖ $svc : chart charts/devzone-$svc missing or misnamed (manage/docs/reference.md#devzone-charts)" >&2
48
48
  return 2
49
49
  }
50
50