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.
- package/.devcontainer/agent-errors.sh +6 -6
- package/.devcontainer/agent-pod-manifest.sh +4 -4
- package/.devcontainer/agent-session.sh +2 -2
- package/.devcontainer/agent-state-json.sh +2 -2
- package/.devcontainer/agent-workspace.sh +1 -1
- package/.devcontainer/agent.sh +7 -7
- package/.devcontainer/ai/host-models.sh +2 -2
- package/.devcontainer/ai/plugins/devzone-guard-v2.js +3 -3
- package/.devcontainer/ai/plugins/devzone-guard.js +3 -3
- package/.devcontainer/argocd/argocd.sh +90 -89
- package/.devcontainer/argocd/catalog-argocd.sh +2 -2
- package/.devcontainer/argocd/services-hook.sh +3 -3
- package/.devcontainer/argocd/services.sh +1 -1
- package/.devcontainer/catalog/app.sh +114 -116
- package/.devcontainer/catalog/catalog-watcher.sh +62 -62
- package/.devcontainer/catalog/mysql/app.conf +1 -1
- package/.devcontainer/catalog/mysql/install.sh +40 -40
- package/.devcontainer/catalog/mysql/mysql.sh +141 -141
- package/.devcontainer/catalog/mysql/volume.sh +39 -39
- package/.devcontainer/catalog.sh +112 -112
- package/.devcontainer/chart-direct.sh +1 -1
- package/.devcontainer/cluster.sh +216 -218
- package/.devcontainer/clusters.sh +41 -41
- package/.devcontainer/command-aliases.sh +17 -8
- package/.devcontainer/devzone +93 -1496
- package/.devcontainer/devzone-ai-guard.sh +76 -0
- package/.devcontainer/devzone-ai.sh +201 -0
- package/.devcontainer/devzone-cluster.sh +210 -0
- package/.devcontainer/devzone-modules.sh +126 -0
- package/.devcontainer/devzone-platform.sh +189 -0
- package/.devcontainer/devzone-repair.sh +94 -0
- package/.devcontainer/devzone-services.sh +241 -0
- package/.devcontainer/devzone-skill.sh +97 -0
- package/.devcontainer/devzone-status.sh +140 -0
- package/.devcontainer/devzone-version.sh +78 -0
- package/.devcontainer/git-identity.sh +28 -0
- package/.devcontainer/gitlab/chart.sh +2 -2
- package/.devcontainer/gitlab/gitlab.sh +81 -82
- package/.devcontainer/gitlab/installation.sh +109 -109
- package/.devcontainer/gitlab/secrets.sh +47 -47
- package/.devcontainer/gitlab/seed.sh +77 -77
- package/.devcontainer/gitlab/test-gitlab.sh +242 -243
- package/.devcontainer/help.sh +1 -1
- package/.devcontainer/isolation.sh +30 -30
- package/.devcontainer/kind-wrapper.sh +17 -17
- package/.devcontainer/kube-account.sh +112 -113
- package/.devcontainer/kube-config.sh +45 -46
- package/.devcontainer/{invite-kube.sh → kube-prompt.sh} +6 -6
- package/.devcontainer/kube-reachable.sh +40 -40
- package/.devcontainer/memory.sh +1 -1
- package/.devcontainer/metrics-server.sh +2 -2
- package/.devcontainer/opencode.jsonc +2 -2
- package/.devcontainer/packages.sh +136 -135
- package/.devcontainer/password.sh +1 -1
- package/.devcontainer/ports-auto.sh +152 -153
- package/.devcontainer/ports-json.sh +16 -15
- package/.devcontainer/ports.sh +126 -122
- package/.devcontainer/post-create.sh +52 -52
- package/.devcontainer/postgres/postgres.sh +174 -174
- package/.devcontainer/rename-legacy-files.sh +103 -0
- package/.devcontainer/services-admin.sh +3 -3
- package/.devcontainer/skills/devzone/SKILL.md +40 -41
- package/.devcontainer/startup.sh +48 -49
- package/.devcontainer/state-gitops.sh +1 -1
- package/.devcontainer/state-json.sh +36 -62
- package/.devcontainer/state.sh +2 -2
- package/.devcontainer/workspace-init.sh +16 -2
- package/Makefile +1 -1
- package/README.md +191 -195
- package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
- package/manage/devzone +7 -11
- package/manage/scripts/argocd-workspace.sh +1 -1
- package/manage/scripts/{check-charts.sh → ci/check-charts.sh} +1 -1
- package/manage/scripts/{check-english.sh → ci/check-english.sh} +1 -1
- package/manage/scripts/{check-go-layout.sh → ci/check-go-layout.sh} +1 -1
- package/manage/scripts/{check-names.sh → ci/check-names.sh} +7 -6
- package/manage/scripts/{check-utf8-vars.sh → ci/check-utf8-vars.sh} +1 -1
- package/manage/scripts/{versions.sh → ci/versions.sh} +8 -8
- package/manage/scripts/create-cluster.sh +1 -1
- package/manage/scripts/create-mode.sh +11 -18
- package/manage/scripts/devzone-create.sh +7 -35
- package/manage/scripts/devzone-manifest.sh +1 -1
- package/manage/scripts/devzone-update.sh +12 -8
- package/manage/scripts/launch.sh +7 -48
- package/manage/scripts/ports-apps.sh +1 -1
- package/manage/scripts/ports-workspace.sh +7 -7
- package/manage/scripts/poste.sh +6 -7
- package/manage/scripts/uninstall.sh +8 -8
- package/manage/scripts/workspace-egress.sh +2 -2
- package/manage/scripts/workspace-update.sh +5 -2
- package/manage/scripts/workspace-wait.sh +2 -2
- package/manage/workspace.sh +2 -12
- package/package.json +1 -1
- package/.devcontainer/docker-relay.sh +0 -149
- package/.devcontainer/docker-without-host.sh +0 -12
- package/.devcontainer/git-identite.sh +0 -28
- package/manage/scripts/docker-workstation.sh +0 -73
- package/manage/scripts/migrate-revert.sh +0 -60
- package/manage/scripts/migrate.sh +0 -243
- /package/manage/scripts/{ci-dns.sh → ci/ci-dns.sh} +0 -0
|
@@ -163,7 +163,7 @@ spec:
|
|
|
163
163
|
- name: DEVZONE_VERSION
|
|
164
164
|
value: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
|
|
165
165
|
# Root of the devzone projects in the Kubernetes workspace (#503)
|
|
166
|
-
- name:
|
|
166
|
+
- name: DEVZONE_ROOT
|
|
167
167
|
value: /workspaces/projets
|
|
168
168
|
# Global npm prefix, stored on the mounted state volume (#503)
|
|
169
169
|
- name: NPM_CONFIG_PREFIX
|
package/manage/devzone
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# devzone --version | --help
|
|
7
7
|
# In the container, « devzone » is another command: the modules
|
|
8
8
|
# (.devcontainer/devzone).
|
|
9
|
-
#
|
|
9
|
+
# DEVZONE_NO_START=1: copy only, without starting the container (tests).
|
|
10
10
|
# The helpers live in manage/scripts/devzone-*.sh, sourced by the command that
|
|
11
11
|
# needs them (so --version and --help work with this file alone).
|
|
12
12
|
# shellcheck disable=SC2034 # PACKAGE_ITEMS, GITIGNORE_LINES: read by the sourced devzone-*.sh
|
|
@@ -31,11 +31,9 @@ GITIGNORE_LINES=(
|
|
|
31
31
|
'!workspace/.gitkeep'
|
|
32
32
|
'.DS_Store'
|
|
33
33
|
'.devzone.log'
|
|
34
|
-
'.devzone.
|
|
34
|
+
'.devzone.state'
|
|
35
35
|
'.password'
|
|
36
|
-
'.devzone.
|
|
37
|
-
'.devcontainer/sans-docker-hote/'
|
|
38
|
-
'.devcontainer/without-host-docker/'
|
|
36
|
+
'.devzone.backup/'
|
|
39
37
|
)
|
|
40
38
|
|
|
41
39
|
# Version of the package (package.json next to manage/)
|
|
@@ -50,26 +48,24 @@ show_help() {
|
|
|
50
48
|
cat <<EOT
|
|
51
49
|
devzone $(version) : environnement de développement conteneurisé
|
|
52
50
|
|
|
53
|
-
devzone <dossier> [--gitops github|none|<url>] [--kubernetes
|
|
51
|
+
devzone <dossier> [--gitops github|none|<url>] [--kubernetes]
|
|
54
52
|
crée un devzone dans <dossier> puis le lance ;
|
|
55
53
|
GitOps repository for Argo CD: github, or a URL, or none
|
|
56
54
|
--kubernetes: workspace in the cluster (default when it answers;
|
|
57
55
|
fails with nothing created without one)
|
|
58
|
-
--docker: deprecated Docker workstation, no cluster check
|
|
59
|
-
(without a cluster nothing is created, no silent Docker)
|
|
60
56
|
devzone update [--yes] [--sans-reconstruire]
|
|
61
57
|
dans un dossier devzone : passe à la version du paquet
|
|
62
58
|
(sauvegarde les fichiers remplacés, propose make rebuild)
|
|
63
59
|
devzone uninstall dans un dossier devzone : retire conteneur, image, volumes
|
|
64
60
|
(à lancer avant npm uninstall -g devzone)
|
|
65
61
|
devzone workspace start|stop|status|shell|update
|
|
66
|
-
devzone workspace vscode|copy-to|copy-from|clone
|
|
62
|
+
devzone workspace vscode|copy-to|copy-from|clone
|
|
67
63
|
poste Kubernetes : pilote le chart devzone-workspace
|
|
68
64
|
devzone workspace services enable|disable <service>|status
|
|
69
65
|
services (gitlab, postgres, argocd) du workspace Kubernetes
|
|
70
66
|
devzone workspace argocd status|init|apply|app add|list|remove
|
|
71
67
|
Argo CD du workspace : dépôt GitOps, .argocd.conf, projets
|
|
72
|
-
(
|
|
68
|
+
(old French names: refused with the new name, see the README, « Removed names »)
|
|
73
69
|
devzone --version
|
|
74
70
|
EOT
|
|
75
71
|
}
|
|
@@ -121,7 +117,7 @@ case "${1:-}" in
|
|
|
121
117
|
echo "✖ À lancer dans un dossier devzone (uninstall.sh introuvable ici)." >&2
|
|
122
118
|
exit 1
|
|
123
119
|
fi
|
|
124
|
-
|
|
120
|
+
DEVZONE_COMMAND="devzone uninstall" bash "$uninstaller"
|
|
125
121
|
;;
|
|
126
122
|
workspace)
|
|
127
123
|
bash "$PAQUET/manage/workspace.sh" "${@:2}"
|
|
@@ -131,7 +131,7 @@ argocd_save_admin_password() {
|
|
|
131
131
|
|
|
132
132
|
# .password of the workstation regenerated from workspace/.*/ (password.sh of the package)
|
|
133
133
|
argocd_passwords_refresh() {
|
|
134
|
-
|
|
134
|
+
DEVZONE_ROOT="$PWD" bash "$RACINE/.devcontainer/password.sh" regenerer 2>/dev/null ||
|
|
135
135
|
echo "⚠ .password not updated (bash .devcontainer/password.sh regenerer)" >&2
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
set -u
|
|
17
17
|
|
|
18
18
|
ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
19
|
-
ROOT="$(cd "$ICI
|
|
19
|
+
ROOT="$(cd "$ICI/../../.." && pwd)"
|
|
20
20
|
CHARTS_DIR="${CHARTS_DIR:-$ROOT/charts}"
|
|
21
21
|
CHARTS_CODE_DIRS="${CHARTS_CODE_DIRS:-$ROOT/.devcontainer $ROOT/manage/scripts}"
|
|
22
22
|
# The workstation keeps its own values (per volume, not a shared service)
|
|
@@ -4,21 +4,22 @@
|
|
|
4
4
|
# list of French words below. Each fault is printed as "path: word" and the
|
|
5
5
|
# run exits 1; otherwise it prints "names check: N paths ok" and exits 0.
|
|
6
6
|
# Not checked: .github/ (the workflow names are referenced by the repowarden
|
|
7
|
-
# checks) and the names listed in ALLOWED (
|
|
8
|
-
#
|
|
7
|
+
# checks) and the names listed in ALLOWED (user data kept under its name, and
|
|
8
|
+
# the migration script, which must hold the former names). bash 3.2 (macOS).
|
|
9
9
|
|
|
10
10
|
set -u
|
|
11
11
|
|
|
12
12
|
ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
-
ROOT="$(cd "$ICI
|
|
13
|
+
ROOT="$(cd "$ICI/../../.." && pwd)"
|
|
14
14
|
|
|
15
15
|
# French words that must not appear in a name. Split fragments, so this file
|
|
16
16
|
# does not match its own rules (the check-english convention).
|
|
17
|
-
FRENCH=" cre_er desinst_aller migr_er ret_our et_at demarr_age catalog_ue paqu_ets plate_forme memo_ire rel_ais verr_ou veill_eur dro_its err_eurs mod_ele mod_eles ec_arts chem_ins para_llele ho_te san_s ave_c envel_oppe join_gnable isole_ment comp_te lan_cer rep_arer util_iser garde_ mett_re "
|
|
17
|
+
FRENCH=" cre_er desinst_aller migr_er ret_our et_at demarr_age catalog_ue paqu_ets plate_forme memo_ire rel_ais verr_ou veill_eur dro_its err_eurs mod_ele mod_eles ec_arts chem_ins para_llele ho_te san_s ave_c envel_oppe join_gnable isole_ment comp_te lan_cer rep_arer util_iser garde_ mett_re identi_te invi_te "
|
|
18
18
|
FRENCH="$(printf '%s' "$FRENCH" | tr -d '_')"
|
|
19
19
|
|
|
20
|
-
# Names of the user data
|
|
21
|
-
|
|
20
|
+
# Names of the user data kept as they are, and the migration script (#733, it
|
|
21
|
+
# holds the former names to rename them)
|
|
22
|
+
ALLOWED=" .devzone.modules .devzone.version .devcontainer/rename-legacy-files.sh "
|
|
22
23
|
|
|
23
24
|
if ! paths="$(git -C "$ROOT" ls-files --cached --others --exclude-standard)"; then
|
|
24
25
|
echo "check-names: git ls-files fails in $ROOT" >&2
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
set -u
|
|
12
12
|
|
|
13
13
|
ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
14
|
-
ROOT="$(cd "$ICI
|
|
14
|
+
ROOT="$(cd "$ICI/../../.." && pwd)"
|
|
15
15
|
|
|
16
16
|
# Byte matching only. The class is every byte outside printable ASCII, minus
|
|
17
17
|
# the tab (a tab after a name is not a fault). Built from a printf so this
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
# Pinned container versions: compares repowarden (versions.env) and AI
|
|
3
3
|
# assistants (IA_… lines, devzone) to the latest npm version, or applies an
|
|
4
4
|
# upgrade.
|
|
5
|
-
# bash manage/scripts/versions.sh
|
|
5
|
+
# bash manage/scripts/ci/versions.sh
|
|
6
6
|
# one "package old new" line per outdated package, nothing otherwise
|
|
7
|
-
# bash manage/scripts/versions.sh --installed
|
|
7
|
+
# bash manage/scripts/ci/versions.sh --installed
|
|
8
8
|
# one "package pinned installed" line per installed tool behind its pin
|
|
9
|
-
# bash manage/scripts/versions.sh --apply <package> <version>
|
|
9
|
+
# bash manage/scripts/ci/versions.sh --apply <package> <version>
|
|
10
10
|
# replaces that pinned version in its file, nothing else
|
|
11
|
-
# bash manage/scripts/versions.sh --existing-ticket <package> <author>
|
|
11
|
+
# bash manage/scripts/ci/versions.sh --existing-ticket <package> <author>
|
|
12
12
|
# "number<TAB>title" of the open ticket by <author>, nothing otherwise
|
|
13
13
|
# Compatible with bash 3.2 (macOS).
|
|
14
14
|
set -euo pipefail
|
|
15
15
|
|
|
16
|
-
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")
|
|
16
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
|
17
17
|
VERSIONS_ENV="$HERE/.devcontainer/versions.env"
|
|
18
18
|
DEVZONE="$HERE/.devcontainer/devzone"
|
|
19
19
|
|
|
@@ -153,17 +153,17 @@ case "${1:-}" in
|
|
|
153
153
|
--installed | --installees) compare_installed ;;
|
|
154
154
|
--apply | --appliquer)
|
|
155
155
|
[ "$#" -eq 3 ] ||
|
|
156
|
-
{ echo "usage: bash manage/scripts/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2; exit 2; }
|
|
156
|
+
{ echo "usage: bash manage/scripts/ci/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2; exit 2; }
|
|
157
157
|
apply "$2" "$3"
|
|
158
158
|
;;
|
|
159
159
|
--existing-ticket | --ticket-existant)
|
|
160
160
|
[ "$#" -eq 3 ] ||
|
|
161
|
-
{ echo "usage: bash manage/scripts/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2; exit 2; }
|
|
161
|
+
{ echo "usage: bash manage/scripts/ci/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2; exit 2; }
|
|
162
162
|
existing_ticket "$2" "$3"
|
|
163
163
|
;;
|
|
164
164
|
-h | --help) sed -n '2,17p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//' ;;
|
|
165
165
|
*)
|
|
166
|
-
echo "usage: bash manage/scripts/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2
|
|
166
|
+
echo "usage: bash manage/scripts/ci/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2
|
|
167
167
|
exit 2
|
|
168
168
|
;;
|
|
169
169
|
esac
|
|
@@ -81,7 +81,7 @@ create_cluster_minikube() {
|
|
|
81
81
|
printf 'Create it now? [y/N] '
|
|
82
82
|
read -r answer || answer=""
|
|
83
83
|
case "$answer" in
|
|
84
|
-
y | Y | yes
|
|
84
|
+
y | Y | yes) ;;
|
|
85
85
|
*) echo "✖ cancelled" >&2; return 1 ;;
|
|
86
86
|
esac
|
|
87
87
|
minikube start -p devzone || { echo "✖ minikube start failed: nothing else done" >&2; return 1; }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# cluster
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
2
|
+
# Workspace mode at creation (#497): a new devzone is a Kubernetes workspace,
|
|
3
|
+
# so the cluster must answer. Without a cluster there is no fallback (#671):
|
|
4
|
+
# creation stops and lists the ways to get a cluster. The Docker workstation is
|
|
5
|
+
# retired (#735). Sourced by manage/devzone (creer): create_mode_choose runs
|
|
6
|
+
# before any file is copied (so --kubernetes without a cluster creates
|
|
7
|
+
# nothing), create_mode_write once the folder exists.
|
|
8
8
|
# Sourced only: no code at file level. Compatible with bash 3.2 (macOS).
|
|
9
9
|
# shellcheck disable=SC2034 # CREATE_MODE is read by manage/devzone (creer)
|
|
10
10
|
# shellcheck source=manage/scripts/kube-ready.sh
|
|
@@ -34,21 +34,14 @@ create_mode_no_cluster() {
|
|
|
34
34
|
kubectl config use-context <context>
|
|
35
35
|
- a local cluster: Docker Desktop (Settings > Kubernetes > Enable Kubernetes), or minikube
|
|
36
36
|
minikube start -p devzone
|
|
37
|
-
--docker still creates the Docker workstation, deprecated: it will be removed
|
|
38
37
|
EOF
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
# Chooses the mode from the option (kubernetes
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
# workstation was not asked with --docker.
|
|
40
|
+
# Chooses the mode from the option (kubernetes or empty) and sets CREATE_MODE
|
|
41
|
+
# to kubernetes, with one line of notice. Returns 1, nothing set on disk, when
|
|
42
|
+
# the cluster does not answer.
|
|
45
43
|
create_mode_choose() {
|
|
46
44
|
local option="$1" reason
|
|
47
|
-
if [ "$option" = docker ]; then
|
|
48
|
-
CREATE_MODE=docker
|
|
49
|
-
echo "⚠ Docker workstation (--docker) is deprecated and will be removed: devzone workspace migrate moves it to the cluster"
|
|
50
|
-
return 0
|
|
51
|
-
fi
|
|
52
45
|
if reason="$(kube_ready_reason)"; then
|
|
53
46
|
CREATE_MODE=kubernetes
|
|
54
47
|
echo "✔ Kubernetes ready ($(kube_context)): workspace in the cluster"
|
|
@@ -94,10 +87,10 @@ create_mode_write() {
|
|
|
94
87
|
|
|
95
88
|
# Kubernetes creation: installs the workspace from the package script, run in
|
|
96
89
|
# the new folder (as devzone workspace start does). DEVZONE_WORKSPACE_SH
|
|
97
|
-
# replaces the script (tests);
|
|
90
|
+
# replaces the script (tests); DEVZONE_NO_START only prints the command.
|
|
98
91
|
create_mode_start() {
|
|
99
92
|
local folder="$1" script="$2"
|
|
100
|
-
if [ -n "${
|
|
93
|
+
if [ -n "${DEVZONE_NO_START:-}" ]; then
|
|
101
94
|
echo "To start the workspace: cd $folder && devzone workspace start"
|
|
102
95
|
return 0
|
|
103
96
|
fi
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Creation of a devzone (devzone <folder>): asks for the GitOps repository,
|
|
3
3
|
# copies the package, writes .argocd.conf and the manifest, then starts the
|
|
4
|
-
# workspace
|
|
4
|
+
# workspace in the cluster. Sourced by manage/devzone,
|
|
5
5
|
# which defines PAQUET, PACKAGE_ITEMS and version(); devzone-manifest.sh must
|
|
6
6
|
# be sourced first.
|
|
7
7
|
# shellcheck disable=SC2154 # PAQUET, PACKAGE_ITEMS: set by manage/devzone
|
|
@@ -18,8 +18,8 @@ ask_gitops() {
|
|
|
18
18
|
read -r answer || answer=""
|
|
19
19
|
answer="${answer:-$default}"
|
|
20
20
|
case "$answer" in
|
|
21
|
-
G | g | GitHub | github |
|
|
22
|
-
n | N | none | None
|
|
21
|
+
G | g | GitHub | github | y | Y | yes) echo "github" ;;
|
|
22
|
+
n | N | none | None) echo "none" ;;
|
|
23
23
|
*) echo "$answer" ;;
|
|
24
24
|
esac
|
|
25
25
|
}
|
|
@@ -32,14 +32,8 @@ create_workstation() {
|
|
|
32
32
|
case "$arg" in
|
|
33
33
|
--gitops) expect=gitops ;;
|
|
34
34
|
--gitops=*) gitops="${arg#--gitops=}" ;;
|
|
35
|
-
--kubernetes
|
|
36
|
-
|
|
37
|
-
echo "✖ --kubernetes and --docker: choose one" >&2
|
|
38
|
-
exit 1
|
|
39
|
-
fi
|
|
40
|
-
option="${arg#--}"
|
|
41
|
-
;;
|
|
42
|
-
*) echo "✖ option inconnue : $arg (devzone <dossier> [--gitops github|none|<url>] [--kubernetes|--docker])" >&2; exit 1 ;;
|
|
35
|
+
--kubernetes) option=kubernetes ;;
|
|
36
|
+
*) echo "✖ option inconnue : $arg (devzone <dossier> [--gitops github|none|<url>] [--kubernetes])" >&2; exit 1 ;;
|
|
43
37
|
esac
|
|
44
38
|
done
|
|
45
39
|
if [ -n "$expect" ]; then
|
|
@@ -111,28 +105,6 @@ create_workstation() {
|
|
|
111
105
|
target="$(cd "$target" && pwd)"
|
|
112
106
|
write_manifest "$target"
|
|
113
107
|
echo "✔ devzone $(version) créé dans $target"
|
|
114
|
-
#
|
|
115
|
-
|
|
116
|
-
if [ "$CREATE_MODE" = kubernetes ]; then
|
|
117
|
-
create_mode_start "$target" "$PAQUET/manage/workspace.sh"
|
|
118
|
-
return
|
|
119
|
-
fi
|
|
120
|
-
if [ -n "${DEVZONE_SANS_DEMARRER:-}" ]; then
|
|
121
|
-
echo "Pour le lancer : cd $target && make up"
|
|
122
|
-
return 0
|
|
123
|
-
fi
|
|
124
|
-
# Docker first: the folder stays ready, to start once Docker is running
|
|
125
|
-
# shellcheck source=SCRIPTDIR/docker.sh
|
|
126
|
-
. "$PAQUET/manage/scripts/docker.sh"
|
|
127
|
-
if ! docker_ready "cd $target && make shell"; then
|
|
128
|
-
echo " Le dossier est prêt : rien à refaire, sauf ce lancement." >&2
|
|
129
|
-
exit 1
|
|
130
|
-
fi
|
|
131
|
-
echo "▶ Lancement (quelques minutes la première fois)…"
|
|
132
|
-
if command -v make >/dev/null 2>&1; then
|
|
133
|
-
make -C "$target" up
|
|
134
|
-
else
|
|
135
|
-
bash "$target/manage/scripts/launch.sh" up "$target"
|
|
136
|
-
fi
|
|
137
|
-
echo "Ensuite : cd $target && make shell (ou ouvre le dossier dans VS Code : Reopen in Container)."
|
|
108
|
+
# The workspace goes to the cluster (kube check done by create_mode_choose)
|
|
109
|
+
create_mode_start "$target" "$PAQUET/manage/workspace.sh"
|
|
138
110
|
}
|
|
@@ -122,7 +122,7 @@ inside_folder() {
|
|
|
122
122
|
is_protected() {
|
|
123
123
|
case "$1" in
|
|
124
124
|
workspace | workspace/* | .devzone.version | .devzone.modules | .devzone.modules-* | \
|
|
125
|
-
.devzone.
|
|
125
|
+
.devzone.packages | .password | .app | .devzone.log | .git | .git/*) return 0 ;;
|
|
126
126
|
esac
|
|
127
127
|
return 1
|
|
128
128
|
}
|
|
@@ -116,13 +116,13 @@ update_workstation() {
|
|
|
116
116
|
done <"$work/modified"
|
|
117
117
|
if [ -z "$assume_yes" ]; then
|
|
118
118
|
if [ ! -t 0 ]; then
|
|
119
|
-
echo "✖ Fichiers modifiés localement : relance avec --yes pour les remplacer (sauvegarde dans .devzone.
|
|
119
|
+
echo "✖ Fichiers modifiés localement : relance avec --yes pour les remplacer (sauvegarde dans .devzone.backup/)." >&2
|
|
120
120
|
exit 1
|
|
121
121
|
fi
|
|
122
|
-
printf '
|
|
122
|
+
printf 'Replace these files (backup in .devzone.backup/)? [y/N] ' >&2
|
|
123
123
|
read -r answer || answer=""
|
|
124
124
|
case "$answer" in
|
|
125
|
-
|
|
125
|
+
y | Y | yes) ;;
|
|
126
126
|
*)
|
|
127
127
|
echo "Abandon : rien n'a été modifié."
|
|
128
128
|
return 1
|
|
@@ -131,9 +131,13 @@ update_workstation() {
|
|
|
131
131
|
fi
|
|
132
132
|
fi
|
|
133
133
|
|
|
134
|
+
# Former French names renamed before the backup (#733): the backup folder is
|
|
135
|
+
# .devzone.backup. The script comes from the package, the folder may be old
|
|
136
|
+
DEVZONE_ROOT="$folder" bash "$PAQUET/.devcontainer/rename-legacy-files.sh" || true
|
|
137
|
+
|
|
134
138
|
# 3. Backup of every file replaced or removed
|
|
135
139
|
if [ -s "$work/to_save" ]; then
|
|
136
|
-
base="$folder/.devzone.
|
|
140
|
+
base="$folder/.devzone.backup/$(date +%Y%m%d-%H%M%S)"
|
|
137
141
|
backup="$base"
|
|
138
142
|
n=1
|
|
139
143
|
while [ -e "$backup" ]; do
|
|
@@ -205,17 +209,17 @@ update_workstation() {
|
|
|
205
209
|
echo "Reconstruction : make -C $folder rebuild (à lancer dans un terminal)"
|
|
206
210
|
return 0
|
|
207
211
|
fi
|
|
208
|
-
printf '
|
|
212
|
+
printf 'Rebuild the container now (make rebuild)? [y/N] ' >&2
|
|
209
213
|
read -r answer || answer=""
|
|
210
214
|
case "$answer" in
|
|
211
|
-
|
|
215
|
+
y | Y | yes) ;;
|
|
212
216
|
*)
|
|
213
217
|
echo "Reconstruction non lancée : make -C $folder rebuild"
|
|
214
218
|
return 0
|
|
215
219
|
;;
|
|
216
220
|
esac
|
|
217
|
-
if [ -n "${
|
|
218
|
-
sh -c "$
|
|
221
|
+
if [ -n "${DEVZONE_REBUILD:-}" ]; then
|
|
222
|
+
sh -c "$DEVZONE_REBUILD"
|
|
219
223
|
else
|
|
220
224
|
make -C "$folder" rebuild
|
|
221
225
|
fi
|
package/manage/scripts/launch.sh
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
# bash manage/scripts/launch.sh up [folder] (make up)
|
|
4
4
|
# bash manage/scripts/launch.sh rebuild [folder] (make rebuild: rebuild from scratch)
|
|
5
5
|
# Full devcontainer CLI output goes to <folder>/.devzone.log; the terminal shows
|
|
6
|
-
# key steps, a heartbeat at least every
|
|
6
|
+
# key steps, a heartbeat at least every DEVZONE_HEARTBEAT seconds (30), and a
|
|
7
7
|
# question asked inside the container (last log line left unanswered for
|
|
8
|
-
#
|
|
8
|
+
# DEVZONE_QUESTION_WAIT seconds, 20) is shown and startup is stopped: nobody
|
|
9
9
|
# can answer it (the CLI runs without input), waiting would hang forever.
|
|
10
10
|
# Portable: bash 3.2 (macOS) and Linux.
|
|
11
11
|
set -uo pipefail
|
|
@@ -21,50 +21,9 @@ case "$mode" in
|
|
|
21
21
|
;;
|
|
22
22
|
esac
|
|
23
23
|
|
|
24
|
-
# Host Docker socket (#432): docker-hote line in instance state, written by devzone
|
|
25
|
-
# inside the container. Missing or on: historical behavior.
|
|
26
|
-
host_off() {
|
|
27
|
-
local v
|
|
28
|
-
v="$(grep -E '^docker-hote=' "$FOLDER/.devzone.modules" 2>/dev/null | tail -1 | cut -d= -f2 || true)"
|
|
29
|
-
[ "$v" = off ]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
# Copy of devcontainer.json without the docker-outside-of-docker feature, for a
|
|
33
|
-
# container without the host socket. The file lives one level deeper: build
|
|
34
|
-
# paths go up one level (../). Written at each start, in a git-ignored folder;
|
|
35
|
-
# comments from the original JSON are kept.
|
|
36
|
-
# shellcheck disable=SC2034
|
|
37
|
-
generate_config_without_host_docker() {
|
|
38
|
-
local folder="$FOLDER/.devcontainer/without-host-docker" context=no
|
|
39
|
-
grep -q '"context"' "$FOLDER/.devcontainer/devcontainer.json" && context=yes
|
|
40
|
-
mkdir -p "$folder"
|
|
41
|
-
awk -v context="$context" '
|
|
42
|
-
/ghcr\.io\/devcontainers\/features\/docker-outside-of-docker/ { next }
|
|
43
|
-
/"build"[[:space:]]*:[[:space:]]*\{[[:space:]]*"dockerfile"[[:space:]]*:[[:space:]]*"Dockerfile"[[:space:]]*\}/ {
|
|
44
|
-
sub(/\{[[:space:]]*"dockerfile"[[:space:]]*:[[:space:]]*"Dockerfile"[[:space:]]*\}/,
|
|
45
|
-
"{ \"dockerfile\": \"../Dockerfile\", \"context\": \"..\" }")
|
|
46
|
-
print
|
|
47
|
-
next
|
|
48
|
-
}
|
|
49
|
-
context == "no" && /"build"[[:space:]]*:[[:space:]]*\{[[:space:]]*$/ {
|
|
50
|
-
print
|
|
51
|
-
print " \"context\": \"..\","
|
|
52
|
-
next
|
|
53
|
-
}
|
|
54
|
-
/"dockerfile"[[:space:]]*:/ {
|
|
55
|
-
sub(/"dockerfile"[[:space:]]*:[[:space:]]*"[^"]*"/, "\"dockerfile\": \"../Dockerfile\"")
|
|
56
|
-
}
|
|
57
|
-
{ print }
|
|
58
|
-
' "$FOLDER/.devcontainer/devcontainer.json" >"$folder/devcontainer.json"
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if host_off; then
|
|
62
|
-
generate_config_without_host_docker
|
|
63
|
-
options+=(--config "$FOLDER/.devcontainer/without-host-docker/devcontainer.json")
|
|
64
|
-
fi
|
|
65
24
|
LOG="$FOLDER/.devzone.log"
|
|
66
|
-
HEARTBEAT="${
|
|
67
|
-
QUESTION_WAIT="${
|
|
25
|
+
HEARTBEAT="${DEVZONE_HEARTBEAT:-30}"
|
|
26
|
+
QUESTION_WAIT="${DEVZONE_QUESTION_WAIT:-20}"
|
|
68
27
|
ESC="$(printf '\033')"
|
|
69
28
|
|
|
70
29
|
# Readable log line: without color codes or carriage returns
|
|
@@ -73,7 +32,7 @@ clean_line() { sed "s/${ESC}\[[0-9;?]*[A-Za-z]//g" | tr -d '\r'; }
|
|
|
73
32
|
last_line() { tail -c 2000 "$LOG" | clean_line | grep -v '^[[:space:]]*$' | tail -1 | cut -c1-110; }
|
|
74
33
|
|
|
75
34
|
# Pending question: last unfinished line (no newline, like a prompt) ending with
|
|
76
|
-
# [
|
|
35
|
+
# [y/N], ? or a password prompt
|
|
77
36
|
pattern='(\[[^]]*/[^]]*\]|\?|[Pp]assword[^:]*:|[Mm]ot de passe[^:]*:)[[:space:]]*$'
|
|
78
37
|
pending_question() {
|
|
79
38
|
local line
|
|
@@ -97,7 +56,7 @@ show_steps() {
|
|
|
97
56
|
*"Start: Run: docker run"*) announce container "Creating container" ;;
|
|
98
57
|
*"Running the postCreateCommand"*) announce postcreate "Installing in container (repowarden, modules)" ;;
|
|
99
58
|
*"Running the postStartCommand"*) announce poststart "Starting (git identity, clusters, state)" ;;
|
|
100
|
-
"devzone ready"* | "devzone started"* | "devzone rebuilt"* | "devzone : "* | "devzone: "* | " ✔ "* | " ✖ "* | " ○ "* | " ⚠ "* | " "[!\ ]* | "git-
|
|
59
|
+
"devzone ready"* | "devzone started"* | "devzone rebuilt"* | "devzone : "* | "devzone: "* | " ✔ "* | " ✖ "* | " ○ "* | " ⚠ "* | " "[!\ ]* | "git-identity : "* | "kube-config : "* | "metrics-server : "*)
|
|
101
60
|
echo " $line"
|
|
102
61
|
last_announce="$(date +%s)"
|
|
103
62
|
;;
|
|
@@ -124,7 +83,7 @@ trap 'stop_launch; echo; echo "interrupted - log: .devzone.log"; exit 130' INT T
|
|
|
124
83
|
# Docker first: without it the CLI would only show a raw JSON error
|
|
125
84
|
# shellcheck source=SCRIPTDIR/docker.sh
|
|
126
85
|
. "$(dirname "${BASH_SOURCE[0]}")/docker.sh"
|
|
127
|
-
docker_ready "${
|
|
86
|
+
docker_ready "${DEVZONE_COMMAND:-make $mode}" || exit 1
|
|
128
87
|
|
|
129
88
|
: >"$LOG"
|
|
130
89
|
start="$(date +%s)"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Applications of the Kubernetes workspace relayed on workstation localhost (#611).
|
|
3
3
|
# Sourced by ports-workspace.sh, never run alone. One kubectl get svc -A per
|
|
4
4
|
# round: each TCP port of each Service gets a local port, kept stable in
|
|
5
|
-
# .devzone.ports
|
|
5
|
+
# .devzone.workspace-ports/apps/<namespace>.<service>.<port> while the Service
|
|
6
6
|
# exists. Only Services with a ready endpoint are relayed (#638): the others keep
|
|
7
7
|
# their local port and show as "no ready pod" in status. Output lines:
|
|
8
8
|
# "portlocal|namespace|svc/name|remoteport", as pw_services.
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# Applications and services of the Kubernetes workspace on workstation localhost (#401).
|
|
3
3
|
# Sourced by manage/workspace.sh (ports_* functions); run directly with "loop" or
|
|
4
4
|
# "round", it is the workstation watcher: only one, mkdir lock and pid in
|
|
5
|
-
# .devzone.ports
|
|
5
|
+
# .devzone.workspace-ports/. It relays with kubectl port-forward, on 127.0.0.1
|
|
6
6
|
# only, TCP ports >= 1024 listening in the pod, and devzone services of active
|
|
7
7
|
# modules in .devzone.modules. Guard: never under bats without
|
|
8
|
-
#
|
|
8
|
+
# DEVZONE_PORTS_WORKSPACE_REAL=yes.
|
|
9
9
|
|
|
10
10
|
PW_POD="devzone-workspace-0"
|
|
11
11
|
PW_NS="devzone-workspace"
|
|
@@ -18,7 +18,7 @@ PW_JSONPATH='jsonpath={.spec.ports[0].port}'
|
|
|
18
18
|
. "$(dirname "${BASH_SOURCE[0]}")/ports-apps.sh"
|
|
19
19
|
|
|
20
20
|
# Watcher state folder: lock, pid, relays, reported ports, log.
|
|
21
|
-
pw_dir() { printf '%s' "${DEVZONE_PORTS_WORKSPACE_DIR:-$PWD/.devzone.ports
|
|
21
|
+
pw_dir() { printf '%s' "${DEVZONE_PORTS_WORKSPACE_DIR:-$PWD/.devzone.workspace-ports}"; }
|
|
22
22
|
|
|
23
23
|
# kubectl context flag: devzone if it exists, otherwise current context.
|
|
24
24
|
pw_ctx() {
|
|
@@ -33,10 +33,10 @@ pw_kubectl() {
|
|
|
33
33
|
kubectl $(pw_ctx) "$@"
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
# Guard: refuse under bats without
|
|
36
|
+
# Guard: refuse under bats without DEVZONE_PORTS_WORKSPACE_REAL=yes (message if $1 empty).
|
|
37
37
|
pw_guard() {
|
|
38
|
-
if [ -n "${BATS_TEST_TMPDIR:-}" ] && [ "${
|
|
39
|
-
[ -n "${1:-}" ] || echo "✖ port watcher refused under bats (
|
|
38
|
+
if [ -n "${BATS_TEST_TMPDIR:-}" ] && [ "${DEVZONE_PORTS_WORKSPACE_REAL:-}" != yes ]; then
|
|
39
|
+
[ -n "${1:-}" ] || echo "✖ port watcher refused under bats (DEVZONE_PORTS_WORKSPACE_REAL=yes required)" >&2
|
|
40
40
|
return 2
|
|
41
41
|
fi
|
|
42
42
|
}
|
|
@@ -155,7 +155,7 @@ pw_loop() {
|
|
|
155
155
|
trap 'pw_remove_all; rm -rf "$d/verrou" "$d/pid"; exit 0' TERM INT
|
|
156
156
|
while :; do
|
|
157
157
|
pw_round || true
|
|
158
|
-
sleep "${
|
|
158
|
+
sleep "${DEVZONE_PORTS_WORKSPACE_STEP:-3}" &
|
|
159
159
|
wait $!
|
|
160
160
|
done
|
|
161
161
|
}
|
package/manage/scripts/poste.sh
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Why: make up|shell|stop|rebuild always
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# Why: make up|shell|stop|rebuild always drove the Docker container, even
|
|
3
|
+
# once a folder was in Kubernetes mode (#472). The Docker workstation is retired
|
|
4
|
+
# (#735), but a folder still marked workspace=kubernetes in .devzone.modules
|
|
5
|
+
# must keep working. This script reads that mode: in Kubernetes it hands
|
|
5
6
|
# off to manage/workspace.sh (repo clone) or npx devzone@<version> workspace
|
|
6
7
|
# (folder created by npx devzone); in Docker it returns 3 and does nothing, so
|
|
7
8
|
# the Makefile keeps its original recipe. The advice target shows, after an
|
|
@@ -68,12 +69,10 @@ if [ -z "$folder" ]; then
|
|
|
68
69
|
exit 2
|
|
69
70
|
fi
|
|
70
71
|
|
|
71
|
-
# Advice after update: always exit 0,
|
|
72
|
+
# Advice after update: always exit 0, silent for a Docker folder (#735).
|
|
72
73
|
if [ "$target" = "advice" ] || [ "$target" = "conseil" ]; then
|
|
73
74
|
if [ "$(workspace_mode "$folder")" = kubernetes ]; then
|
|
74
75
|
echo "Kubernetes workspace: the new image is used on the next devzone workspace start (or make up)."
|
|
75
|
-
elif kube_ready_reason >/dev/null; then
|
|
76
|
-
echo "Kubernetes reachable: devzone workspace migrate moves this workstation to the cluster (nothing is deleted, rollback: devzone workspace revert)."
|
|
77
76
|
fi
|
|
78
77
|
exit 0
|
|
79
78
|
fi
|
|
@@ -86,7 +85,7 @@ case "$target" in
|
|
|
86
85
|
shell) workspace_cmd "$folder" start && workspace_cmd "$folder" shell ;;
|
|
87
86
|
stop) workspace_cmd "$folder" stop ;;
|
|
88
87
|
rebuild)
|
|
89
|
-
echo "✖ make rebuild: this workstation is in Kubernetes workspace mode (workspace=kubernetes in .devzone.modules), nothing to rebuild on the machine
|
|
88
|
+
echo "✖ make rebuild: this workstation is in Kubernetes workspace mode (workspace=kubernetes in .devzone.modules), nothing to rebuild on the machine" >&2
|
|
90
89
|
exit 1
|
|
91
90
|
;;
|
|
92
91
|
esac
|
|
@@ -15,7 +15,7 @@ set -euo pipefail
|
|
|
15
15
|
# devzone folder: two levels above the script (manage/scripts/), so the command
|
|
16
16
|
# works when run from any folder
|
|
17
17
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
18
|
-
STATE="$HERE/.devzone.
|
|
18
|
+
STATE="$HERE/.devzone.state"
|
|
19
19
|
KEEP="${KEEP:-${GARDER:-}}"
|
|
20
20
|
LOGINS=(gh git claude opencode-config opencode-data config)
|
|
21
21
|
LOCAL_CTX='^(kind-.*|docker-desktop|rancher-desktop|orbstack|minikube)$'
|
|
@@ -29,7 +29,7 @@ esac
|
|
|
29
29
|
# Docker first: without it every docker call would show its raw error
|
|
30
30
|
# shellcheck source=SCRIPTDIR/docker.sh
|
|
31
31
|
. "$(dirname "${BASH_SOURCE[0]}")/docker.sh"
|
|
32
|
-
docker_ready "${
|
|
32
|
+
docker_ready "${DEVZONE_COMMAND:-make desinstaller}" || exit 1
|
|
33
33
|
|
|
34
34
|
# .argocd.conf of the devzone folder: the GitOps repository is never removed
|
|
35
35
|
# with the devzone, only its designation can be changed later
|
|
@@ -52,10 +52,10 @@ fi
|
|
|
52
52
|
# (DEVZONE_VOLUMES) is unknown here. Touching Docker from the container could
|
|
53
53
|
# remove another instance's resources (or the default instance): only the
|
|
54
54
|
# Kubernetes part is handled.
|
|
55
|
-
#
|
|
56
|
-
case "${
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
# DEVZONE_IN_CONTAINER=yes|no forces the mode (tests, which run inside a container)
|
|
56
|
+
case "${DEVZONE_IN_CONTAINER:-}" in
|
|
57
|
+
yes) INSIDE_CONTAINER=true ;;
|
|
58
|
+
no) INSIDE_CONTAINER=false ;;
|
|
59
59
|
*) INSIDE_CONTAINER=false; [ ! -f /.dockerenv ] || INSIDE_CONTAINER=true ;;
|
|
60
60
|
esac
|
|
61
61
|
|
|
@@ -168,14 +168,14 @@ if [ "$total" -eq 0 ]; then
|
|
|
168
168
|
echo "✔ Nothing to remove."
|
|
169
169
|
else
|
|
170
170
|
CONFIRM_VALUE="${CONFIRM:-${CONFIRMER:-}}"
|
|
171
|
-
if [ "$CONFIRM_VALUE" != yes ]
|
|
171
|
+
if [ "$CONFIRM_VALUE" != yes ]; then
|
|
172
172
|
if [ ! -t 0 ]; then
|
|
173
173
|
echo "✖ Cannot confirm without a terminal: CONFIRM=yes make desinstaller" >&2
|
|
174
174
|
exit 1
|
|
175
175
|
fi
|
|
176
176
|
read -r -p "Permanently remove? Type yes: " answer
|
|
177
177
|
case "$answer" in
|
|
178
|
-
yes
|
|
178
|
+
yes) ;;
|
|
179
179
|
*) echo "Canceled: nothing was removed."; exit 0 ;;
|
|
180
180
|
esac
|
|
181
181
|
fi
|