devzone 6.0.0 → 7.0.1
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 +3 -1
- package/.devcontainer/agent-session.sh +11 -11
- package/.devcontainer/catalog/catalog-watcher.sh +1 -1
- package/.devcontainer/cluster.sh +1 -1
- package/.devcontainer/devcontainer.json +2 -2
- package/.devcontainer/ports-auto.sh +10 -10
- package/.devcontainer/rename-legacy-files.sh +14 -39
- package/.devcontainer/rename-legacy-ports.sh +119 -0
- package/.devcontainer/state-lock.sh +6 -6
- package/Makefile +12 -35
- package/README.md +21 -23
- package/bin/SHA256SUMS +6 -6
- package/bin/devzone-darwin-amd64 +0 -0
- package/bin/devzone-darwin-arm64 +0 -0
- package/bin/devzone-linux-amd64 +0 -0
- package/bin/devzone-linux-arm64 +0 -0
- package/bin/devzone-windows-amd64.exe +0 -0
- package/bin/devzone-windows-arm64.exe +0 -0
- package/manage/scripts/create-mode.sh +1 -1
- package/manage/scripts/devzone-create.sh +1 -1
- package/manage/scripts/devzone-update.sh +17 -2
- package/manage/scripts/docker.sh +1 -1
- package/manage/scripts/kube-ready.sh +2 -2
- package/manage/scripts/uninstall.sh +2 -2
- package/manage/scripts/workspace/ports-apps.sh +7 -7
- package/manage/scripts/workspace/ports-workspace.sh +2 -1
- package/package.json +1 -1
- package/manage/scripts/launch.sh +0 -137
- package/manage/scripts/poste.sh +0 -91
|
@@ -128,8 +128,10 @@ exclusion_clear() {
|
|
|
128
128
|
# Keeps the opencode log lines of the session written by --print-logs: only the
|
|
129
129
|
# "timestamp=... level=ERROR ..." lines of a failure declare an exclusion, not the
|
|
130
130
|
# rest of the text read or written by the model.
|
|
131
|
+
# Errors from the title model (agent=title) are ignored, as they say nothing about
|
|
132
|
+
# the model that is working.
|
|
131
133
|
error_lines() {
|
|
132
|
-
printf '%s\n' "$1" | sed -e $'s/\033\[[0-9;]*m//g' | grep -a -E '^timestamp=.* level=ERROR ' || true
|
|
134
|
+
printf '%s\n' "$1" | sed -e $'s/\033\[[0-9;]*m//g' | grep -a -E '^timestamp=.* level=ERROR ' | grep -a -v ' agent=title ' || true
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
# Stops the current session when the journal holds quota, country or filter since
|
|
@@ -48,18 +48,18 @@ lock_trace() {
|
|
|
48
48
|
lock_take() {
|
|
49
49
|
local end age lock_pid
|
|
50
50
|
end=$(( $(date +%s) + ${DEVZONE_AGENT_LOCK_MAX:-10} ))
|
|
51
|
-
while ! mkdir "$AGENT_STATE/
|
|
51
|
+
while ! mkdir "$AGENT_STATE/lock" 2>/dev/null; do
|
|
52
52
|
# A lock is orphaned only by its age: the rank is held for a few milliseconds,
|
|
53
53
|
# 30 s can only be a stop to take over; otherwise wait, then give up (code 1).
|
|
54
54
|
age=""
|
|
55
|
-
if [ -d "$AGENT_STATE/
|
|
56
|
-
age="$(mtime "$AGENT_STATE/
|
|
55
|
+
if [ -d "$AGENT_STATE/lock" ]; then
|
|
56
|
+
age="$(mtime "$AGENT_STATE/lock" 2>/dev/null)" || age=""
|
|
57
57
|
fi
|
|
58
|
-
lock_pid="$(cat "$AGENT_STATE/
|
|
58
|
+
lock_pid="$(cat "$AGENT_STATE/lock/pid" 2>/dev/null)" || lock_pid=""
|
|
59
59
|
lock_trace "mkdir failed" "age=${age:-unknown} lock-pid=${lock_pid:-none}"
|
|
60
60
|
if [ -n "$age" ] && [ "$(( $(date +%s) - age ))" -gt 30 ]; then
|
|
61
|
-
rm -f "$AGENT_STATE/
|
|
62
|
-
if rmdir "$AGENT_STATE/
|
|
61
|
+
rm -f "$AGENT_STATE/lock/pid"
|
|
62
|
+
if rmdir "$AGENT_STATE/lock" 2>/dev/null; then
|
|
63
63
|
lock_trace "purged" "age=$age"
|
|
64
64
|
continue
|
|
65
65
|
fi
|
|
@@ -69,7 +69,7 @@ lock_take() {
|
|
|
69
69
|
done
|
|
70
70
|
# pid before flock: the other agent never removes the folder while we wait on
|
|
71
71
|
# rang.lock, otherwise our pid write would fail with ENOENT.
|
|
72
|
-
echo "$$" >"$AGENT_STATE/
|
|
72
|
+
echo "$$" >"$AGENT_STATE/lock/pid"
|
|
73
73
|
if command -v flock >/dev/null 2>&1; then
|
|
74
74
|
# exec in an if makes a failure a condition instead of killing the shell
|
|
75
75
|
# (bash 3.2 and GNU alike); without flock, mkdir remains the only guard (macOS).
|
|
@@ -80,7 +80,7 @@ lock_take() {
|
|
|
80
80
|
return 1
|
|
81
81
|
fi
|
|
82
82
|
fi
|
|
83
|
-
lock_trace taken "path=$AGENT_STATE/
|
|
83
|
+
lock_trace taken "path=$AGENT_STATE/lock"
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
# Releases the shared rank taken by lock_take: removes the pid, then the folder, only
|
|
@@ -90,10 +90,10 @@ lock_take() {
|
|
|
90
90
|
# rang.lock.
|
|
91
91
|
lock_release() {
|
|
92
92
|
local pid
|
|
93
|
-
pid="$(cat "$AGENT_STATE/
|
|
93
|
+
pid="$(cat "$AGENT_STATE/lock/pid" 2>/dev/null)" || pid=""
|
|
94
94
|
if [ "$pid" = "$$" ]; then
|
|
95
|
-
rm -f "$AGENT_STATE/
|
|
96
|
-
rmdir "$AGENT_STATE/
|
|
95
|
+
rm -f "$AGENT_STATE/lock/pid"
|
|
96
|
+
rmdir "$AGENT_STATE/lock" 2>/dev/null || true
|
|
97
97
|
lock_trace released
|
|
98
98
|
fi
|
|
99
99
|
if [ "${AGENT_LOCK_FLOCK:-0}" = 1 ]; then
|
|
@@ -11,7 +11,7 @@ ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
|
11
11
|
# shellcheck disable=SC1091
|
|
12
12
|
. "$(dirname "$ICI")/state.sh"
|
|
13
13
|
BASE="${DEVZONE_CATALOG_WATCHER_DIR:-$RACINE/.devzone.catalog-watcher}"
|
|
14
|
-
LOCK_DIR="$BASE/
|
|
14
|
+
LOCK_DIR="$BASE/lock"
|
|
15
15
|
LAST_FILE="$BASE/dernier"
|
|
16
16
|
|
|
17
17
|
refuse() { echo "devzone : catalog-watcher : $*" >&2; exit 2; }
|
package/.devcontainer/cluster.sh
CHANGED
|
@@ -353,7 +353,7 @@ relay_start() {
|
|
|
353
353
|
mkdir -p "$dir"
|
|
354
354
|
relay_active "$name" && return 0
|
|
355
355
|
# setsid: separate session, the relay survives the end of the script that
|
|
356
|
-
# started it (postStartCommand,
|
|
356
|
+
# started it (postStartCommand, devzone workspace shell); absent on macOS (bash 3.2 tests)
|
|
357
357
|
local detached=()
|
|
358
358
|
command -v setsid >/dev/null 2>&1 && detached=(setsid)
|
|
359
359
|
# port-forward targets one precise pod and sees its disappearance only at the
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-claude,target=/home/vscode/.claude,type=volume",
|
|
45
45
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-opencode-config,target=/home/vscode/.config/opencode,type=volume",
|
|
46
46
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-opencode-data,target=/home/vscode/.local/share/opencode,type=volume",
|
|
47
|
-
// devzone agent (#377)
|
|
48
|
-
//
|
|
47
|
+
// devzone agent (#377): state (discarded models, rank, lock, snapshots of the
|
|
48
|
+
// rights) at the path where agent.sh writes it; shared like the logins
|
|
49
49
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-agent,target=/home/vscode/.local/state/oc-lancer,type=volume",
|
|
50
50
|
// Connexion gh et identité git (~/.config/git/config, lu par git comme
|
|
51
51
|
// config globale) : le conteneur reconstruit peut commiter et pousser
|
|
@@ -6,19 +6,19 @@ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
6
6
|
PORTS_AUTO_DIR="${DEVZONE_PORTS_AUTO_DIR:-/tmp/devzone-ports-auto}"
|
|
7
7
|
BASE="$PORTS_AUTO_DIR/${INSTANCE:-devzone}"
|
|
8
8
|
BRIDGES="$BASE/bridges"
|
|
9
|
-
# State file names on disk (
|
|
10
|
-
LOCK="$BASE/
|
|
11
|
-
PENDING="$BASE/pending"; CURRENT="$BASE/
|
|
9
|
+
# State file names on disk (lock, busy, active, current): the watcher and the tests use them (#774)
|
|
10
|
+
LOCK="$BASE/lock"; BUSY="$BASE/busy"; ACTIVE="$BASE/active"
|
|
11
|
+
PENDING="$BASE/pending"; CURRENT="$BASE/current"
|
|
12
12
|
JSON_APP_BUSY=$'occup\303\251 sur le poste' # JSON value, contract (see ports.sh)
|
|
13
13
|
mkdir -p "$BASE" "$BRIDGES"
|
|
14
14
|
|
|
15
15
|
# Automatic watcher state: off as soon as ports_auto= is off (« non » kept as a stored value)
|
|
16
16
|
auto_enabled() { local v; v="$(grep -E '^ports_auto=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true)"; case "$v" in off|false|0|non|no) echo off ;; *) echo on ;; esac; }
|
|
17
|
-
# List of the ports excluded by the user (
|
|
18
|
-
excluded_read() { grep -E '^
|
|
17
|
+
# List of the ports excluded by the user (excluded_ports=, comma-separated)
|
|
18
|
+
excluded_read() { grep -E '^excluded_ports=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true; }
|
|
19
19
|
# Writes a key=value line in the state, like write_ports does for ports=
|
|
20
20
|
write_key() { state_write "$1" "${2:-}" || { echo "devzone : port : state not saved : $ETAT" >&2; return 1; }; }
|
|
21
|
-
# A port is excluded when it is listed in
|
|
21
|
+
# A port is excluded when it is listed in excluded_ports=.
|
|
22
22
|
port_excluded() { case ",$(excluded_read)," in *",$1,"*) return 0 ;; esac; return 1; }
|
|
23
23
|
# Name of the automatic relay of a port: devzone-<instance>-auto-<port>.
|
|
24
24
|
auto_relay_name() { echo "devzone-$INSTANCE-auto-$1"; }
|
|
@@ -185,10 +185,10 @@ auto_loop() {
|
|
|
185
185
|
done
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
# Excludes a port from the automatic list (writes
|
|
189
|
-
auto_exclude() { validate_port "${1:-}"; local current; current="$(excluded_read)"; case ",$current," in *",$1,"*) echo "port $1 already excluded"; return 0 ;; esac; write_key
|
|
190
|
-
# Puts a port back in the automatic list (removes it from
|
|
191
|
-
auto_include() { validate_port "${1:-}"; local current rest p; current="$(excluded_read)"; rest=""; for p in $(printf '%s' "$current" | tr ',' ' '); do [ "$p" = "$1" ] || rest="$rest${rest:+,}$p"; done; write_key
|
|
188
|
+
# Excludes a port from the automatic list (writes excluded_ports=).
|
|
189
|
+
auto_exclude() { validate_port "${1:-}"; local current; current="$(excluded_read)"; case ",$current," in *",$1,"*) echo "port $1 already excluded"; return 0 ;; esac; write_key excluded_ports "$(sort_ports "$current,$1")"; echo "✔ port $1 excluded"; }
|
|
190
|
+
# Puts a port back in the automatic list (removes it from excluded_ports=).
|
|
191
|
+
auto_include() { validate_port "${1:-}"; local current rest p; current="$(excluded_read)"; rest=""; for p in $(printf '%s' "$current" | tr ',' ' '); do [ "$p" = "$1" ] || rest="$rest${rest:+,}$p"; done; write_key excluded_ports "$(sort_ports "$rest")"; echo "✔ port $1 included"; }
|
|
192
192
|
|
|
193
193
|
# Lists the automatic relays alive (or busy on the workstation).
|
|
194
194
|
auto_list() {
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
# names to their English names (#733, lot 3), and the state keys plateforme= to
|
|
5
5
|
# platform= (lot 4) and ia= to ai= (#774, lot 3). #774, lot 4 adds the folders of the
|
|
6
6
|
# port watcher, the state backup, the AI measures file and the packages marker.
|
|
7
|
+
# #774, lot 5 adds the ports folder cap, the key ports_exclus=, the state files of
|
|
8
|
+
# the port automation, the locks of the agent, of the catalog watcher and of the
|
|
9
|
+
# state (rename-legacy-ports.sh).
|
|
7
10
|
# Called by the pod startup, by the workspace init, and on the
|
|
8
11
|
# workstation by devzone update and workspace update.
|
|
9
12
|
# Idempotent: a name is renamed only when the old one exists and the new one
|
|
@@ -13,6 +16,8 @@
|
|
|
13
16
|
# old names is kept after this migration. bash 3.2 (macOS).
|
|
14
17
|
# DEVZONE_ROOT devzone folder (default: the parent of this .devcontainer)
|
|
15
18
|
# DEVZONE_TMP_DIR temporary folder (default: /tmp), set by the tests
|
|
19
|
+
# DEVZONE_PORTS_AUTO_DIR, DEVZONE_AGENT_STATE state folders of the port automation
|
|
20
|
+
# and of the agent (defaults: devzone-ports-auto of the temporary folder, ~/.local/state/oc-lancer)
|
|
16
21
|
|
|
17
22
|
ROOT="${DEVZONE_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
18
23
|
TMP_DIR="${DEVZONE_TMP_DIR:-/tmp}"
|
|
@@ -100,44 +105,10 @@ migrate_root() {
|
|
|
100
105
|
migrate_ports
|
|
101
106
|
}
|
|
102
107
|
|
|
103
|
-
#
|
|
104
|
-
# ports
|
|
105
|
-
#
|
|
106
|
-
|
|
107
|
-
[ -n "${1:-}" ] || return 1
|
|
108
|
-
kill -0 "$1" 2>/dev/null || return 1
|
|
109
|
-
ps -p "$1" -o command= 2>/dev/null | grep -q 'ports-workspace\.sh'
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
# Folders of the workstation port watcher (#774, lot 4): relais/ becomes
|
|
113
|
-
# relays/, pris/ taken/ and verrou lock. A watcher that is running keeps the
|
|
114
|
-
# old folders and creates them again at each round, so it is stopped first:
|
|
115
|
-
# SIGTERM, and its own handler removes its relays, its lock and its pid. It is
|
|
116
|
-
# not restarted here (the files of the package are replaced after this
|
|
117
|
-
# script): devzone workspace start, or devzone workspace ports start, starts
|
|
118
|
-
# the new one. If it does not stop within 2 s, nothing is renamed.
|
|
119
|
-
migrate_ports() {
|
|
120
|
-
local d="$ROOT/.devzone.workspace-ports" pid
|
|
121
|
-
is_real_dir "$d" || return 0
|
|
122
|
-
[ -e "$d/relais" ] || [ -L "$d/relais" ] || [ -e "$d/pris" ] || [ -L "$d/pris" ] ||
|
|
123
|
-
[ -e "$d/verrou" ] || [ -L "$d/verrou" ] || return 0
|
|
124
|
-
pid="$(cat "$d/pid" 2>/dev/null || true)"
|
|
125
|
-
if is_watcher "$pid"; then
|
|
126
|
-
kill "$pid" 2>/dev/null || true
|
|
127
|
-
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
|
128
|
-
is_watcher "$pid" || break
|
|
129
|
-
sleep 0.2
|
|
130
|
-
done
|
|
131
|
-
if is_watcher "$pid"; then
|
|
132
|
-
echo "devzone : port watcher (pid $pid) still running, $d folders kept under their old names" >&2
|
|
133
|
-
return 0
|
|
134
|
-
fi
|
|
135
|
-
echo "devzone : port watcher stopped to rename its folders, restart it: devzone workspace ports start"
|
|
136
|
-
fi
|
|
137
|
-
rename_legacy "$d/relais" "$d/relays"
|
|
138
|
-
rename_legacy "$d/pris" "$d/taken"
|
|
139
|
-
rename_legacy "$d/verrou" "$d/lock"
|
|
140
|
-
}
|
|
108
|
+
# Port watcher, locks and state files of the port automation (#774, lot 5)
|
|
109
|
+
# shellcheck source=SCRIPTDIR/rename-legacy-ports.sh
|
|
110
|
+
# shellcheck disable=SC1091
|
|
111
|
+
. "$(dirname "$0")/rename-legacy-ports.sh"
|
|
141
112
|
|
|
142
113
|
# Fingerprint of the devzone skill, next to its SKILL.md in each assistant folder
|
|
143
114
|
migrate_skills() {
|
|
@@ -184,14 +155,18 @@ migrate_state_key() {
|
|
|
184
155
|
return 0
|
|
185
156
|
}
|
|
186
157
|
|
|
187
|
-
# Keys of the state file: plateforme= (#733, lot 4), ia= (#774, lot 3)
|
|
158
|
+
# Keys of the state file: plateforme= (#733, lot 4), ia= (#774, lot 3), ports_exclus= (#774, lot 5)
|
|
188
159
|
migrate_state_keys() {
|
|
189
160
|
migrate_state_key plateforme platform
|
|
190
161
|
migrate_state_key ia ai
|
|
162
|
+
migrate_state_key ports_exclus excluded_ports
|
|
191
163
|
}
|
|
192
164
|
|
|
193
165
|
migrate_root
|
|
194
166
|
migrate_skills
|
|
195
167
|
migrate_tmp
|
|
168
|
+
migrate_ports_auto
|
|
169
|
+
migrate_agent_locks
|
|
170
|
+
migrate_state_lock
|
|
196
171
|
migrate_state_keys
|
|
197
172
|
exit 0
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# Migration of the names of the port watcher, of the locks and of the state files
|
|
4
|
+
# of the port automation (#774, lot 5). Sourced by rename-legacy-files.sh, which
|
|
5
|
+
# defines ROOT, TMP_DIR, is_real_dir and rename_legacy: never run alone. bash 3.2.
|
|
6
|
+
#
|
|
7
|
+
# Rule for a lock: a lock held by a live process is never moved or removed, it
|
|
8
|
+
# is reported on stderr and the next run migrates it once its holder has gone.
|
|
9
|
+
|
|
10
|
+
# pid_alive PID: true when PID is a live process
|
|
11
|
+
pid_alive() {
|
|
12
|
+
[ -n "${1:-}" ] && kill -0 "$1" 2>/dev/null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# lock_held DIR: true when the lock folder DIR names a live process in DIR/pid
|
|
16
|
+
lock_held() {
|
|
17
|
+
pid_alive "$(cat "$1/pid" 2>/dev/null || true)"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# migrate_lock OLD NEW: the lock folder OLD becomes NEW, unless a live process
|
|
21
|
+
# holds it
|
|
22
|
+
migrate_lock() {
|
|
23
|
+
[ -e "$1" ] || [ -L "$1" ] || return 0
|
|
24
|
+
if lock_held "$1"; then
|
|
25
|
+
echo "devzone : $1 kept: held by a live process" >&2
|
|
26
|
+
return 0
|
|
27
|
+
fi
|
|
28
|
+
rename_legacy "$1" "$2"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# is_watcher PID: true when PID is a live port watcher (its command line names
|
|
32
|
+
# ports-workspace.sh, or is "workspace ports loop" of the Go watcher), so a pid
|
|
33
|
+
# file left by a dead watcher never makes us signal an unrelated process that
|
|
34
|
+
# reuses the number
|
|
35
|
+
is_watcher() {
|
|
36
|
+
[ -n "${1:-}" ] || return 1
|
|
37
|
+
kill -0 "$1" 2>/dev/null || return 1
|
|
38
|
+
ps -p "$1" -o command= 2>/dev/null | grep -Eq 'ports-workspace\.sh|workspace ports loop'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Folders of the workstation port watcher (#774, lots 4 and 5): relais/ becomes
|
|
42
|
+
# relays/, pris/ taken/, verrou lock and plafond cap. A watcher that is running
|
|
43
|
+
# keeps the old folders and creates them again at each round, so it is stopped
|
|
44
|
+
# first: SIGTERM, and its own handler removes its relays, its lock and its pid.
|
|
45
|
+
# It is not restarted here (the files of the package are replaced after this
|
|
46
|
+
# script): the file restart is left in its folder as the signal that this
|
|
47
|
+
# migration, not the user, stopped it; devzone update starts it again once the
|
|
48
|
+
# files are replaced, and a start or a stop by the user removes the signal. If
|
|
49
|
+
# it does not stop within 2 s, nothing is renamed.
|
|
50
|
+
migrate_ports() {
|
|
51
|
+
local d="$ROOT/.devzone.workspace-ports" pid old n
|
|
52
|
+
is_real_dir "$d" || return 0
|
|
53
|
+
old=""
|
|
54
|
+
for n in relais pris verrou plafond; do
|
|
55
|
+
if [ -e "$d/$n" ] || [ -L "$d/$n" ]; then old=1; fi
|
|
56
|
+
done
|
|
57
|
+
[ -n "$old" ] || return 0
|
|
58
|
+
pid="$(cat "$d/pid" 2>/dev/null || true)"
|
|
59
|
+
if is_watcher "$pid"; then
|
|
60
|
+
kill "$pid" 2>/dev/null || true
|
|
61
|
+
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
|
62
|
+
is_watcher "$pid" || break
|
|
63
|
+
sleep 0.2
|
|
64
|
+
done
|
|
65
|
+
if is_watcher "$pid"; then
|
|
66
|
+
echo "devzone : port watcher (pid $pid) still running, $d folders kept under their old names" >&2
|
|
67
|
+
return 0
|
|
68
|
+
fi
|
|
69
|
+
: >"$d/restart"
|
|
70
|
+
echo "devzone : port watcher stopped to rename its folders, restart it: devzone workspace ports start"
|
|
71
|
+
fi
|
|
72
|
+
rename_legacy "$d/relais" "$d/relays"
|
|
73
|
+
rename_legacy "$d/pris" "$d/taken"
|
|
74
|
+
rename_legacy "$d/verrou" "$d/lock"
|
|
75
|
+
rename_legacy "$d/plafond" "$d/cap"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# State of the port automation of the pod, one folder per instance in
|
|
79
|
+
# $DEVZONE_PORTS_AUTO_DIR (default: devzone-ports-auto of the temporary folder):
|
|
80
|
+
# verrou lock, occupes busy, actifs active, courant current. An instance whose
|
|
81
|
+
# lock is held by a live watcher is left whole: its files are in use.
|
|
82
|
+
migrate_ports_auto() {
|
|
83
|
+
local base="${DEVZONE_PORTS_AUTO_DIR:-$TMP_DIR/devzone-ports-auto}" d
|
|
84
|
+
for d in "$base"/*; do
|
|
85
|
+
is_real_dir "$d" || continue
|
|
86
|
+
if lock_held "$d/verrou"; then
|
|
87
|
+
echo "devzone : $d kept: its watcher is running" >&2
|
|
88
|
+
continue
|
|
89
|
+
fi
|
|
90
|
+
rename_legacy "$d/verrou" "$d/lock"
|
|
91
|
+
rename_legacy "$d/occupes" "$d/busy"
|
|
92
|
+
rename_legacy "$d/actifs" "$d/active"
|
|
93
|
+
rename_legacy "$d/courant" "$d/current"
|
|
94
|
+
done
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Locks of the agent (state folder of devzone agent) and of the catalog watcher
|
|
98
|
+
migrate_agent_locks() {
|
|
99
|
+
migrate_lock "${DEVZONE_AGENT_STATE:-${HOME:-/nonexistent}/.local/state/oc-lancer}/verrou" \
|
|
100
|
+
"${DEVZONE_AGENT_STATE:-${HOME:-/nonexistent}/.local/state/oc-lancer}/lock"
|
|
101
|
+
migrate_lock "$ROOT/.devzone.catalog-watcher/verrou" "$ROOT/.devzone.catalog-watcher/lock"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# Write lock of the state file: the folder .devzone.modules.verrou became
|
|
105
|
+
# .devzone.modules.lockdir. It is a transient mkdir lock without pid: it is
|
|
106
|
+
# not renamed, the old one is removed once it is older than 30 s, which is the
|
|
107
|
+
# age after which state-lock.sh itself takes a lock for abandoned. A younger
|
|
108
|
+
# one may belong to a write in progress: it is left for the next run.
|
|
109
|
+
migrate_state_lock() {
|
|
110
|
+
local old="$ROOT/.devzone.modules.verrou" t
|
|
111
|
+
is_real_dir "$old" || return 0
|
|
112
|
+
t="$(stat -c %Y "$old" 2>/dev/null || stat -f %m "$old" 2>/dev/null || true)"
|
|
113
|
+
[ -n "$t" ] && [ "$(($(date +%s) - t))" -gt 30 ] || return 0
|
|
114
|
+
if rm -rf -- "$old"; then
|
|
115
|
+
echo "devzone : $old removed (abandoned write lock, now .devzone.modules.lockdir)"
|
|
116
|
+
else
|
|
117
|
+
echo "devzone : $old not removed" >&2
|
|
118
|
+
fi
|
|
119
|
+
}
|
|
@@ -10,14 +10,14 @@ state_lock_take() {
|
|
|
10
10
|
[ "${STATE_LOCK_DEPTH:-0}" -gt 0 ] && { STATE_LOCK_DEPTH=$((STATE_LOCK_DEPTH + 1)); return 0; }
|
|
11
11
|
mkdir -p "$(dirname "$ETAT")" || return 1
|
|
12
12
|
start="$(date +%s)"
|
|
13
|
-
while ! mkdir "${ETAT}.
|
|
14
|
-
age="$(stat -c %Y "${ETAT}.
|
|
13
|
+
while ! mkdir "${ETAT}.lockdir" 2>/dev/null; do
|
|
14
|
+
age="$(stat -c %Y "${ETAT}.lockdir" 2>/dev/null || stat -f %m "${ETAT}.lockdir" 2>/dev/null || true)"
|
|
15
15
|
if [ -n "$age" ] && [ "$(( $(date +%s) - age ))" -gt 30 ]; then
|
|
16
|
-
rm -rf "${ETAT}.
|
|
16
|
+
rm -rf "${ETAT}.lockdir"
|
|
17
17
|
continue
|
|
18
18
|
fi
|
|
19
19
|
if [ "$(( $(date +%s) - start ))" -ge 10 ]; then
|
|
20
|
-
echo "devzone : state locked elsewhere: ${ETAT}.
|
|
20
|
+
echo "devzone : state locked elsewhere: ${ETAT}.lockdir" >&2
|
|
21
21
|
return 1
|
|
22
22
|
fi
|
|
23
23
|
sleep 1
|
|
@@ -28,7 +28,7 @@ state_lock_take() {
|
|
|
28
28
|
if { exec 8>"${ETAT}.lock"; } && flock -w 10 8; then
|
|
29
29
|
STATE_LOCK_FLOCK=1
|
|
30
30
|
else
|
|
31
|
-
rm -rf "${ETAT}.
|
|
31
|
+
rm -rf "${ETAT}.lockdir" 2>/dev/null || true
|
|
32
32
|
echo "devzone : state locked elsewhere (flock): ${ETAT}.lock" >&2
|
|
33
33
|
return 1
|
|
34
34
|
fi
|
|
@@ -48,6 +48,6 @@ state_lock_release() {
|
|
|
48
48
|
exec 8>&-
|
|
49
49
|
STATE_LOCK_FLOCK=0
|
|
50
50
|
fi
|
|
51
|
-
rm -rf "${ETAT}.
|
|
51
|
+
rm -rf "${ETAT}.lockdir" 2>/dev/null || true
|
|
52
52
|
return 0
|
|
53
53
|
}
|
package/Makefile
CHANGED
|
@@ -1,54 +1,31 @@
|
|
|
1
|
-
#
|
|
2
|
-
DC := npx -y @devcontainers/cli
|
|
3
|
-
WS := --workspace-folder $(CURDIR)
|
|
4
|
-
FILTRE := --filter "label=devcontainer.local_folder=$(CURDIR)"
|
|
1
|
+
# Workstation control without VS Code
|
|
5
2
|
|
|
6
3
|
.DEFAULT_GOAL := help
|
|
7
|
-
.PHONY: help hors-conteneur
|
|
4
|
+
.PHONY: help hors-conteneur test-fonctionnel test-cli desinstaller uninstall
|
|
8
5
|
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
6
|
+
# These commands control the container from the host: run in the container
|
|
7
|
+
# (which uses the host Docker, #291), they would create a second devzone next
|
|
8
|
+
# to the first, without fixing anything. In the container: /.dockerenv, or folder /workspaces/devzone
|
|
12
9
|
hors-conteneur:
|
|
13
10
|
@if [ -f /.dockerenv ] || [ "$(CURDIR)" = /workspaces/devzone ]; then \
|
|
14
11
|
echo "✖ make $(MAKECMDGOALS) : à lancer sur ta machine (terminal du Mac ou du PC), pas dans le conteneur devzone." >&2; \
|
|
15
12
|
echo " Ici, dans le conteneur : devzone (état, modules), et les outils directement." >&2; \
|
|
16
13
|
exit 1; fi
|
|
17
14
|
|
|
18
|
-
help: ##
|
|
15
|
+
help: ## Lists the commands
|
|
19
16
|
@grep -E '^[a-z-]+:.*## ' $(MAKEFILE_LIST) | awk -F':.*## ' '{printf " make %-16s %s\n", $$1, $$2}'
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# En workspace Kubernetes, up/shell/stop pilotent le pod (#472).
|
|
24
|
-
up: hors-conteneur ## Lance le conteneur (le crée si absent)
|
|
25
|
-
@bash manage/scripts/poste.sh up "$(CURDIR)"; c=$$?; [ $$c = 3 ] || exit $$c; bash manage/scripts/launch.sh up "$(CURDIR)"
|
|
18
|
+
.DEFAULT:
|
|
19
|
+
@echo "✖ make $@ does not exist (make up, shell, stop, down, rebuild and status were removed): use devzone workspace start|shell|stop|status" >&2; exit 1
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
@bash manage/scripts/poste.sh shell "$(CURDIR)"; c=$$?; [ $$c = 3 ] || exit $$c; bash manage/scripts/launch.sh up "$(CURDIR)" && $(DC) exec $(WS) bash
|
|
29
|
-
|
|
30
|
-
stop: hors-conteneur ## Arrête le conteneur (état conservé)
|
|
31
|
-
@bash manage/scripts/poste.sh stop "$(CURDIR)"; c=$$?; [ $$c = 3 ] || exit $$c; ids=$$(docker ps -q $(FILTRE)); if [ -z "$$ids" ]; then echo "déjà arrêté"; else docker stop $$ids >/dev/null && echo "devzone arrêté"; fi
|
|
32
|
-
|
|
33
|
-
down: hors-conteneur ## Supprime le conteneur (volumes et image conservés)
|
|
34
|
-
@ids=$$(docker ps -aq $(FILTRE)); if [ -z "$$ids" ]; then echo "aucun conteneur"; else \
|
|
35
|
-
docker inspect $$ids --format 'IMAGE={{.Config.Image}}{{range .Mounts}}{{if eq .Destination "/var/lib/docker"}} DIND={{.Name}}{{end}}{{end}}' | head -1 | tr ' ' '\n' > .devzone.state; \
|
|
36
|
-
docker rm -f $$ids >/dev/null && echo "devzone supprimé (désinstallation complète : make desinstaller)"; fi
|
|
37
|
-
|
|
38
|
-
rebuild: hors-conteneur ## Reconstruit de zéro (après modif de .devcontainer/)
|
|
39
|
-
@bash manage/scripts/poste.sh rebuild "$(CURDIR)"; c=$$?; [ $$c = 3 ] || exit $$c; bash manage/scripts/launch.sh rebuild "$(CURDIR)"
|
|
40
|
-
|
|
41
|
-
status: hors-conteneur ## État du conteneur
|
|
42
|
-
@docker ps -a $(FILTRE) --format '{{.Status}}' | grep . || echo "aucun conteneur"
|
|
43
|
-
|
|
44
|
-
test-fonctionnel: hors-conteneur ## Tests fonctionnels : devzone isolé, construit puis supprimé (5 à 10 min)
|
|
21
|
+
test-fonctionnel: hors-conteneur ## Functional tests: isolated devzone, built then removed (5 to 10 min)
|
|
45
22
|
@bash manage/test/functional.sh
|
|
46
23
|
|
|
47
|
-
test-cli: hors-conteneur ##
|
|
24
|
+
test-cli: hors-conteneur ## CLI tests in a real terminal: isolated devzone, then removed (10 to 15 min)
|
|
48
25
|
@bash manage/test/cli-terminal.sh
|
|
49
26
|
|
|
50
|
-
desinstaller: hors-conteneur ##
|
|
27
|
+
desinstaller: hors-conteneur ## Removes everything devzone created, after confirmation (GARDER=connexions: keeps the connections)
|
|
51
28
|
@GARDER="$(GARDER)" bash manage/scripts/uninstall.sh
|
|
52
29
|
|
|
53
|
-
uninstall: hors-conteneur ##
|
|
30
|
+
uninstall: hors-conteneur ## Removes everything devzone created, after confirmation (alias of desinstaller)
|
|
54
31
|
@GARDER="$(GARDER)" bash manage/scripts/uninstall.sh
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Nothing is hosted: everything runs on your machine. `workspace/` is kept across
|
|
|
39
39
|
|
|
40
40
|
- **Kubernetes (default mode)**: a Kubernetes 1.30 or newer cluster that answers, with `kubectl` and `helm` on the machine. On Mac and Windows, the simplest is the Docker Desktop cluster: *Settings → Kubernetes → Enable Kubernetes*. devzone itself does not need Docker in this mode, but the Docker Desktop cluster stops with Docker Desktop (if the cluster does not answer, see [Frequently asked questions](#frequently-asked-questions)). Details in the [Kubernetes workspace](manage/docs/reference.md#kubernetes-workspace).
|
|
41
41
|
- Node and npm (for `npx` or the global installation).
|
|
42
|
-
- `make` (
|
|
42
|
+
- `make` (only for `make uninstall`; on Windows without `make`, use `npx devzone uninstall`).
|
|
43
43
|
|
|
44
44
|
On Windows: it is recommended to clone with Git for Windows (the scripts keep LF line endings thanks to `.gitattributes`, and the npm command finds the `bash` it requires).
|
|
45
45
|
|
|
@@ -70,7 +70,7 @@ Two ways via npm. Without installation, on each use:
|
|
|
70
70
|
```bash
|
|
71
71
|
npx devzone mon-devzone
|
|
72
72
|
cd mon-devzone
|
|
73
|
-
|
|
73
|
+
devzone workspace shell
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
You can also install it once and for all:
|
|
@@ -81,7 +81,7 @@ devzone --version
|
|
|
81
81
|
devzone --help
|
|
82
82
|
devzone mon-devzone
|
|
83
83
|
cd mon-devzone
|
|
84
|
-
|
|
84
|
+
devzone workspace shell
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
With a GitHub account, the option `--gitops <github|none|<url>>` sets up the GitOps repository as soon as the folder is created:
|
|
@@ -95,7 +95,7 @@ Or fetch the code directly:
|
|
|
95
95
|
```bash
|
|
96
96
|
git clone https://github.com/SimBienvenueHoulBoumi/devzone.git
|
|
97
97
|
cd devzone
|
|
98
|
-
|
|
98
|
+
devzone workspace shell
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
You can also use VS Code: open the `mon-devzone` (or `devzone`) folder, then *Dev Containers: Reopen in Container*.
|
|
@@ -125,7 +125,7 @@ At creation, devzone needs a Kubernetes cluster that answers.
|
|
|
125
125
|
devzone mon-devzone
|
|
126
126
|
│
|
|
127
127
|
├─ cluster answers ─────▶ workspace in the cluster (Kubernetes)
|
|
128
|
-
│
|
|
128
|
+
│ devzone workspace shell opens the pod
|
|
129
129
|
│
|
|
130
130
|
└─ otherwise ───────────▶ nothing is created: devzone lists the ways
|
|
131
131
|
to get a cluster, then you rerun
|
|
@@ -148,7 +148,7 @@ With an active Kubernetes cluster: `kubectl get nodes`.
|
|
|
148
148
|
|
|
149
149
|
## Your first project
|
|
150
150
|
|
|
151
|
-
Your projects go into `workspace/` (kept on your machine
|
|
151
|
+
Your projects go into `workspace/` (kept on your machine).
|
|
152
152
|
|
|
153
153
|
Example:
|
|
154
154
|
```bash
|
|
@@ -171,7 +171,7 @@ To learn more: [Starting a project](https://github.com/SimBienvenueHoulBoumi/dev
|
|
|
171
171
|
|
|
172
172
|
## Installing a tool that stays
|
|
173
173
|
|
|
174
|
-
A tool installed by hand (`sudo apt install tree`) does not survive a
|
|
174
|
+
A tool installed by hand (`sudo apt install tree`) does not survive a rebuild: the image is rebuilt from scratch. For a tool that must stay, `devzone packages` keeps the list of packages to reinstall:
|
|
175
175
|
|
|
176
176
|
```sh
|
|
177
177
|
devzone packages
|
|
@@ -189,17 +189,15 @@ The list lives in `.devzone.packages` at the root of the devzone folder, outside
|
|
|
189
189
|
|
|
190
190
|
## Day to day
|
|
191
191
|
|
|
192
|
-
| Action | VS Code (`Cmd+Shift+P`) | `
|
|
193
|
-
|
|
194
|
-
| Launch | *Dev Containers: Reopen in Container* | `
|
|
195
|
-
| Open a shell | VS Code terminal | `
|
|
196
|
-
| Stop | *Remote: Close Remote Connection* (the container stops with the window) | `
|
|
197
|
-
|
|
|
198
|
-
|
|
|
199
|
-
| Status | — | `make status` | — |
|
|
200
|
-
| **Uninstall** (everything devzone created, after confirmation) | — | `make uninstall` | `npx devzone uninstall` |
|
|
192
|
+
| Action | VS Code (`Cmd+Shift+P`) | `devzone workspace` |
|
|
193
|
+
|---|---|---|
|
|
194
|
+
| Launch | *Dev Containers: Reopen in Container* | `devzone workspace start` |
|
|
195
|
+
| Open a shell | VS Code terminal | `devzone workspace shell` |
|
|
196
|
+
| Stop | *Remote: Close Remote Connection* (the container stops with the window) | `devzone workspace stop` |
|
|
197
|
+
| Status | — | `devzone workspace status` |
|
|
198
|
+
| **Uninstall** (everything devzone created, after confirmation) | — | `make uninstall` or `npx devzone uninstall` |
|
|
201
199
|
|
|
202
|
-
In Kubernetes mode
|
|
200
|
+
In Kubernetes mode, the same commands apply to the pod `devzone-workspace-0`. The GitLab, PostgreSQL and Argo CD services are installed from the workstation: `devzone workspace services enable postgres` (see [the reference](manage/docs/reference.md#devzone-services-in-the-kubernetes-workspace)). You can also develop there: `devzone workspace clone <url>` makes a working clone in the pod, `devzone ticket <n>` creates the worktree of a ticket there and `devzone agent` launches opencode there without a copy ([developing in the pod](manage/docs/reference.md#developing-devzone-and-repowarden-in-the-pod)). Argo CD is installed by default there and keeps the deployments: interface at https://localhost:8443 (password `admin` in `.password`), GitOps repository `<login>/devzone-argocd` created on your GitHub, projects declared in `.argocd.conf` (`devzone workspace argocd app add <repo>`); see [Argo CD in the Kubernetes workspace](manage/docs/reference.md#argo-cd-in-the-kubernetes-workspace).
|
|
203
201
|
|
|
204
202
|
In the container, `devzone --version` shows the version of the workspace image, and `devzone --help` lists all the commands. Extract:
|
|
205
203
|
|
|
@@ -225,7 +223,7 @@ cd mon-devzone
|
|
|
225
223
|
npx devzone@latest update
|
|
226
224
|
```
|
|
227
225
|
|
|
228
|
-
The command shows the folder's version and the package's, and does nothing if they are equal. Otherwise, it backs up the replaced or deleted files to `.devzone.backup/<date>/`, lists the locally modified files and asks for confirmation (`--yes` for a script; without a terminal, `--yes` is required), replaces the package files, removes the old trees (`core/`, `scripts/`), completes `.gitignore` without overwriting it, then proposes
|
|
226
|
+
The command shows the folder's version and the package's, and does nothing if they are equal. Otherwise, it backs up the replaced or deleted files to `.devzone.backup/<date>/`, lists the locally modified files and asks for confirmation (`--yes` for a script; without a terminal, `--yes` is required), replaces the package files, removes the old trees (`core/`, `scripts/`), completes `.gitignore` without overwriting it, then proposes `--no-rebuild` skips the rebuild proposal; without a terminal, the rebuild is never launched.
|
|
229
227
|
|
|
230
228
|
`workspace/`, `.devzone.modules`, `.devzone.packages`, `.password`, `.app`, `.devzone.log` and the Docker volumes are never touched.
|
|
231
229
|
|
|
@@ -284,7 +282,7 @@ The GitLab Rails secret is kept in `workspace/.gitlab/rails-secret.yaml` (600) a
|
|
|
284
282
|
|
|
285
283
|
## Connecting to PostgreSQL
|
|
286
284
|
|
|
287
|
-
The `postgres` module installs a shared PostgreSQL 16 on the devzone cluster: one database and one user per project. All commands are run in the container (`
|
|
285
|
+
The `postgres` module installs a shared PostgreSQL 16 on the devzone cluster: one database and one user per project. All commands are run in the container (`devzone workspace shell`).
|
|
288
286
|
|
|
289
287
|
```sh
|
|
290
288
|
devzone enable postgres # the first time: choice of the cluster (dedicated kind or host cluster)
|
|
@@ -378,7 +376,7 @@ Spring Boot listens on `0.0.0.0` by default: do not set `server.address` to `127
|
|
|
378
376
|
|
|
379
377
|
## Frequently asked questions
|
|
380
378
|
|
|
381
|
-
- **Docker absent or stopped**: `npx devzone`, `
|
|
379
|
+
- **Docker absent or stopped**: `npx devzone`, `devzone workspace start` and `make uninstall` check Docker first and tell you what to do: install it (Docker Desktop, or Docker Engine on Linux), start Docker Desktop, or, on Linux, add your account to the `docker` group (`sudo usermod -aG docker $USER`, then a new session). With `npx devzone mon-devzone`, the folder is created anyway: once Docker is started, `cd mon-devzone && devzone workspace start`.
|
|
382
380
|
- **Access to the host's Docker socket**: the host machine's Docker socket is mounted in the container. This grants administrator access to the host's Docker, including for AI agents. It is a deliberate security trade-off documented in the Limits section. To restrict access, use the mechanisms specific to Docker Desktop/Linux.
|
|
383
381
|
- **The first launch is long**: this is normal (building the image, downloading the base images). It takes 4 to 5 min as measured, plus the download of the base images on a new machine.
|
|
384
382
|
- **`make` is missing on Windows**: you can use `npx @devcontainers/cli` (see the table “Day to day”) or Git Bash. The scripts are compatible (LF line endings).
|
|
@@ -388,15 +386,15 @@ Spring Boot listens on `0.0.0.0` by default: do not set `server.address` to `127
|
|
|
388
386
|
✖ Kubernetes not reachable: cluster <contexte> unreachable (<serveur>). Nothing created.
|
|
389
387
|
```
|
|
390
388
|
|
|
391
|
-
`devzone workspace start`
|
|
389
|
+
`devzone workspace start` checks the cluster first and stops without changing anything. The message gives the cause:
|
|
392
390
|
|
|
393
|
-
- **Docker Desktop stopped**: `✖ Docker Desktop is stopped: the Kubernetes cluster of this machine runs inside it. Start Docker Desktop, then:
|
|
391
|
+
- **Docker Desktop stopped**: `✖ Docker Desktop is stopped: the Kubernetes cluster of this machine runs inside it. Start Docker Desktop, then: devzone workspace start`. Start Docker Desktop, then `devzone workspace start`. To have it start at each login: *Settings → General → Start Docker Desktop when you sign in*.
|
|
394
392
|
- **Docker answers, not the cluster**: `✖ Kubernetes cluster <contexte> unreachable (<serveur>): enable Kubernetes in Docker Desktop (Settings → Kubernetes) or check kubectl config get-contexts`. Enable Kubernetes in Docker Desktop (*Settings → Kubernetes → Enable Kubernetes*).
|
|
395
393
|
- **Other cluster**: `✖ Kubernetes cluster <contexte> unreachable (<serveur>)`, followed by `Check the contexts: kubectl config get-contexts`. Check the chosen context, or change it with `devzone use CTX`.
|
|
396
394
|
|
|
397
395
|
Details in the [reference](manage/docs/reference.md#the-cluster-does-not-answer).
|
|
398
396
|
- **Git identity problem when committing**: set it once. With GitHub: `gh auth login -s workflow` (the identity is deduced automatically). Without GitHub: `git config --file ~/.config/git/config user.name "<nom>"` and `git config --file ~/.config/git/config user.email "<email>"`.
|
|
399
|
-
- **`
|
|
397
|
+
- **`devzone workspace start` seems stuck**: follow the detail with `devzone workspace status` and the pod logs.
|
|
400
398
|
|
|
401
399
|
## Changing cluster
|
|
402
400
|
|
package/bin/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
2ab9c34ed8ad25d22a2beaf877a1171daf432f7157ea76d2b863310d59d82264 devzone-linux-amd64
|
|
2
|
+
ae932a2a06b5ca20017e96dc54b253d687f108c791f52f33372249aba20dfc66 devzone-linux-arm64
|
|
3
|
+
d672671ed82977af87e9dce17cf602d91f6971e912dabfaa7a664982c7341344 devzone-darwin-amd64
|
|
4
|
+
b0d97bae3413cf8f2364f9df1fc80eb0a7d41c37201c01453a83391bb460354c devzone-darwin-arm64
|
|
5
|
+
848a91cdd8cce2ca06c4470b588675587293b721870a0992da8f07f2f71f5423 devzone-windows-amd64.exe
|
|
6
|
+
e0043389aef4177431b9cacd68faa452662a7004b27c57b3b52a822b73e2a256 devzone-windows-arm64.exe
|
package/bin/devzone-darwin-amd64
CHANGED
|
Binary file
|
package/bin/devzone-darwin-arm64
CHANGED
|
Binary file
|
package/bin/devzone-linux-amd64
CHANGED
|
Binary file
|
package/bin/devzone-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -99,5 +99,5 @@ create_mode_start() {
|
|
|
99
99
|
echo "✖ Workspace not started. The folder is ready: only the start remains (cd $folder && devzone workspace start)" >&2
|
|
100
100
|
return 1
|
|
101
101
|
fi
|
|
102
|
-
echo "Next: cd $folder &&
|
|
102
|
+
echo "Next: cd $folder && devzone workspace shell (the pod)"
|
|
103
103
|
}
|
|
@@ -66,7 +66,7 @@ create_workstation() {
|
|
|
66
66
|
# npm never includes .gitignore: written here
|
|
67
67
|
: >"$target/.gitignore"
|
|
68
68
|
complete_gitignore "$target"
|
|
69
|
-
chmod +x "$target/manage/scripts/uninstall.sh"
|
|
69
|
+
chmod +x "$target/manage/scripts/uninstall.sh"
|
|
70
70
|
create_mode_write "$target" "$CREATE_MODE"
|
|
71
71
|
# The GitOps repository of the new devzone (#539): github, an existing URL,
|
|
72
72
|
# or none, written in the .argocd.conf of the new devzone (conf.sh writes
|
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
# devzone-manifest.sh, which provides the manifest helpers.
|
|
6
6
|
# shellcheck disable=SC2154 # PAQUET: set by manage/devzone
|
|
7
7
|
|
|
8
|
+
# Starts the port watcher again when the legacy names migration stopped it: it
|
|
9
|
+
# leaves the file restart in the watcher folder, which a start or a stop by the
|
|
10
|
+
# user removes, so a watcher the user stopped is never started here. Called once
|
|
11
|
+
# the new files are in place. DEVZONE_PORTS_RESTART replaces the command (tests).
|
|
12
|
+
restart_ports_watcher() {
|
|
13
|
+
local folder="$1" marker="$1/.devzone.workspace-ports/restart"
|
|
14
|
+
[ -f "$marker" ] || return 0
|
|
15
|
+
rm -f "$marker"
|
|
16
|
+
if [ -n "${DEVZONE_PORTS_RESTART:-}" ]; then
|
|
17
|
+
(cd "$folder" && sh -c "$DEVZONE_PORTS_RESTART")
|
|
18
|
+
else
|
|
19
|
+
(cd "$folder" && bash manage/workspace.sh ports start)
|
|
20
|
+
fi || echo "devzone : port watcher not restarted: devzone workspace ports start" >&2
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
# Six steps of the update design (#349)
|
|
9
24
|
update_workstation() {
|
|
10
25
|
local assume_yes="" no_rebuild="" arg folder package installed package_list old_list
|
|
@@ -196,7 +211,7 @@ update_workstation() {
|
|
|
196
211
|
# 6. New manifest, then rebuild offered
|
|
197
212
|
write_manifest "$folder"
|
|
198
213
|
echo "✔ devzone $package : mis à jour."
|
|
199
|
-
|
|
214
|
+
restart_ports_watcher "$folder"
|
|
200
215
|
# the update never changes the workstation mode (#472)
|
|
201
216
|
if [ "$(grep -E '^workspace=' "$folder/.devzone.modules" 2>/dev/null | tail -1)" = "workspace=kubernetes" ]; then
|
|
202
217
|
return 0
|
|
@@ -209,7 +224,7 @@ update_workstation() {
|
|
|
209
224
|
echo "Reconstruction : make -C $folder rebuild (à lancer dans un terminal)"
|
|
210
225
|
return 0
|
|
211
226
|
fi
|
|
212
|
-
printf 'Rebuild the container now
|
|
227
|
+
printf 'Rebuild the container now? [y/N] ' >&2
|
|
213
228
|
read -r answer || answer=""
|
|
214
229
|
case "$answer" in
|
|
215
230
|
y | Y | yes) ;;
|
package/manage/scripts/docker.sh
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Checks Docker on the host before any call (sourced by
|
|
2
|
+
# Checks Docker on the host before any call (sourced by uninstall.sh,
|
|
3
3
|
# uninstall.sh and the npm command manage/devzone): without it the user
|
|
4
4
|
# would only see the raw devcontainers CLI or docker error.
|
|
5
5
|
# DEVZONE_DOCKER: docker command name (tests: simulate its absence).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Shared check of the Kubernetes cluster (#497, #565), sourced by
|
|
2
|
+
# Shared check of the Kubernetes cluster (#497, #565), sourced by create-mode.sh,
|
|
3
3
|
# create-mode.sh (creation) and workspace.sh (workspace start). Sourced only:
|
|
4
4
|
# no code at file level. Compatible with bash 3.2 (macOS) and Linux.
|
|
5
5
|
|
|
@@ -63,7 +63,7 @@ kube_unreachable_hint() {
|
|
|
63
63
|
if [ "$context" = docker-desktop ] ||
|
|
64
64
|
{ [ "$cluster" = docker-desktop ] && { [ "$host" = 127.0.0.1 ] || [ "$host" = localhost ]; }; }; then
|
|
65
65
|
if ! docker info >/dev/null 2>&1; then
|
|
66
|
-
echo "✖ Docker Desktop is stopped: the Kubernetes cluster of this machine runs inside it. Start Docker Desktop, then:
|
|
66
|
+
echo "✖ Docker Desktop is stopped: the Kubernetes cluster of this machine runs inside it. Start Docker Desktop, then: devzone workspace start"
|
|
67
67
|
echo " Tip: Settings → General → Start Docker Desktop when you sign in"
|
|
68
68
|
else
|
|
69
69
|
echo "✖ Kubernetes cluster $context unreachable ($server): enable Kubernetes in Docker Desktop (Settings → Kubernetes) or check kubectl config get-contexts"
|
|
@@ -76,7 +76,7 @@ for id in ${ids}; do
|
|
|
76
76
|
v="$(docker inspect "$id" --format '{{range .Mounts}}{{if eq .Destination "/var/lib/docker"}}{{.Name}}{{end}}{{end}}')"
|
|
77
77
|
[ -z "$v" ] || dind+=("$v")
|
|
78
78
|
done
|
|
79
|
-
# Container already removed
|
|
79
|
+
# Container already removed: image and internal Docker noted then
|
|
80
80
|
if [ "${#containers[@]}" -eq 0 ] && [ -f "$STATE" ]; then
|
|
81
81
|
# Read only, never executed
|
|
82
82
|
IMAGE="$(sed -n 's/^IMAGE=//p' "$STATE")"
|
|
@@ -157,7 +157,7 @@ echo " containers labeled devzone.instance=$DEVZONE_INSTANCE:"
|
|
|
157
157
|
show_list ${labeled_containers}
|
|
158
158
|
[ "${#kept[@]}" -eq 0 ] || { echo "Kept (KEEP=logins):"; printf ' %s\n' "${kept[@]}"; }
|
|
159
159
|
if [ "$INSIDE_CONTAINER" = false ] && [ "${#containers[@]}" -eq 0 ] && [ ! -f "$STATE" ] && [ "${#images[@]}" -eq 0 ]; then
|
|
160
|
-
echo "ℹ No container and no image trace: if
|
|
160
|
+
echo "ℹ No container and no image trace: if an older removal left them,"
|
|
161
161
|
echo " find them with: docker images 'vsc-$(basename "$HERE")-*' ; docker volume ls -q -f name=dind-var-lib-docker"
|
|
162
162
|
fi
|
|
163
163
|
|
|
@@ -69,15 +69,15 @@ pa_new() {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
# One round of applications, from the ports already wanted "$1" (services, pod).
|
|
72
|
-
# Prints the relay lines; writes apps/ (stable local port),
|
|
72
|
+
# Prints the relay lines; writes apps/ (stable local port), cap/ (cap marker) and
|
|
73
73
|
# no-ready-pod/ (Service without ready endpoint, not relayed nor counted), removes the
|
|
74
74
|
# state of Services gone, warns once per port over the cap of PA_MAX.
|
|
75
75
|
pa_round() {
|
|
76
76
|
local d used excl ns name ip type annot ports pp port key stored loc n=0 seen="" f
|
|
77
77
|
local ready="" ready_ok=1 unready
|
|
78
78
|
d="$(pw_dir)"
|
|
79
|
-
mkdir -p "$d/apps" "$d/
|
|
80
|
-
excl="$(grep -E '^
|
|
79
|
+
mkdir -p "$d/apps" "$d/cap"
|
|
80
|
+
excl="$(grep -E '^excluded_ports=' .devzone.modules 2>/dev/null | tail -1 | cut -d= -f2- | tr ',' ' ')"
|
|
81
81
|
used=" $1 $excl "
|
|
82
82
|
# One kubectl call per round. If it fails, every Service is relayed, warned once.
|
|
83
83
|
if ready="$(pa_ready)"; then
|
|
@@ -118,15 +118,15 @@ pa_round() {
|
|
|
118
118
|
rm -f "$d/no-ready-pod/$key"
|
|
119
119
|
if [ "$n" -lt "$PA_MAX" ]; then
|
|
120
120
|
n=$((n + 1))
|
|
121
|
-
rm -f "$d/
|
|
121
|
+
rm -f "$d/cap/$key"
|
|
122
122
|
echo "$loc|$ns|svc/$name|$port"
|
|
123
|
-
elif [ ! -e "$d/
|
|
124
|
-
: >"$d/
|
|
123
|
+
elif [ ! -e "$d/cap/$key" ]; then
|
|
124
|
+
: >"$d/cap/$key"
|
|
125
125
|
echo "⚠ cap of $PA_MAX application relays reached, $ns/$name:$port not relayed" >&2
|
|
126
126
|
fi
|
|
127
127
|
done
|
|
128
128
|
done <<<"$(pa_discover)"
|
|
129
|
-
for f in "$d"/apps/* "$d"/
|
|
129
|
+
for f in "$d"/apps/* "$d"/cap/* "$d"/no-ready-pod/*; do
|
|
130
130
|
[ -e "$f" ] || continue
|
|
131
131
|
case "$seen" in *" $(basename "$f") "*) ;; *) rm -f "$f" ;; esac
|
|
132
132
|
done
|
|
@@ -167,6 +167,7 @@ ports_start() {
|
|
|
167
167
|
local d pid
|
|
168
168
|
d="$(pw_dir)"
|
|
169
169
|
mkdir -p "$d"
|
|
170
|
+
rm -f "$d/restart"
|
|
170
171
|
pid="$(cat "$d/pid" 2>/dev/null || true)"
|
|
171
172
|
if pw_alive "$pid"; then
|
|
172
173
|
echo "Workspace ports: watcher already running (pid $pid)"
|
|
@@ -190,7 +191,7 @@ ports_stop() {
|
|
|
190
191
|
for _ in 1 2 3 4 5 6 7 8 9 10; do pw_alive "$pid" || break; sleep 0.2; done
|
|
191
192
|
fi
|
|
192
193
|
pw_remove_all
|
|
193
|
-
rm -rf "$d/lock" "$d/pid"
|
|
194
|
+
rm -rf "$d/lock" "$d/pid" "$d/restart"
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
# Shows status: watcher, relayed ports, reported taken ports.
|
package/package.json
CHANGED
package/manage/scripts/launch.sh
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Starts the container on the host without ever staying silent:
|
|
3
|
-
# bash manage/scripts/launch.sh up [folder] (make up)
|
|
4
|
-
# bash manage/scripts/launch.sh rebuild [folder] (make rebuild: rebuild from scratch)
|
|
5
|
-
# Full devcontainer CLI output goes to <folder>/.devzone.log; the terminal shows
|
|
6
|
-
# key steps, a heartbeat at least every DEVZONE_HEARTBEAT seconds (30), and a
|
|
7
|
-
# question asked inside the container (last log line left unanswered for
|
|
8
|
-
# DEVZONE_QUESTION_WAIT seconds, 20) is shown and startup is stopped: nobody
|
|
9
|
-
# can answer it (the CLI runs without input), waiting would hang forever.
|
|
10
|
-
# Portable: bash 3.2 (macOS) and Linux.
|
|
11
|
-
set -uo pipefail
|
|
12
|
-
|
|
13
|
-
mode="${1:-}"
|
|
14
|
-
FOLDER="${2:-$PWD}"
|
|
15
|
-
case "$mode" in
|
|
16
|
-
up) options=() done_msg="devzone started" ;;
|
|
17
|
-
rebuild) options=(--remove-existing-container) done_msg="devzone rebuilt" ;;
|
|
18
|
-
*)
|
|
19
|
-
echo "usage: bash manage/scripts/launch.sh up|rebuild [folder]" >&2
|
|
20
|
-
exit 2
|
|
21
|
-
;;
|
|
22
|
-
esac
|
|
23
|
-
|
|
24
|
-
LOG="$FOLDER/.devzone.log"
|
|
25
|
-
HEARTBEAT="${DEVZONE_HEARTBEAT:-30}"
|
|
26
|
-
QUESTION_WAIT="${DEVZONE_QUESTION_WAIT:-20}"
|
|
27
|
-
ESC="$(printf '\033')"
|
|
28
|
-
|
|
29
|
-
# Readable log line: without color codes or carriage returns
|
|
30
|
-
clean_line() { sed "s/${ESC}\[[0-9;?]*[A-Za-z]//g" | tr -d '\r'; }
|
|
31
|
-
# Last non-empty log line, shortened
|
|
32
|
-
last_line() { tail -c 2000 "$LOG" | clean_line | grep -v '^[[:space:]]*$' | tail -1 | cut -c1-110; }
|
|
33
|
-
|
|
34
|
-
# Pending question: last unfinished line (no newline, like a prompt) ending with
|
|
35
|
-
# [y/N], ? or a password prompt
|
|
36
|
-
pattern='(\[[^]]*/[^]]*\]|\?|[Pp]assword[^:]*:|[Mm]ot de passe[^:]*:)[[:space:]]*$'
|
|
37
|
-
pending_question() {
|
|
38
|
-
local line
|
|
39
|
-
# Last byte: empty after $( ) if it is a newline
|
|
40
|
-
[ -n "$(tail -c 1 "$LOG")" ] || return 1
|
|
41
|
-
line="$(tail -c 600 "$LOG" | clean_line | tail -1)"
|
|
42
|
-
[[ "$line" =~ $pattern ]] || return 1
|
|
43
|
-
printf '%s\n' "$line" | cut -c1-200
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# Key steps, each shown once; devzone state copied as-is
|
|
47
|
-
seen=" "
|
|
48
|
-
read_lines=0
|
|
49
|
-
show_steps() {
|
|
50
|
-
local total line
|
|
51
|
-
total="$(wc -l <"$LOG" | tr -d ' ')"
|
|
52
|
-
[ "$total" -gt "$read_lines" ] || return 0
|
|
53
|
-
while IFS= read -r line; do
|
|
54
|
-
case "$line" in
|
|
55
|
-
*"Start: Run: docker buildx build"* | *"Start: Run: docker build"*) announce image "Building image (several minutes the first time)" ;;
|
|
56
|
-
*"Start: Run: docker run"*) announce container "Creating container" ;;
|
|
57
|
-
*"Running the postCreateCommand"*) announce postcreate "Installing in container (repowarden, modules)" ;;
|
|
58
|
-
*"Running the postStartCommand"*) announce poststart "Starting (git identity, clusters, state)" ;;
|
|
59
|
-
"devzone ready"* | "devzone started"* | "devzone rebuilt"* | "devzone : "* | "devzone: "* | " ✔ "* | " ✖ "* | " ○ "* | " ⚠ "* | " "[!\ ]* | "git-identity : "* | "kube-config : "* | "metrics-server : "*)
|
|
60
|
-
echo " $line"
|
|
61
|
-
last_announce="$(date +%s)"
|
|
62
|
-
;;
|
|
63
|
-
esac
|
|
64
|
-
done < <(sed -n "$((read_lines + 1)),${total}p" "$LOG" | clean_line)
|
|
65
|
-
read_lines="$total"
|
|
66
|
-
}
|
|
67
|
-
announce() {
|
|
68
|
-
case "$seen" in *" $1 "*) return 0 ;; esac
|
|
69
|
-
seen="$seen$1 "
|
|
70
|
-
echo "▶ $2"
|
|
71
|
-
last_announce="$(date +%s)"
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
stop_launch() {
|
|
75
|
-
[ -n "${pid:-}" ] || return 0
|
|
76
|
-
pkill -TERM -P "$pid" 2>/dev/null || true
|
|
77
|
-
kill -TERM "$pid" 2>/dev/null || true
|
|
78
|
-
wait "$pid" 2>/dev/null || true
|
|
79
|
-
pid=""
|
|
80
|
-
}
|
|
81
|
-
trap 'stop_launch; echo; echo "interrupted - log: .devzone.log"; exit 130' INT TERM
|
|
82
|
-
|
|
83
|
-
# Docker first: without it the CLI would only show a raw JSON error
|
|
84
|
-
# shellcheck source=SCRIPTDIR/docker.sh
|
|
85
|
-
. "$(dirname "${BASH_SOURCE[0]}")/docker.sh"
|
|
86
|
-
docker_ready "${DEVZONE_COMMAND:-make $mode}" || exit 1
|
|
87
|
-
|
|
88
|
-
: >"$LOG"
|
|
89
|
-
start="$(date +%s)"
|
|
90
|
-
last_announce="$start"
|
|
91
|
-
echo "▶ Starting devzone (full log: .devzone.log)"
|
|
92
|
-
# Empty input: the CLI forwards nothing; a question asked inside the container
|
|
93
|
-
# would stay unanswered, hence the detection below
|
|
94
|
-
npx -y @devcontainers/cli up --workspace-folder "$FOLDER" ${options[@]+"${options[@]}"} </dev/null >"$LOG" 2>&1 &
|
|
95
|
-
pid=$!
|
|
96
|
-
|
|
97
|
-
size=0
|
|
98
|
-
quiet=0
|
|
99
|
-
while kill -0 "$pid" 2>/dev/null; do
|
|
100
|
-
sleep 1
|
|
101
|
-
t="$(wc -c <"$LOG" | tr -d ' ')"
|
|
102
|
-
if [ "$t" != "$size" ]; then
|
|
103
|
-
size="$t"
|
|
104
|
-
quiet=0
|
|
105
|
-
show_steps
|
|
106
|
-
else
|
|
107
|
-
quiet=$((quiet + 1))
|
|
108
|
-
fi
|
|
109
|
-
if [ "$quiet" -ge "$QUESTION_WAIT" ] && q="$(pending_question)"; then
|
|
110
|
-
stop_launch
|
|
111
|
-
echo "✖ A container step asks a question and waits for an answer (log idle for $quiet s):" >&2
|
|
112
|
-
echo " $q" >&2
|
|
113
|
-
echo " Nobody can answer it here: startup stopped instead of waiting forever." >&2
|
|
114
|
-
echo " Full log: .devzone.log; report it: https://github.com/SimBienvenueHoulBoumi/devzone/issues" >&2
|
|
115
|
-
echo " The container may be incomplete: make rebuild to start from scratch." >&2
|
|
116
|
-
exit 1
|
|
117
|
-
fi
|
|
118
|
-
now="$(date +%s)"
|
|
119
|
-
if [ $((now - last_announce)) -ge "$HEARTBEAT" ]; then
|
|
120
|
-
elapsed=$((now - start))
|
|
121
|
-
info="running for $((elapsed / 60)) min $((elapsed % 60)) s"
|
|
122
|
-
[ "$quiet" -lt "$HEARTBEAT" ] || info="$info, no new line for $quiet s"
|
|
123
|
-
echo " … $info: $(last_line)"
|
|
124
|
-
last_announce="$now"
|
|
125
|
-
fi
|
|
126
|
-
done
|
|
127
|
-
wait "$pid"
|
|
128
|
-
code=$?
|
|
129
|
-
pid=""
|
|
130
|
-
show_steps
|
|
131
|
-
if [ "$code" -eq 0 ]; then
|
|
132
|
-
echo "$done_msg"
|
|
133
|
-
else
|
|
134
|
-
tail -15 "$LOG" | clean_line
|
|
135
|
-
echo "failed - full log: .devzone.log"
|
|
136
|
-
exit 1
|
|
137
|
-
fi
|
package/manage/scripts/poste.sh
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
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
|
|
6
|
-
# off to manage/workspace.sh (repo clone) or npx devzone@<version> workspace
|
|
7
|
-
# (folder created by npx devzone); in Docker it returns 3 and does nothing, so
|
|
8
|
-
# the Makefile keeps its original recipe. The advice target shows, after an
|
|
9
|
-
# update, what the workstation can do next (#472).
|
|
10
|
-
# Portable: bash 3.2 (macOS) and Linux.
|
|
11
|
-
set -uo pipefail
|
|
12
|
-
|
|
13
|
-
# kube_ready_reason: Kubernetes reachable check, shared with create-mode.sh (#497)
|
|
14
|
-
# shellcheck source=manage/scripts/kube-ready.sh
|
|
15
|
-
. "$(dirname "${BASH_SOURCE[0]}")/kube-ready.sh"
|
|
16
|
-
|
|
17
|
-
usage() {
|
|
18
|
-
echo "usage: bash manage/scripts/poste.sh up|shell|stop|rebuild|advice <folder>" >&2
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
# Last workspace= value in <folder>/.devzone.modules; missing, empty or not
|
|
22
|
-
# kubernetes -> docker.
|
|
23
|
-
workspace_mode() {
|
|
24
|
-
local folder="$1" value
|
|
25
|
-
value="$(grep '^workspace=' "$folder/.devzone.modules" 2>/dev/null | tail -1 | cut -d= -f2- || true)"
|
|
26
|
-
if [ "$value" = "kubernetes" ]; then
|
|
27
|
-
echo kubernetes
|
|
28
|
-
else
|
|
29
|
-
echo docker
|
|
30
|
-
fi
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# Folder version: first "version X.Y.Z" line in .devzone.version; unreadable or
|
|
34
|
-
# empty -> latest.
|
|
35
|
-
folder_version() {
|
|
36
|
-
local folder="$1" version
|
|
37
|
-
version="$(sed -n 's/^version \([^[:space:]]*\)[[:space:]]*$/\1/p' "$folder/.devzone.version" 2>/dev/null | head -1 || true)"
|
|
38
|
-
if [ -z "$version" ]; then
|
|
39
|
-
echo latest
|
|
40
|
-
else
|
|
41
|
-
echo "$version"
|
|
42
|
-
fi
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
# Workspace command for the folder: clone script if present, otherwise the
|
|
46
|
-
# published CLI for the folder version, run from the folder.
|
|
47
|
-
workspace_cmd() {
|
|
48
|
-
local folder="$1" version
|
|
49
|
-
shift
|
|
50
|
-
if [ -f "$folder/manage/workspace.sh" ]; then
|
|
51
|
-
(cd "$folder" && bash manage/workspace.sh "$@")
|
|
52
|
-
else
|
|
53
|
-
version="$(folder_version "$folder")"
|
|
54
|
-
(cd "$folder" && npx -y "devzone@$version" workspace "$@")
|
|
55
|
-
fi
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
target="${1:-}"
|
|
59
|
-
folder="${2:-}"
|
|
60
|
-
case "$target" in
|
|
61
|
-
up | shell | stop | rebuild | advice | conseil) ;;
|
|
62
|
-
*)
|
|
63
|
-
usage
|
|
64
|
-
exit 2
|
|
65
|
-
;;
|
|
66
|
-
esac
|
|
67
|
-
if [ -z "$folder" ]; then
|
|
68
|
-
usage
|
|
69
|
-
exit 2
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# Advice after update: always exit 0, silent for a Docker folder (#735).
|
|
73
|
-
if [ "$target" = "advice" ] || [ "$target" = "conseil" ]; then
|
|
74
|
-
if [ "$(workspace_mode "$folder")" = kubernetes ]; then
|
|
75
|
-
echo "Kubernetes workspace: the new image is used on the next devzone workspace start (or make up)."
|
|
76
|
-
fi
|
|
77
|
-
exit 0
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
# Docker workstation: Makefile resumes its current recipe (exit 3).
|
|
81
|
-
[ "$(workspace_mode "$folder")" = kubernetes ] || exit 3
|
|
82
|
-
|
|
83
|
-
case "$target" in
|
|
84
|
-
up) workspace_cmd "$folder" start ;;
|
|
85
|
-
shell) workspace_cmd "$folder" start && workspace_cmd "$folder" shell ;;
|
|
86
|
-
stop) workspace_cmd "$folder" stop ;;
|
|
87
|
-
rebuild)
|
|
88
|
-
echo "✖ make rebuild: this workstation is in Kubernetes workspace mode (workspace=kubernetes in .devzone.modules), nothing to rebuild on the machine" >&2
|
|
89
|
-
exit 1
|
|
90
|
-
;;
|
|
91
|
-
esac
|