devzone 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/devzone +92 -1495
- 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 +195 -194
- package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
- package/manage/devzone +5 -7
- package/manage/scripts/argocd-workspace.sh +1 -1
- package/manage/scripts/check-names.sh +6 -5
- package/manage/scripts/create-cluster.sh +1 -1
- package/manage/scripts/create-mode.sh +2 -2
- package/manage/scripts/devzone-create.sh +3 -3
- 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/migrate-revert.sh +3 -3
- package/manage/scripts/migrate.sh +7 -13
- package/manage/scripts/ports-apps.sh +1 -1
- package/manage/scripts/ports-workspace.sh +7 -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/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
|
@@ -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/)
|
|
@@ -69,7 +67,7 @@ devzone $(version) : environnement de développement conteneurisé
|
|
|
69
67
|
services (gitlab, postgres, argocd) du workspace Kubernetes
|
|
70
68
|
devzone workspace argocd status|init|apply|app add|list|remove
|
|
71
69
|
Argo CD du workspace : dépôt GitOps, .argocd.conf, projets
|
|
72
|
-
(
|
|
70
|
+
(old French names: refused with the new name, see the README, « Removed names »)
|
|
73
71
|
devzone --version
|
|
74
72
|
EOT
|
|
75
73
|
}
|
|
@@ -121,7 +119,7 @@ case "${1:-}" in
|
|
|
121
119
|
echo "✖ À lancer dans un dossier devzone (uninstall.sh introuvable ici)." >&2
|
|
122
120
|
exit 1
|
|
123
121
|
fi
|
|
124
|
-
|
|
122
|
+
DEVZONE_COMMAND="devzone uninstall" bash "$uninstaller"
|
|
125
123
|
;;
|
|
126
124
|
workspace)
|
|
127
125
|
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
|
|
|
@@ -4,8 +4,8 @@
|
|
|
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
|
|
|
@@ -14,11 +14,12 @@ 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
|
|
@@ -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; }
|
|
@@ -94,10 +94,10 @@ create_mode_write() {
|
|
|
94
94
|
|
|
95
95
|
# Kubernetes creation: installs the workspace from the package script, run in
|
|
96
96
|
# the new folder (as devzone workspace start does). DEVZONE_WORKSPACE_SH
|
|
97
|
-
# replaces the script (tests);
|
|
97
|
+
# replaces the script (tests); DEVZONE_NO_START only prints the command.
|
|
98
98
|
create_mode_start() {
|
|
99
99
|
local folder="$1" script="$2"
|
|
100
|
-
if [ -n "${
|
|
100
|
+
if [ -n "${DEVZONE_NO_START:-}" ]; then
|
|
101
101
|
echo "To start the workspace: cd $folder && devzone workspace start"
|
|
102
102
|
return 0
|
|
103
103
|
fi
|
|
@@ -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
|
}
|
|
@@ -117,7 +117,7 @@ create_workstation() {
|
|
|
117
117
|
create_mode_start "$target" "$PAQUET/manage/workspace.sh"
|
|
118
118
|
return
|
|
119
119
|
fi
|
|
120
|
-
if [ -n "${
|
|
120
|
+
if [ -n "${DEVZONE_NO_START:-}" ]; then
|
|
121
121
|
echo "Pour le lancer : cd $target && make up"
|
|
122
122
|
return 0
|
|
123
123
|
fi
|
|
@@ -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,13 +2,13 @@
|
|
|
2
2
|
# Rollback from Kubernetes workspace to Docker workstation (#403): devzone workspace
|
|
3
3
|
# revert [--bring-back]. Sourced by manage/workspace.sh after migrate.sh (uses
|
|
4
4
|
# copy_from, record_workspace, fail and kc). With --bring-back, the workstation
|
|
5
|
-
# version of a project is moved to .devzone.
|
|
5
|
+
# version of a project is moved to .devzone.backup/<date>/ before being replaced.
|
|
6
6
|
|
|
7
7
|
# Backup folder for this run (relative to devzone), same convention as
|
|
8
|
-
# devzone update: .devzone.
|
|
8
|
+
# devzone update: .devzone.backup/<YYYYMMDD-HHMMSS>, -n suffix if taken.
|
|
9
9
|
backup_folder() {
|
|
10
10
|
local base folder n=1
|
|
11
|
-
base=".devzone.
|
|
11
|
+
base=".devzone.backup/$(date +%Y%m%d-%H%M%S)"
|
|
12
12
|
folder="$base"
|
|
13
13
|
while [ -e "$folder" ]; do
|
|
14
14
|
n=$((n + 1))
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
# vscode home in the pod and image used to copy Docker volumes.
|
|
12
12
|
POD_HOME="/home/vscode"
|
|
13
|
-
COPY_IMAGE="${
|
|
13
|
+
COPY_IMAGE="${DEVZONE_IMAGE_COPY:-busybox:1.36}"
|
|
14
14
|
# Docker workstation volumes: devzone-<x>, or $DEVZONE_VOLUMES-<x> (functional tests).
|
|
15
15
|
DOCKER_VOLUMES=(gh git claude opencode-config opencode-data agent config m2 gradle pnpm)
|
|
16
16
|
# Folder size measurement ($1): "file count bytes".
|
|
@@ -73,7 +73,7 @@ confirm() {
|
|
|
73
73
|
return 1
|
|
74
74
|
fi
|
|
75
75
|
read -r -p "$1 [y/N] " reply || true
|
|
76
|
-
case "$reply" in y | Y | yes | YES | Yes
|
|
76
|
+
case "$reply" in y | Y | yes | YES | Yes) return 0 ;; esac
|
|
77
77
|
echo "✖ canceled, nothing changed" >&2
|
|
78
78
|
return 1
|
|
79
79
|
}
|
|
@@ -163,11 +163,13 @@ step_identities() {
|
|
|
163
163
|
done
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
# Step 4: workstation .devzone.modules and .devzone.
|
|
166
|
+
# Step 4: workstation .devzone.modules and .devzone.packages copied to the pod.
|
|
167
167
|
step_state() {
|
|
168
168
|
local f
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
# Former French names renamed first (#733): the workstation folder may be old
|
|
170
|
+
DEVZONE_ROOT="$PWD" bash "$ROOT/.devcontainer/rename-legacy-files.sh" || true
|
|
171
|
+
echo "▶ [4/5] state: .devzone.modules and .devzone.packages to $PROJECTS_DIR"
|
|
172
|
+
for f in .devzone.modules .devzone.packages; do
|
|
171
173
|
if [ ! -f "$f" ]; then
|
|
172
174
|
echo " – $f: missing on workstation, skipped"
|
|
173
175
|
continue
|
|
@@ -233,11 +235,3 @@ clean_docker() {
|
|
|
233
235
|
echo " ✔ $v removed"
|
|
234
236
|
done
|
|
235
237
|
}
|
|
236
|
-
|
|
237
|
-
# compatibility aliases, removed with lot 4 (#509)
|
|
238
|
-
lire_option() { read_flag "$@"; }
|
|
239
|
-
confirmer() { confirm "$@"; }
|
|
240
|
-
noter_workspace() { record_workspace "$@"; }
|
|
241
|
-
migrer() { migrate_workspace "$@"; }
|
|
242
|
-
nettoyer_docker() { clean_docker "$@"; }
|
|
243
|
-
echec() { fail "$@"; }
|
|
@@ -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
|
}
|
|
@@ -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
|
|
@@ -36,11 +36,11 @@ egress_params() {
|
|
|
36
36
|
|
|
37
37
|
# Waits for the proxy after the redeploy. Argo CD creates its Deployment a few
|
|
38
38
|
# seconds to a minute after the sync: the Deployment is looked up every
|
|
39
|
-
#
|
|
39
|
+
# DEVZONE_EGRESS_STEP s (3 by default) up to DEVZONE_EGRESS_WAIT s (90 by
|
|
40
40
|
# default); then its rollout is awaited for DEVZONE_EGRESS_ROLLOUT s (120 by
|
|
41
41
|
# default). Returns 1 when either is not reached.
|
|
42
42
|
egress_wait_proxy() {
|
|
43
|
-
local limit="${DEVZONE_EGRESS_WAIT:-90}" rollout="${DEVZONE_EGRESS_ROLLOUT:-120}" pas="${
|
|
43
|
+
local limit="${DEVZONE_EGRESS_WAIT:-90}" rollout="${DEVZONE_EGRESS_ROLLOUT:-120}" pas="${DEVZONE_EGRESS_STEP:-3}" attendu=0
|
|
44
44
|
until ak -n "$NAMESPACE" get deployment devzone-workspace-egress-proxy >/dev/null 2>&1; do
|
|
45
45
|
if [ "$attendu" -ge "$limit" ]; then
|
|
46
46
|
echo "⚠ the egress proxy was not created by Argo CD after $limit s: the setting is kept, check devzone workspace argocd status" >&2
|
|
@@ -87,15 +87,18 @@ update_workspace() {
|
|
|
87
87
|
echo "✖ no terminal to confirm: run again with --yes (devzone workspace update --yes)" >&2
|
|
88
88
|
return 1
|
|
89
89
|
fi
|
|
90
|
-
read -r -p "Update the workspace to v$version? [
|
|
90
|
+
read -r -p "Update the workspace to v$version? [y/N] " answer || answer=""
|
|
91
91
|
case "$answer" in
|
|
92
|
-
|
|
92
|
+
y | Y | yes) ;;
|
|
93
93
|
*)
|
|
94
94
|
echo "✖ canceled, nothing changed" >&2
|
|
95
95
|
return 1
|
|
96
96
|
;;
|
|
97
97
|
esac
|
|
98
98
|
fi
|
|
99
|
+
# Former French names renamed once the update is confirmed (#733); the
|
|
100
|
+
# script comes from the package, the devzone folder is the current one
|
|
101
|
+
DEVZONE_ROOT="$PWD" bash "$ROOT/.devcontainer/rename-legacy-files.sh" || true
|
|
99
102
|
# Same path as workspace start, at the release: Argo CD revision and image tag
|
|
100
103
|
export DEVZONE_ARGOCD_REVISION="v$version"
|
|
101
104
|
workspace_deploy "$IMAGE_REPO" "$version" ""
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
# Waits for the workspace pod; missing image or slow pod are reported clearly.
|
|
7
7
|
wait_for_pod() {
|
|
8
8
|
local image="$1" timeout step start state events arch target_revision pod_revision
|
|
9
|
-
timeout="${
|
|
10
|
-
step="${
|
|
9
|
+
timeout="${DEVZONE_WORKSPACE_WAIT:-120}"
|
|
10
|
+
step="${DEVZONE_WORKSPACE_STEP:-2}"
|
|
11
11
|
start="$SECONDS"
|
|
12
12
|
while [ $((SECONDS - start)) -lt "$timeout" ]; do
|
|
13
13
|
# Why: after helm upgrade the pod is still the old one; judge only the revision the StatefulSet is updating to, within the same wait bound.
|