devzone 0.39.1 → 0.41.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.
@@ -49,18 +49,31 @@ workspace_disponible() {
49
49
  }
50
50
 
51
51
  # Lance la consigne dans le pod, puis rapatrie son journal même en échec.
52
+ # Un chemin /workspaces/projets/... absent du poste désigne un dossier du pod
53
+ # (clone ou worktree de devzone ticket, #558) : rien n'est copié.
52
54
  agent_workspace() {
53
- local dossier="$1" consigne="$2" nom journal code=0
55
+ local dossier="$1" consigne="$2" nom journal code=0 dans_pod=""
54
56
  local racine_pod=/home/vscode/.local/share/devzone
55
- [ -d "$dossier" ] || refuse "dossier introuvable : $dossier (cherché depuis $(pwd))"
56
- nom="$(basename "$(cd "$dossier" && pwd -P)")"
57
- if ! agent_kc exec devzone-workspace-0 -c workspace -- test -d "/workspaces/projets/$nom" 2>/dev/null; then
58
- refuse "projet $nom absent du workspace Kubernetes : devzone workspace copier-vers $dossier (sur la machine), ou --local"
57
+ case "$dossier" in
58
+ /workspaces/projets/*) [ -d "$dossier" ] || dans_pod="$dossier" ;;
59
+ esac
60
+ if [ -n "$dans_pod" ]; then
61
+ nom="$(basename "$dans_pod")"
62
+ if ! agent_kc exec devzone-workspace-0 -c workspace -- test -d "$dans_pod" 2>/dev/null; then
63
+ refuse "dossier introuvable dans le pod : $dans_pod (devzone workspace clone, puis devzone ticket <n> dans le pod)"
64
+ fi
65
+ else
66
+ [ -d "$dossier" ] || refuse "dossier introuvable : $dossier (cherché depuis $(pwd))"
67
+ nom="$(basename "$(cd "$dossier" && pwd -P)")"
68
+ dans_pod="/workspaces/projets/$nom"
69
+ if ! agent_kc exec devzone-workspace-0 -c workspace -- test -d "$dans_pod" 2>/dev/null; then
70
+ refuse "projet $nom absent du workspace Kubernetes : devzone workspace copier-vers $dossier (sur la machine), ou --local"
71
+ fi
59
72
  fi
60
- echo "devzone agent : workspace Kubernetes (pod devzone-workspace-0, /workspaces/projets/$nom) ; --local pour le conteneur"
73
+ echo "devzone agent : workspace Kubernetes (pod devzone-workspace-0, $dans_pod) ; --local pour le conteneur"
61
74
  agent_kc cp "$consigne" "devzone-workspace-0:/tmp/devzone-agent-$nom.md" -c workspace
62
- agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_RACINE="$racine_pod" bash -lc 'devzone agent "$1" "$2"' _ "/workspaces/projets/$nom" "/tmp/devzone-agent-$nom.md" || code=$?
63
- journal="$(journal_de "$dossier")"
75
+ agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_RACINE="$racine_pod" bash -lc 'devzone agent "$1" "$2"' _ "$dans_pod" "/tmp/devzone-agent-$nom.md" || code=$?
76
+ journal="$(journal_de "$nom")"
64
77
  mkdir -p "$(dirname "$journal")"
65
78
  if ! agent_kc exec devzone-workspace-0 -c workspace -- cat "$racine_pod/workspace/.agents/$nom.log" >>"$journal"; then
66
79
  echo "=== journal du pod introuvable" >>"$journal"
@@ -73,6 +86,7 @@ agent_aide() {
73
86
  usage : devzone agent [--local] <dossier> <fichier-consigne>
74
87
  lance opencode sur la consigne, modèles gratuits en rotation
75
88
  workspace Kubernetes d'abord s'il tourne ; --local : ce conteneur
89
+ un chemin /workspaces/projets/... absent d'ici est un dossier du pod, sans copie
76
90
  devzone agent etat
77
91
  sessions connues et modèles écartés
78
92
  devzone agent liberer [<modèle>|--tous]
@@ -64,7 +64,7 @@ agent_lancer() {
64
64
  dossier="$(cd "$dossier" && pwd -P)"
65
65
  consigne="$(cd "$(dirname "$consigne")" && pwd -P)/$(basename "$consigne")"
66
66
  # Module ia requis : sans assistants, rien à diriger.
67
- if ! bash "$ICI/devzone" actif ia >/dev/null 2>&1; then
67
+ if ! bash "$ICI/devzone" is-enabled ia >/dev/null 2>&1; then
68
68
  refuse "module ia désactivé : devzone activer ia"
69
69
  fi
70
70
  configurer
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bash
2
2
  # English command names for the devzone CLI (#502).
3
3
  #
4
- # Why: English command names are accepted now; the French names stay valid.
5
- # Deprecation warnings come with the documentation lot (#502).
4
+ # Why: English command names are accepted now; the French names stay valid
5
+ # and warn on use (#532).
6
6
  #
7
7
  # command_canonical <name>: prints the current internal (French) name for an
8
8
  # English name; otherwise the name unchanged (empty stays empty).
@@ -33,3 +33,47 @@ command_canonical() {
33
33
  *) echo "${1:-}" ;;
34
34
  esac
35
35
  }
36
+
37
+ # English name of a French (internal) name; any other name unchanged.
38
+ # Mirror of command_canonical, used by the deprecation warning (#532).
39
+ command_english() {
40
+ case "${1:-}" in
41
+ actif) echo is-enabled ;;
42
+ activer) echo enable ;;
43
+ desactiver) echo disable ;;
44
+ aide) echo help ;;
45
+ appliquer) echo apply ;;
46
+ catalogue) echo catalog ;;
47
+ demarrer) echo start ;;
48
+ arreter) echo stop ;;
49
+ etat) echo status ;;
50
+ mots-de-passe) echo passwords ;;
51
+ paquets) echo packages ;;
52
+ plateforme) echo platform ;;
53
+ reparer) echo repair ;;
54
+ utiliser) echo use ;;
55
+ mettre-a-jour) echo update ;;
56
+ desinstaller) echo uninstall ;;
57
+ copier-vers) echo copy-to ;;
58
+ copier-depuis) echo copy-from ;;
59
+ migrer) echo migrate ;;
60
+ revenir) echo revert ;;
61
+ nettoyer-docker) echo clean-docker ;;
62
+ *) echo "${1:-}" ;;
63
+ esac
64
+ }
65
+
66
+ # Deprecation warning for the old French names (#532): called at the
67
+ # normalization points, with the word as typed. Writes one line on stderr
68
+ # for a French name of the table; silent for an English name, an unknown
69
+ # name and DEVZONE_NO_DEPRECATION=1. The exit code is always 0.
70
+ command_deprecated_warning() {
71
+ local word="${1:-}" english
72
+ [ -n "$word" ] || return 0
73
+ english="$(command_english "$word")"
74
+ [ "$english" != "$word" ] || return 0
75
+ if [ "${DEVZONE_NO_DEPRECATION:-}" != 1 ]; then
76
+ echo "devzone: \"$word\" is deprecated, use \"$english\"" >&2
77
+ fi
78
+ return 0
79
+ }
@@ -23,7 +23,7 @@ bash "$ICI/kube-compte.sh" jeton || echo "démarrage : jeton du compte kubernete
23
23
  # Module gitlab actif : /etc/hosts est un montage Docker régénéré à chaque
24
24
  # démarrage, gitlab.localhost doit être re-pose (ssh, glab et getent passent
25
25
  # par le résolveur système) ; hote-poser n'échoue jamais (avertissement seul)
26
- if bash "$ICI/devzone" actif gitlab; then
26
+ if bash "$ICI/devzone" is-enabled gitlab; then
27
27
  bash "$ICI/gitlab/gitlab.sh" hote-poser || echo "démarrage : nom gitlab.localhost non posé (devzone reparer)"
28
28
  # Relais TCP 8929/2224 : curl et git en HTTP passent par la boucle locale
29
29
  # pour *.localhost, le relais doit être relancé après chaque démarrage
@@ -31,17 +31,17 @@ if bash "$ICI/devzone" actif gitlab; then
31
31
  fi
32
32
  # Module postgres actif : le relais (port-forward vers 127.0.0.1:5432) ne
33
33
  # survit pas à l'arrêt du conteneur, relancé ici après les clusters
34
- if bash "$ICI/devzone" actif postgres; then
34
+ if bash "$ICI/devzone" is-enabled postgres; then
35
35
  bash "$ICI/postgres/postgres.sh" relais-lancer || echo "démarrage : relais postgres non lancé (devzone reparer)"
36
36
  fi
37
37
  # Module argocd actif : relais (port-forward vers 127.0.0.1:8443), relancé
38
38
  # après les clusters comme celui de postgres
39
- if bash "$ICI/devzone" actif argocd; then
39
+ if bash "$ICI/devzone" is-enabled argocd; then
40
40
  bash "$ICI/argocd/argocd.sh" relais-lancer || echo "démarrage : relais argocd non lancé (devzone reparer)"
41
41
  fi
42
42
  # Module mysql actif : le relais 127.0.0.1:3306, relancé comme celui de
43
43
  # postgres après chaque démarrage
44
- if bash "$ICI/devzone" actif mysql; then
44
+ if bash "$ICI/devzone" is-enabled mysql; then
45
45
  bash "$ICI/catalogue/mysql/mysql.sh" relais-lancer || echo "démarrage : relais mysql non lancé (devzone reparer)"
46
46
  fi
47
47
  # Relais de ports vers le poste (#290) : l'IP du conteneur change à chaque
@@ -16,6 +16,7 @@
16
16
  # devzone test-bash32 lance les tests bats sous bash 3.2 (conteneur Docker)
17
17
  # devzone test-gitlab essai de bout en bout du module et de la plateforme GitLab
18
18
  # devzone agent <dossier> <fichier-consigne> dirige opencode sur une consigne
19
+ # devzone ticket <n> [--repo devzone|repowarden] worktree du ticket (ticket done <n> le retire)
19
20
  # devzone build <dossier> [--tag <nom>] construit une image dans le workspace Kubernetes (BuildKit)
20
21
  # devzone activer postgres [--contexte CTX] [--confirmer CTX] PostgreSQL partagé, cluster au choix
21
22
  # devzone postgres creer <projet> base et utilisateur d'un projet (aussi : liste, psql, supprimer)
@@ -1405,9 +1406,12 @@ if [ -f "$ICI/etat-json.sh" ]; then
1405
1406
  fi
1406
1407
 
1407
1408
  # English command name of the first argument becomes the French one (#502);
1408
- # without any argument, nothing changes
1409
+ # without any argument, nothing changes. The old French names warn (#532).
1409
1410
  if [ "$#" -gt 0 ]; then
1410
1411
  canon="$(command_canonical "$1" 2>/dev/null)" || canon="$1"
1412
+ if command -v command_deprecated_warning >/dev/null 2>&1; then
1413
+ command_deprecated_warning "$1"
1414
+ fi
1411
1415
  set -- "$canon" "${@:2}"
1412
1416
  fi
1413
1417
 
@@ -1437,6 +1441,7 @@ case "${1:-}" in
1437
1441
  agent)
1438
1442
  bash "$ICI/agent.sh" "${@:2}"
1439
1443
  ;;
1444
+ ticket) bash "$ICI/ticket.sh" "${@:2}" ;;
1440
1445
  build)
1441
1446
  bash "$ICI/workspace-build.sh" "${@:2}"
1442
1447
  ;;
@@ -15,7 +15,7 @@ ICI="$(dirname "$0")"
15
15
  # shellcheck source=SCRIPTDIR/cluster.sh
16
16
  . "$ICI/cluster.sh"
17
17
  module=off
18
- bash "$ICI/devzone" actif kubernetes && module=on
18
+ bash "$ICI/devzone" is-enabled kubernetes && module=on
19
19
 
20
20
  # DEVZONE_KUBE_SOURCE : tests fonctionnels (jamais le cluster de l'hôte)
21
21
  SOURCE="${DEVZONE_KUBE_SOURCE:-$HOME/.kube-host/config}"
@@ -65,9 +65,9 @@ bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : configu
65
65
  if ! command -v docker >/dev/null 2>&1; then
66
66
  sudo install -m 0755 /workspaces/devzone/.devcontainer/docker-sans-hote.sh /usr/local/bin/docker
67
67
  fi
68
- devzone appliquer || echo "devzone : modules incomplets (détail ci-dessus), réessayer : devzone appliquer" >&2
68
+ devzone apply || echo "devzone : modules incomplets (détail ci-dessus), réessayer : devzone appliquer" >&2
69
69
  # Paquets systeme gardes (#351) : reinstallees a chaque creation ; un echec n arrete pas la creation
70
- devzone paquets appliquer || echo "devzone : paquets en echec, reessayer : devzone paquets" >&2
70
+ devzone packages appliquer || echo "devzone : paquets en echec, reessayer : devzone paquets" >&2
71
71
 
72
72
  # Invite Kubernetes du shell (#337) : prefixe PS1, une seule fois
73
73
  if ! grep -qF 'invite-kube.sh' "$HOME/.bashrc" 2>/dev/null; then
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env bash
2
+ # Ticket worktrees (#558), in the Kubernetes workspace pod and in the tools
3
+ # container:
4
+ # devzone ticket <n> [--repo devzone|repowarden]
5
+ # devzone ticket done <n> [--repo devzone|repowarden]
6
+ # In the pod: clone /workspaces/projets/<repo>, worktree
7
+ # /workspaces/projets/<repo>-wt/<dz|rw>-<n>. In the tools container: clone
8
+ # /workspaces/devzone, worktree workspace/wt/dz-<n> (devzone only).
9
+ # DEVZONE_TICKET_PROJECTS and DEVZONE_TICKET_TOOLS move those roots (tests).
10
+ set -euo pipefail
11
+
12
+ PROJECTS="${DEVZONE_TICKET_PROJECTS:-/workspaces/projets}"
13
+ TOOLS="${DEVZONE_TICKET_TOOLS:-/workspaces/devzone}"
14
+
15
+ refuse() { echo "devzone ticket: $*" >&2; exit 2; }
16
+
17
+ usage() {
18
+ echo "usage: devzone ticket <n> [--repo devzone|repowarden]" >&2
19
+ echo " devzone ticket done <n> [--repo devzone|repowarden]" >&2
20
+ exit 1
21
+ }
22
+
23
+ # Sets CLONE, WT and BASE (worktree folder prefix) for the repo.
24
+ ticket_paths() {
25
+ local repo="$1" n="$2" prefix
26
+ case "$repo" in
27
+ devzone) prefix=dz ;;
28
+ repowarden) prefix=rw ;;
29
+ *) refuse "unknown repo: $repo (devzone or repowarden)" ;;
30
+ esac
31
+ if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
32
+ CLONE="$PROJECTS/$repo"
33
+ WT="$PROJECTS/$repo-wt/$prefix-$n"
34
+ else
35
+ [ "$repo" = devzone ] || refuse "repo $repo only in the Kubernetes workspace pod"
36
+ CLONE="$TOOLS"
37
+ WT="$TOOLS/workspace/wt/$prefix-$n"
38
+ fi
39
+ [ -e "$CLONE/.git" ] || refuse "no clone in $CLONE (from the workstation: devzone workspace clone <url>)"
40
+ }
41
+
42
+ ticket_start() {
43
+ local n="$1" repo="$2" branch
44
+ ticket_paths "$repo" "$n"
45
+ if [ -e "$WT" ]; then
46
+ echo "worktree already there: $WT"
47
+ echo "$WT"
48
+ return 0
49
+ fi
50
+ git -C "$CLONE" fetch --quiet origin
51
+ mkdir -p "$(dirname "$WT")"
52
+ git -C "$CLONE" worktree add --quiet --detach "$WT" origin/develop
53
+ # repowarden creates the ticket branch from develop and links it
54
+ if ! (cd "$WT" && repowarden ticket "$n"); then
55
+ git -C "$CLONE" worktree remove --force "$WT" || true
56
+ refuse "repowarden ticket $n failed, worktree removed"
57
+ fi
58
+ branch="$(git -C "$WT" branch --show-current)"
59
+ echo "ticket #$n: branch ${branch:-none}"
60
+ echo "$WT"
61
+ }
62
+
63
+ ticket_done() {
64
+ local n="$1" repo="$2" branch
65
+ ticket_paths "$repo" "$n"
66
+ [ -d "$WT" ] || refuse "no worktree for ticket $n: $WT"
67
+ if [ -n "$(git -C "$WT" status --porcelain)" ]; then
68
+ refuse "worktree $WT is not clean, commit or discard first"
69
+ fi
70
+ branch="$(git -C "$WT" branch --show-current)"
71
+ if [ -n "$branch" ] && git -C "$CLONE" ls-remote --exit-code --heads origin "$branch" >/dev/null 2>&1; then
72
+ refuse "branch $branch still exists on origin: merge the pull request first"
73
+ fi
74
+ git -C "$CLONE" worktree remove "$WT"
75
+ if [ -n "$branch" ]; then git -C "$CLONE" branch -D "$branch" >/dev/null; fi
76
+ echo "ticket #$n: worktree $WT and local branch ${branch:-none} removed"
77
+ }
78
+
79
+ main() {
80
+ local action=start n="" repo=devzone
81
+ [ "${1:-}" != "done" ] || { action="done"; shift; }
82
+ while [ $# -gt 0 ]; do
83
+ case "$1" in
84
+ --repo)
85
+ [ $# -ge 2 ] || usage
86
+ repo="$2"
87
+ shift 2
88
+ ;;
89
+ -*) usage ;;
90
+ *)
91
+ [ -z "$n" ] || usage
92
+ n="$1"
93
+ shift
94
+ ;;
95
+ esac
96
+ done
97
+ case "$n" in '' | *[!0-9]*) usage ;; esac
98
+ if [ "$action" = "done" ]; then ticket_done "$n" "$repo"; else ticket_start "$n" "$repo"; fi
99
+ }
100
+
101
+ main "$@"
@@ -1,5 +1,5 @@
1
1
  # Single source for the repowarden version used by post-create.sh and workspace-init.sh.
2
- REPOWARDEN_VERSION=4.17.1
2
+ REPOWARDEN_VERSION=4.17.2
3
3
 
4
4
  # BuildKit client version installed in the workspace image (#514). Must match
5
5
  # buildkit.image in charts/devzone-workspace/values.yaml.
@@ -51,7 +51,7 @@ init_repowarden() {
51
51
  }
52
52
 
53
53
  init_modules() {
54
- if devzone appliquer 2>&1; then
54
+ if devzone apply 2>&1; then
55
55
  log "modules applied"
56
56
  else
57
57
  log "modules incomplete"
package/README.md CHANGED
@@ -36,7 +36,7 @@ devzone prépare un devcontainer Ubuntu lancé par Docker, avec des versions d'o
36
36
  ### Prérequis
37
37
 
38
38
  - Docker Desktop (ou Docker Engine sous Linux). Pour Kubernetes (facultatif) : activer le cluster de Docker Desktop (*Settings → Kubernetes → Enable Kubernetes*).
39
- - Pour le [workspace Kubernetes](manage/docs/reference.md#workspace-kubernetes) (facultatif, `devzone workspace migrate` pour quitter le poste Docker, `devzone workspace revert` pour y retourner) : un cluster Kubernetes 1.30 ou plus, `kubectl` et `helm` sur la machine, et Docker pour lire les volumes à migrer.
39
+ - Pour le [workspace Kubernetes](manage/docs/reference.md#workspace-kubernetes), c'est le mode par défaut dès qu'un cluster répond à la création : un cluster Kubernetes 1.30 ou plus, `kubectl` et `helm` sur la machine. Docker n'est alors pas nécessaire ; il l'est pour le poste Docker, et pour lire les volumes à migrer (`devzone workspace migrate`, `devzone workspace revert` pour y retourner).
40
40
  - Node et npm (pour `npx` ou l'installation globale).
41
41
  - `make` (nécessaire pour `make shell` ; sous Windows sans `make`, voir le tableau « Au quotidien »).
42
42
 
@@ -92,6 +92,23 @@ devzone : état (devzone pour le réafficher)
92
92
 
93
93
  Le premier lancement prend 4 à 5 min mesurées, plus le téléchargement des images de base sur une machine neuve.
94
94
 
95
+ ### Kubernetes ou Docker à la création
96
+
97
+ À la création, le poste suit le cluster : Kubernetes s'il répond, Docker sinon.
98
+
99
+ ```text
100
+ devzone mon-devzone
101
+ │
102
+ ├─ cluster qui répond ──▶ workspace dans le cluster (Kubernetes)
103
+ │ make shell ouvre le pod ; pas de migration
104
+ │
105
+ └─ sinon ───────────────▶ poste Docker
106
+ make shell lance le conteneur ;
107
+ plus tard : devzone workspace migrate
108
+ ```
109
+
110
+ `devzone mon-devzone --kubernetes` exige le cluster : sans lui, rien n'est créé. `devzone mon-devzone --docker` garde le poste Docker sans contrôler le cluster. Détails dans [manage/docs/reference.md](manage/docs/reference.md#création-directe-dans-le-cluster).
111
+
95
112
  ### Vérifier que tout fonctionne
96
113
 
97
114
  ```bash
@@ -158,7 +175,7 @@ La liste vit dans `.devzone.paquets` à la racine du dossier devzone, hors du d
158
175
  | État | — | `make status` | — |
159
176
  | **Désinstaller** (tout ce que devzone a créé, après confirmation) | — | `make uninstall` | `npx devzone uninstall` |
160
177
 
161
- Après `devzone workspace migrate`, `make up`, `make shell` et `make stop` pilotent le workspace Kubernetes ; `devzone workspace revert` rend le poste Docker. Les services GitLab, PostgreSQL et Argo CD s'y installent depuis le poste : `devzone workspace services enable postgres` (voir [la référence](manage/docs/reference.md#services-de-devzone-dans-le-workspace-kubernetes)). Argo CD y est installé d'office et tient les déploiements : interface sur https://localhost:8443 (mot de passe `admin` dans `.password`), dépôt GitOps `<login>/devzone-argocd` créé sur ton GitHub, projets déclarés dans `.argocd.conf` (`devzone workspace argocd app add <dépôt>`) ; voir [Argo CD dans le workspace Kubernetes](manage/docs/reference.md#argo-cd-dans-le-workspace-kubernetes).
178
+ Après `devzone workspace migrate`, `make up`, `make shell` et `make stop` pilotent le workspace Kubernetes ; `devzone workspace revert` rend le poste Docker. Les services GitLab, PostgreSQL et Argo CD s'y installent depuis le poste : `devzone workspace services enable postgres` (voir [la référence](manage/docs/reference.md#services-de-devzone-dans-le-workspace-kubernetes)). Tu peux aussi y développer : `devzone workspace clone <url>` fait un clone de travail dans le pod, `devzone ticket <n>` y crée le worktree d'un ticket et `devzone agent` y lance opencode sans copie ([développer dans le pod](manage/docs/reference.md#développer-devzone-et-repowarden-dans-le-pod)). Argo CD y est installé d'office et tient les déploiements : interface sur https://localhost:8443 (mot de passe `admin` dans `.password`), dépôt GitOps `<login>/devzone-argocd` créé sur ton GitHub, projets déclarés dans `.argocd.conf` (`devzone workspace argocd app add <dépôt>`) ; voir [Argo CD dans le workspace Kubernetes](manage/docs/reference.md#argo-cd-dans-le-workspace-kubernetes).
162
179
 
163
180
  ### Mettre à jour devzone
164
181
 
@@ -186,6 +203,8 @@ Dans le conteneur, le récapitulatif `devzone` signale une version publiée plus
186
203
 
187
204
  ## Options
188
205
 
206
+ **Mode à la création** : `--kubernetes` (workspace dans le cluster, refusé sans cluster) ou `--docker` (poste Docker, sans contrôle du cluster). Sans option, le mode suit le cluster (voir [Kubernetes ou Docker à la création](#kubernetes-ou-docker-à-la-création)).
207
+
189
208
  **Module `ia`** : active Claude Code et opencode (versions figées), avec le garde-fou repowarden qui les arrête avant de modifier `main` ou `develop` ou de commiter sans `repowarden cc` (voir [manage/docs/reference.md](manage/docs/reference.md#garde-fou-des-assistants-ia)). Pour l'activer : `devzone enable ia`. Ils sont désinstallés quand le module est désactivé, mais tes connexions restent dans leurs volumes.
190
209
 
191
210
  **Module `kubernetes`** : active à chaque démarrage la connexion au cluster de l'hôte et l'installation de metrics-server sur les clusters locaux (pour voir le CPU et la RAM dans k9s). Pour l'activer : `devzone enable kubernetes`. Sans ce module, kubectl, helm, k9s et kind restent installés.
package/manage/devzone CHANGED
@@ -421,16 +421,19 @@ aide() {
421
421
  cat <<EOF
422
422
  devzone $(version) : environnement de développement conteneurisé
423
423
 
424
- devzone <dossier> [--gitops github|none|<url>]
425
- crée un devzone dans <dossier> puis le lance (make up) ;
424
+ devzone <dossier> [--gitops github|none|<url>] [--kubernetes|--docker]
425
+ crée un devzone dans <dossier> puis le lance ;
426
426
  GitOps repository for Argo CD: github, or a URL, or none
427
+ --kubernetes: workspace in the cluster (default when it answers;
428
+ fails with nothing created without one)
429
+ --docker: Docker workstation, no cluster check (migrate later)
427
430
  devzone update [--oui] [--sans-reconstruire]
428
431
  dans un dossier devzone : passe à la version du paquet
429
432
  (sauvegarde les fichiers remplacés, propose make rebuild)
430
433
  devzone uninstall dans un dossier devzone : retire conteneur, image, volumes
431
434
  (à lancer avant npm uninstall -g devzone)
432
435
  devzone workspace start|stop|status|shell
433
- devzone workspace vscode|copy-to|copy-from|migrate|revert|clean-docker
436
+ devzone workspace vscode|copy-to|copy-from|clone|migrate|revert|clean-docker
434
437
  poste Kubernetes : pilote le chart devzone-workspace
435
438
  devzone workspace services enable|disable <service>|status
436
439
  services (gitlab, postgres, argocd) du workspace Kubernetes
@@ -461,14 +464,21 @@ gitops_saisir() {
461
464
  }
462
465
 
463
466
  creer() {
464
- local cible="$1" gitops="" expect="" arg valeur login nom instance
467
+ local cible="$1" gitops="" expect="" option="" arg valeur login nom instance
465
468
  shift
466
469
  for arg in "$@"; do
467
470
  if [ "$expect" = gitops ]; then gitops="$arg"; expect=""; continue; fi
468
471
  case "$arg" in
469
472
  --gitops) expect=gitops ;;
470
473
  --gitops=*) gitops="${arg#--gitops=}" ;;
471
- *) echo "✖ option inconnue : $arg (devzone <dossier> [--gitops github|none|<url>])" >&2; exit 1 ;;
474
+ --kubernetes | --docker)
475
+ if [ -n "$option" ] && [ "$option" != "${arg#--}" ]; then
476
+ echo "✖ --kubernetes and --docker: choose one" >&2
477
+ exit 1
478
+ fi
479
+ option="${arg#--}"
480
+ ;;
481
+ *) echo "✖ option inconnue : $arg (devzone <dossier> [--gitops github|none|<url>] [--kubernetes|--docker])" >&2; exit 1 ;;
472
482
  esac
473
483
  done
474
484
  if [ -n "$expect" ]; then
@@ -481,6 +491,11 @@ creer() {
481
491
  exit 1
482
492
  fi
483
493
 
494
+ # Mode before any copy: --kubernetes without a cluster creates nothing (#497)
495
+ # shellcheck source=SCRIPTDIR/scripts/create-mode.sh
496
+ . "$PAQUET/manage/scripts/create-mode.sh"
497
+ create_mode_choose "$option" || exit 1
498
+
484
499
  if [ -z "$gitops" ]; then
485
500
  if [ -t 0 ]; then
486
501
  gitops="$(gitops_saisir)"
@@ -497,6 +512,7 @@ creer() {
497
512
  : >"$cible/.gitignore"
498
513
  completer_gitignore "$cible"
499
514
  chmod +x "$cible/manage/scripts/desinstaller.sh" "$cible/manage/scripts/lancer.sh"
515
+ create_mode_write "$cible" "$CREATE_MODE"
500
516
  # The GitOps repository of the new devzone (#539): github, an existing URL,
501
517
  # or none, written in the .argocd.conf of the new devzone (conf.sh writes
502
518
  # the header of the file when absent)
@@ -534,6 +550,12 @@ creer() {
534
550
  cible="$(cd "$cible" && pwd)"
535
551
  ecrire_manifeste "$cible"
536
552
  echo "✔ devzone $(version) créé dans $cible"
553
+ # Kubernetes: the workspace goes to the cluster, no Docker check (Docker
554
+ # Desktop hosts the cluster, but devzone does not need it directly)
555
+ if [ "$CREATE_MODE" = kubernetes ]; then
556
+ create_mode_start "$cible" "$PAQUET/manage/workspace.sh"
557
+ return
558
+ fi
537
559
  if [ -n "${DEVZONE_SANS_DEMARRER:-}" ]; then
538
560
  echo "Pour le lancer : cd $cible && make up"
539
561
  return 0
@@ -561,7 +583,7 @@ commande_du_conteneur() {
561
583
  actif | activer | agent | appliquer | argocd | build | catalogue | cluster | clusters | \
562
584
  demarrer | desactiver | etat | gitlab | metrics | modules | mots-de-passe | \
563
585
  mysql | paquets | plateforme | port | postgres | reparer | test-bash32 | \
564
- test-gitlab | utiliser) return 0 ;;
586
+ test-gitlab | ticket | utiliser) return 0 ;;
565
587
  # English names of the container commands (#502)
566
588
  is-enabled | enable | disable | apply | catalog | start | status | \
567
589
  passwords | packages | platform | repair | use) return 0 ;;
@@ -569,8 +591,8 @@ commande_du_conteneur() {
569
591
  esac
570
592
  }
571
593
 
572
- # English command names are accepted, French ones unchanged (#502).
573
- # A copied devzone may miss the aliases file: then no normalization.
594
+ # English command names are accepted, French ones unchanged and warned (#502,
595
+ # #532). A copied devzone may miss the aliases file: then no normalization.
574
596
  # On the host, translate only to a known host or container command; any other
575
597
  # name stays as typed (so « devzone stop » creates ./stop, not ./arreter).
576
598
  # shellcheck source=SCRIPTDIR/../.devcontainer/command-aliases.sh
@@ -579,6 +601,9 @@ if [ -f "$PAQUET/.devcontainer/command-aliases.sh" ]; then
579
601
  . "$PAQUET/.devcontainer/command-aliases.sh"
580
602
  if [ "$#" -gt 0 ]; then
581
603
  canon="$(command_canonical "$1")"
604
+ if command -v command_deprecated_warning >/dev/null 2>&1; then
605
+ command_deprecated_warning "$1"
606
+ fi
582
607
  case "$canon" in
583
608
  mettre-a-jour | desinstaller | aide | workspace) set -- "$canon" "${@:2}" ;;
584
609
  *)
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env bash
2
+ # Workstation mode at creation (#497): a new devzone is Kubernetes when the
3
+ # cluster answers, Docker otherwise. Sourced by manage/devzone (creer):
4
+ # create_mode_choose runs before any file is copied (so --kubernetes without a
5
+ # cluster creates nothing), create_mode_write once the folder exists.
6
+ # Sourced only: no code at file level. Compatible with bash 3.2 (macOS).
7
+ # shellcheck disable=SC2034 # CREATE_MODE is read by manage/devzone (creer)
8
+ # shellcheck source=manage/scripts/kube-ready.sh
9
+ . "$(dirname "${BASH_SOURCE[0]}")/kube-ready.sh"
10
+
11
+ # Context shown to the user: devzone if declared, otherwise the current one.
12
+ kube_context() {
13
+ if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
14
+ echo devzone
15
+ else
16
+ kubectl config current-context 2>/dev/null || echo none
17
+ fi
18
+ }
19
+
20
+ # Chooses the mode from the option (kubernetes, docker, or empty) and sets
21
+ # CREATE_MODE to kubernetes or docker, with one line of notice. Returns 1,
22
+ # nothing set on disk, when --kubernetes is asked and the cluster does not
23
+ # answer.
24
+ create_mode_choose() {
25
+ local option="$1" reason
26
+ if [ "$option" = docker ]; then
27
+ CREATE_MODE=docker
28
+ echo "Docker workstation (--docker): later: devzone workspace migrate"
29
+ return 0
30
+ fi
31
+ if reason="$(kube_ready_reason)"; then
32
+ CREATE_MODE=kubernetes
33
+ echo "✔ Kubernetes ready ($(kube_context)): workspace in the cluster"
34
+ create_mode_existing
35
+ return 0
36
+ fi
37
+ if [ "$option" = kubernetes ]; then
38
+ echo "✖ Kubernetes not reachable: $reason. Nothing created: start the cluster, or create with --docker" >&2
39
+ return 1
40
+ fi
41
+ CREATE_MODE=docker
42
+ echo "⚠ Kubernetes not reachable: $reason. Docker workstation; later: devzone workspace migrate"
43
+ return 0
44
+ }
45
+
46
+ # A workspace already installed in the cluster (helm release devzone-workspace,
47
+ # or Argo CD Application devzone-workspace), from any folder: the new folder
48
+ # drives it too, and creation goes on (the start is a helm upgrade, the volumes
49
+ # stay). Notice only.
50
+ create_mode_existing() {
51
+ local ctx
52
+ ctx="$(kube_context)"
53
+ if helm status devzone-workspace --namespace devzone-workspace --kube-context "$ctx" >/dev/null 2>&1 ||
54
+ kubectl get application.argoproj.io devzone-workspace --namespace devzone-argocd --context "$ctx" >/dev/null 2>&1; then
55
+ echo "ℹ a devzone workspace already runs in this cluster: this folder drives it too"
56
+ fi
57
+ return 0
58
+ }
59
+
60
+ # Writes workspace=<mode> in <folder>/.devzone.modules: an earlier workspace=
61
+ # line is replaced, the other lines are kept.
62
+ create_mode_write() {
63
+ local folder="$1" mode="$2" f
64
+ f="$folder/.devzone.modules"
65
+ {
66
+ if [ -f "$f" ]; then grep -v '^workspace=' "$f" || true; fi
67
+ echo "workspace=$mode"
68
+ } >"$f.tmp" && mv "$f.tmp" "$f"
69
+ }
70
+
71
+ # Kubernetes creation: installs the workspace from the package script, run in
72
+ # the new folder (as devzone workspace start does). DEVZONE_WORKSPACE_SH
73
+ # replaces the script (tests); DEVZONE_SANS_DEMARRER only prints the command.
74
+ create_mode_start() {
75
+ local folder="$1" script="$2"
76
+ if [ -n "${DEVZONE_SANS_DEMARRER:-}" ]; then
77
+ echo "To start the workspace: cd $folder && devzone workspace start"
78
+ return 0
79
+ fi
80
+ echo "▶ Starting the workspace in the cluster (a few minutes the first time)…"
81
+ if ! (cd "$folder" && bash "${DEVZONE_WORKSPACE_SH:-$script}" start); then
82
+ echo "✖ Workspace not started. The folder is ready: only the start remains (cd $folder && devzone workspace start)" >&2
83
+ return 1
84
+ fi
85
+ echo "Next: cd $folder && make shell (the pod)"
86
+ }
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bash
2
+ # Shared check of the Kubernetes cluster (#497), sourced by poste.sh (and by
3
+ # create-mode.sh at creation). Sourced only: no code at file level.
4
+ # Compatible with bash 3.2 (macOS) and Linux.
5
+
6
+ # Returns 0 when kubectl and helm are present and the cluster answers within 5 s
7
+ # (context devzone if declared, otherwise the current context). Otherwise
8
+ # prints one short line on stdout (kubectl missing, helm missing, or
9
+ # cluster <context> unreachable (<server>)) and returns 1.
10
+ kube_ready_reason() {
11
+ local context server
12
+ command -v kubectl >/dev/null 2>&1 || {
13
+ echo "kubectl missing"
14
+ return 1
15
+ }
16
+ command -v helm >/dev/null 2>&1 || {
17
+ echo "helm missing"
18
+ return 1
19
+ }
20
+ if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
21
+ kubectl cluster-info --request-timeout=5s --context devzone >/dev/null 2>&1 && return 0
22
+ context=devzone
23
+ server="$(kubectl config view --minify --context devzone -o 'jsonpath={.clusters[0].server}' 2>/dev/null || true)"
24
+ else
25
+ kubectl cluster-info --request-timeout=5s >/dev/null 2>&1 && return 0
26
+ context="$(kubectl config current-context 2>/dev/null || true)"
27
+ server="$(kubectl config view --minify -o 'jsonpath={.clusters[0].server}' 2>/dev/null || true)"
28
+ fi
29
+ echo "cluster ${context:-none} unreachable (${server:-unknown server})"
30
+ return 1
31
+ }
@@ -9,6 +9,10 @@
9
9
  # Portable: bash 3.2 (macOS) and Linux.
10
10
  set -uo pipefail
11
11
 
12
+ # kube_ready_reason: Kubernetes reachable check, shared with create-mode.sh (#497)
13
+ # shellcheck source=manage/scripts/kube-ready.sh
14
+ . "$(dirname "${BASH_SOURCE[0]}")/kube-ready.sh"
15
+
12
16
  usage() {
13
17
  echo "usage: bash manage/scripts/poste.sh up|shell|stop|rebuild|advice <folder>" >&2
14
18
  }
@@ -37,18 +41,6 @@ folder_version() {
37
41
  fi
38
42
  }
39
43
 
40
- # Kubernetes reachable: kubectl and helm present, and kubectl cluster-info
41
- # responds within 5 s (--context devzone if that context is declared).
42
- kube_ready() {
43
- command -v kubectl >/dev/null 2>&1 || return 1
44
- command -v helm >/dev/null 2>&1 || return 1
45
- if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
46
- kubectl cluster-info --request-timeout=5s --context devzone >/dev/null 2>&1
47
- else
48
- kubectl cluster-info --request-timeout=5s >/dev/null 2>&1
49
- fi
50
- }
51
-
52
44
  # Workspace command for the folder: clone script if present, otherwise the
53
45
  # published CLI for the folder version, run from the folder.
54
46
  workspace_cmd() {
@@ -80,7 +72,7 @@ fi
80
72
  if [ "$target" = "advice" ] || [ "$target" = "conseil" ]; then
81
73
  if [ "$(workspace_mode "$folder")" = kubernetes ]; then
82
74
  echo "Kubernetes workspace: the new image is used on the next devzone workspace start (or make up)."
83
- elif kube_ready; then
75
+ elif kube_ready_reason >/dev/null; then
84
76
  echo "Kubernetes reachable: devzone workspace migrate moves this workstation to the cluster (nothing is deleted, rollback: devzone workspace revert)."
85
77
  fi
86
78
  exit 0
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env bash
2
+ # Working clones inside the pod (#558), sourced by manage/workspace.sh:
3
+ # devzone workspace clone <url> [<name>]
4
+ # git clone into $PROJECTS_DIR/<name> of the pod over HTTPS, credentials given
5
+ # by the gh git credential helper set up in the pod, git identity copied from
6
+ # the workstation, then "repowarden install" in the clone (hooks). bash 3.2.
7
+
8
+ # Script run in the pod: $1 clone folder, $2 url, $3 git name, $4 git email.
9
+ # Exit 3: the folder exists and is not a clone of this url.
10
+ workspace_clone_pod_script() {
11
+ cat <<'POD'
12
+ set -eu
13
+ dir="$1" url="$2" name="$3" email="$4"
14
+ norm() { local u="${1%/}"; echo "${u%.git}"; }
15
+ gh auth setup-git
16
+ if [ -d "$dir/.git" ]; then
17
+ remote="$(git -C "$dir" remote get-url origin 2>/dev/null || true)"
18
+ if [ "$(norm "$remote")" != "$(norm "$url")" ]; then
19
+ echo "✖ $dir already exists with another remote: ${remote:-none}" >&2
20
+ exit 3
21
+ fi
22
+ echo "$dir is already a clone of $url"
23
+ elif [ -e "$dir" ] && [ -n "$(ls -A "$dir" 2>/dev/null)" ]; then
24
+ echo "✖ $dir already exists and is not a git clone" >&2
25
+ exit 3
26
+ else
27
+ git clone "$url" "$dir"
28
+ fi
29
+ [ -z "$name" ] || git -C "$dir" config user.name "$name"
30
+ [ -z "$email" ] || git -C "$dir" config user.email "$email"
31
+ if command -v repowarden >/dev/null 2>&1; then
32
+ (cd "$dir" && repowarden install)
33
+ else
34
+ echo "⚠ repowarden missing in the pod: hooks not installed in $dir" >&2
35
+ fi
36
+ POD
37
+ }
38
+
39
+ # Folder name from a url: last path segment without .git.
40
+ workspace_clone_name() {
41
+ local u="${1%/}"
42
+ u="${u##*/}"
43
+ u="${u##*:}"
44
+ echo "${u%.git}"
45
+ }
46
+
47
+ workspace_clone() {
48
+ local url="${1:-}" name="${2:-}" git_name git_email
49
+ if [ -z "$url" ] || [ $# -gt 2 ]; then
50
+ echo "✖ usage: devzone workspace clone <url> [<name>]" >&2
51
+ return 1
52
+ fi
53
+ [ -n "$name" ] || name="$(workspace_clone_name "$url")"
54
+ case "$name" in
55
+ '' | . | .. | -* | */* | *[!A-Za-z0-9._-]*)
56
+ echo "✖ invalid folder name: ${name:-empty} (letters, digits, . _ - only)" >&2
57
+ return 1
58
+ ;;
59
+ esac
60
+ git_name="$(git config --get user.name 2>/dev/null || true)"
61
+ git_email="$(git config --get user.email 2>/dev/null || true)"
62
+ # shellcheck disable=SC2046
63
+ workspace_clone_pod_script | kubectl $(kubectl_flag) exec -i "$POD" \
64
+ --namespace "$NAMESPACE" -c workspace -- \
65
+ bash -s -- "$PROJECTS_DIR/$name" "$url" "$git_name" "$git_email"
66
+ }
67
+
68
+ # Guard of the agents in the pod (#558): when the ia module is on there,
69
+ # "repowarden agents init --global" is run (idempotent), so that an agent
70
+ # launched in the pod cannot edit develop. Never fails the workspace start.
71
+ workspace_agents_guard() {
72
+ # shellcheck disable=SC2046
73
+ if kubectl $(kubectl_flag) exec "$POD" --namespace "$NAMESPACE" -c workspace -- \
74
+ bash -lc 'devzone is-enabled ia && repowarden agents init --global' >/dev/null 2>&1; then
75
+ echo "✔ repowarden guard active for the agents of the pod"
76
+ fi
77
+ }
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env bash
2
+ # Stale copies in the pod (#558), sourced by manage/workspace.sh:
3
+ # status_workspace pod status, then the legacy copies still in the pod
4
+ # copy_guard copy-to never overwrites a pod clone of another remote
5
+ # Uses kubectl_flag, POD, NAMESPACE and PROJECTS_DIR from workspace.sh.
6
+
7
+ # Shows workspace pod status, then the legacy copies still in the pod.
8
+ status_workspace() {
9
+ # shellcheck disable=SC2046
10
+ kubectl $(kubectl_flag) get pods --namespace devzone-workspace
11
+ workspace_legacy_copies || true
12
+ }
13
+
14
+ # Script run in the pod: prints the legacy copies, one folder per line
15
+ # (repogarde, wt): their .git file points to a git folder missing from the pod.
16
+ workspace_legacy_pod_script() {
17
+ cat <<'POD'
18
+ broken() {
19
+ local g
20
+ [ -f "$1/.git" ] || return 1
21
+ g="$(sed -n 's/^gitdir: *//p' "$1/.git" | head -1)"
22
+ [ -n "$g" ] && [ ! -e "$g" ]
23
+ }
24
+ cd "$1" || exit 0
25
+ if broken repogarde; then echo repogarde; fi
26
+ for d in wt/*; do
27
+ if broken "$d"; then echo wt; break; fi
28
+ done
29
+ POD
30
+ }
31
+
32
+ # Legacy copies (repogarde/, wt/) are reported with the command to remove them;
33
+ # the removal itself is manual, after a backup.
34
+ workspace_legacy_copies() {
35
+ local found d dirs=""
36
+ # shellcheck disable=SC2046
37
+ found="$(workspace_legacy_pod_script | kubectl $(kubectl_flag) exec -i "$POD" \
38
+ --namespace "$NAMESPACE" -c workspace -- bash -s -- "$PROJECTS_DIR" 2>/dev/null)" || return 0
39
+ [ -n "$found" ] || return 0
40
+ for d in $found; do dirs="$dirs $PROJECTS_DIR/$d"; done
41
+ echo "⚠ legacy copies in the pod (their .git points outside the pod):$dirs"
42
+ echo " 1. save what you need: devzone workspace copy-from <folder>"
43
+ echo " 2. remove them from the pod shell (devzone workspace shell), one folder at a time:"
44
+ for d in $found; do echo " rm -rf $PROJECTS_DIR/$d"; done
45
+ }
46
+
47
+ # Script run in the pod: $1 pod folder, $2 remote of the workstation folder.
48
+ # Exit 3 (remote printed) when the pod folder is a clone of another remote.
49
+ workspace_copy_pod_script() {
50
+ cat <<'POD'
51
+ [ -e "$1/.git" ] || exit 0
52
+ r="$(git -C "$1" remote get-url origin 2>/dev/null || true)"
53
+ n() { local u="${1%/}"; echo "${u%.git}"; }
54
+ [ "$(n "$r")" = "$(n "$2")" ] && exit 0
55
+ echo "${r:-none}"
56
+ exit 3
57
+ POD
58
+ }
59
+
60
+ # copy-to never overwrites a pod clone of another repository.
61
+ copy_guard() {
62
+ local folder="$1" mine other code=0
63
+ mine="$(git -C "$folder" remote get-url origin 2>/dev/null || true)"
64
+ # shellcheck disable=SC2046
65
+ other="$(workspace_copy_pod_script | kubectl $(kubectl_flag) exec -i "$POD" \
66
+ --namespace "$NAMESPACE" -c workspace -- bash -s -- \
67
+ "$PROJECTS_DIR/$(basename "$folder")" "$mine" 2>/dev/null)" || code=$?
68
+ if [ "$code" -eq 3 ]; then
69
+ echo "✖ $PROJECTS_DIR/$(basename "$folder") in the pod is a git clone with another remote ($other, here: ${mine:-none}); not overwritten" >&2
70
+ echo " work in that clone (devzone workspace clone), or remove it first" >&2
71
+ return 1
72
+ fi
73
+ return 0
74
+ }
@@ -86,6 +86,7 @@ start_workspace() {
86
86
  # Projects of .argocd.conf held too (#516)
87
87
  argocd_reconcile || true
88
88
  wait_for_pod "$image" || return 1
89
+ workspace_agents_guard || true
89
90
  ports_start silence
90
91
  }
91
92
 
@@ -113,12 +114,6 @@ stop_workspace() {
113
114
  workspace_undeploy
114
115
  }
115
116
 
116
- # Shows workspace pod status.
117
- status_workspace() {
118
- # shellcheck disable=SC2046
119
- kubectl $(kubectl_flag) get pods --namespace devzone-workspace
120
- }
121
-
122
117
  # Opens a shell in the workspace container.
123
118
  shell_workspace() {
124
119
  # shellcheck disable=SC2046
@@ -153,6 +148,7 @@ copy_to() {
153
148
  exit 1
154
149
  fi
155
150
  folder="$(cd "$folder" && pwd)"
151
+ copy_guard "$folder" || exit 1
156
152
  # shellcheck disable=SC2046
157
153
  kubectl $(kubectl_flag) cp "$folder" "$POD:$PROJECTS_DIR/$(basename "$folder")" \
158
154
  --namespace "$NAMESPACE" -c workspace
@@ -178,6 +174,10 @@ copy_from() {
178
174
  . "$HERE/scripts/workspace-aliases.sh"
179
175
  # shellcheck source=manage/scripts/workspace-wait.sh
180
176
  . "$HERE/scripts/workspace-wait.sh"
177
+ # shellcheck source=manage/scripts/workspace-clone.sh
178
+ . "$HERE/scripts/workspace-clone.sh"
179
+ # shellcheck source=manage/scripts/workspace-copies.sh
180
+ . "$HERE/scripts/workspace-copies.sh"
181
181
  # shellcheck source=manage/scripts/migrer.sh
182
182
  . "$HERE/scripts/migrer.sh"
183
183
  # shellcheck source=manage/scripts/migrer-retour.sh
@@ -191,13 +191,16 @@ copy_from() {
191
191
  # shellcheck source=manage/scripts/argocd-services.sh
192
192
  . "$HERE/scripts/argocd-services.sh"
193
193
 
194
- # English command names are accepted, French ones unchanged (#502).
195
- # A copied devzone may miss the aliases file: then no normalization.
194
+ # English command names are accepted, French ones unchanged and warned (#502,
195
+ # #532). A copied devzone may miss the aliases file: then no normalization.
196
196
  # shellcheck source=../.devcontainer/command-aliases.sh
197
197
  # shellcheck disable=SC1091
198
198
  if [ -f "$ROOT/.devcontainer/command-aliases.sh" ]; then
199
199
  . "$ROOT/.devcontainer/command-aliases.sh"
200
200
  if [ "$#" -gt 0 ]; then
201
+ if command -v command_deprecated_warning >/dev/null 2>&1; then
202
+ command_deprecated_warning "$1"
203
+ fi
201
204
  set -- "$(command_canonical "$1")" "${@:2}"
202
205
  fi
203
206
  fi
@@ -217,6 +220,7 @@ case "${1:-}" in
217
220
  vscode) vscode_workspace ;;
218
221
  copy-to) copy_to "${@:2}" ;;
219
222
  copy-from) copy_from "${@:2}" ;;
223
+ clone) workspace_clone "${@:2}" ;;
220
224
  ports) ports "${@:2}" ;;
221
225
  migrate) migrate_workspace "${@:2}" ;;
222
226
  revert) revert_workspace "${@:2}" ;;
@@ -224,8 +228,9 @@ case "${1:-}" in
224
228
  services) services "${@:2}" ;;
225
229
  argocd) argocd_cmd "${@:2}" ;;
226
230
  '' | -h | --help | aide)
227
- echo "devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|ports|services|argocd|migrate|revert|clean-docker"
231
+ echo "devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|clone|ports|services|argocd|migrate|revert|clean-docker"
228
232
  echo " start [--image repository:tag] install workspace (image for devzone version by default)"
233
+ echo " clone <url> [<name>] git clone into the pod projects folder (gh credentials, identity, repowarden hooks)"
229
234
  echo " ports [start|stop|status] applications and services from pod on workstation localhost"
230
235
  echo " services enable|disable <service> [options] | status"
231
236
  echo " devzone services (gitlab, postgres, argocd) of the cluster, installed from the workstation"
@@ -236,7 +241,7 @@ case "${1:-}" in
236
241
  echo " clean-docker remove devzone-* Docker volumes, after confirmation [y/N] (--yes)"
237
242
  ;;
238
243
  *)
239
- echo "✖ unknown subcommand: $1 (devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|ports|services|argocd|migrate|revert|clean-docker)" >&2
244
+ echo "✖ unknown subcommand: $1 (devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|clone|ports|services|argocd|migrate|revert|clean-docker)" >&2
240
245
  exit 1
241
246
  ;;
242
247
  esac
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "0.39.1",
3
+ "version": "0.41.0",
4
4
  "description": "Ton poste de développement Linux, prêt en une commande, identique sur Mac, Windows et Linux.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {