devzone 7.3.0 → 7.4.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/devcontainer.json +1 -1
- package/.devcontainer/devzone +13 -20
- package/.devcontainer/devzone-modules.sh +1 -1
- package/.devcontainer/devzone-repair.sh +2 -2
- package/.devcontainer/devzone-services.sh +7 -7
- package/.devcontainer/devzone-status.sh +5 -5
- package/.devcontainer/help.sh +3 -1
- package/.devcontainer/versions.env +3 -0
- package/.devcontainer/workspace-init.sh +8 -9
- package/.gitattributes +8 -0
- package/README.md +1 -1
- 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/charts/devzone-mysql/values.yaml +1 -1
- package/charts/devzone-postgres/values.yaml +1 -1
- package/manage/devzone +2 -2
- package/manage/scripts/uninstall.sh +1 -1
- package/manage/scripts/workspace/argocd-workspace.sh +2 -2
- package/package.json +1 -1
- package/.devcontainer/agent-errors.sh +0 -156
- package/.devcontainer/agent-local.sh +0 -63
- package/.devcontainer/agent-model.sh +0 -113
- package/.devcontainer/agent-pod-egress.sh +0 -36
- package/.devcontainer/agent-pod-manifest.sh +0 -250
- package/.devcontainer/agent-pod.sh +0 -243
- package/.devcontainer/agent-session.sh +0 -242
- package/.devcontainer/agent-state-json.sh +0 -117
- package/.devcontainer/agent-workspace.sh +0 -97
- package/.devcontainer/agent.sh +0 -247
- package/.devcontainer/catalog/app.sh +0 -202
- package/.devcontainer/catalog/catalog-watcher.sh +0 -127
- package/.devcontainer/catalog.sh +0 -208
- package/.devcontainer/chart-direct.sh +0 -49
- package/.devcontainer/cluster.sh +0 -388
- package/.devcontainer/clusters.sh +0 -86
- package/.devcontainer/devzone-cluster.sh +0 -209
- package/.devcontainer/isolation.sh +0 -65
- package/.devcontainer/kube-account.sh +0 -107
- package/.devcontainer/kube-prompt.sh +0 -42
- package/.devcontainer/memory.sh +0 -113
- package/.devcontainer/metrics-server.sh +0 -100
- package/.devcontainer/packages.sh +0 -228
- package/.devcontainer/password.sh +0 -148
- package/.devcontainer/ports-json.sh +0 -31
- package/.devcontainer/ports.sh +0 -132
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-opencode-config,target=/home/vscode/.config/opencode,type=volume",
|
|
45
45
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-opencode-data,target=/home/vscode/.local/share/opencode,type=volume",
|
|
46
46
|
// devzone agent (#377): state (discarded models, rank, lock, snapshots of the
|
|
47
|
-
// rights) at the path where agent
|
|
47
|
+
// rights) at the path where devzone agent writes it; shared like the logins
|
|
48
48
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-agent,target=/home/vscode/.local/state/oc-lancer,type=volume",
|
|
49
49
|
// Connexion gh et identité git (~/.config/git/config, lu par git comme
|
|
50
50
|
// config globale) : le conteneur reconstruit peut commiter et pousser
|
package/.devcontainer/devzone
CHANGED
|
@@ -46,9 +46,8 @@ RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
|
|
|
46
46
|
# Default state of the instance; DEVZONE_STATE takes precedence (tests, CI)
|
|
47
47
|
ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
48
48
|
MODULES=(ai kubernetes gitlab postgres argocd mysql)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
. "$ICI/cluster.sh"
|
|
49
|
+
INSTANCE_SUFFIX=""
|
|
50
|
+
[ "${DEVZONE_INSTANCE:-devzone}" = devzone ] || INSTANCE_SUFFIX="-${DEVZONE_INSTANCE}"
|
|
52
51
|
# .argocd.conf of the instance: the GitOps repository designation (#539)
|
|
53
52
|
# shellcheck source=SCRIPTDIR/argocd/conf.sh
|
|
54
53
|
# shellcheck disable=SC1091
|
|
@@ -106,9 +105,6 @@ GITLAB_URL_MODULE=http://gitlab.localhost:8929
|
|
|
106
105
|
# shellcheck source=SCRIPTDIR/devzone-services.sh
|
|
107
106
|
# shellcheck disable=SC1091
|
|
108
107
|
. "$ICI/devzone-services.sh"
|
|
109
|
-
# shellcheck source=SCRIPTDIR/devzone-cluster.sh
|
|
110
|
-
# shellcheck disable=SC1091
|
|
111
|
-
. "$ICI/devzone-cluster.sh"
|
|
112
108
|
# shellcheck source=SCRIPTDIR/devzone-repair.sh
|
|
113
109
|
# shellcheck disable=SC1091
|
|
114
110
|
. "$ICI/devzone-repair.sh"
|
|
@@ -169,9 +165,6 @@ case "${1:-}" in
|
|
|
169
165
|
# writing anything
|
|
170
166
|
[ "$(value_of "$2")" = on ]
|
|
171
167
|
;;
|
|
172
|
-
agent)
|
|
173
|
-
bash "$ICI/agent.sh" "${@:2}"
|
|
174
|
-
;;
|
|
175
168
|
ai)
|
|
176
169
|
case "${2:-}" in
|
|
177
170
|
check)
|
|
@@ -202,27 +195,27 @@ case "${1:-}" in
|
|
|
202
195
|
bash "$ICI/workspace-build.sh" "${@:2}"
|
|
203
196
|
;;
|
|
204
197
|
repair) repair_workstation ;;
|
|
205
|
-
metrics) bash "$ICI/metrics-server.sh" "${@:2}" ;;
|
|
206
|
-
use) use_cluster "${@:2}" ;;
|
|
207
|
-
clusters) DEVZONE_STATE="$ETAT" bash "$ICI/clusters.sh" "${@:2}" ;;
|
|
208
|
-
cluster) change_cluster "${@:2}" ;;
|
|
209
198
|
# Go only: reached when the binary did not take the call. Never call
|
|
210
199
|
# "devzone" again from here, it would loop forever, see #864
|
|
211
|
-
postgres | mysql | gitlab | test-gitlab)
|
|
200
|
+
cluster | clusters | metrics | use | kube | agent | postgres | mysql | gitlab | test-gitlab | catalog | catalog-watcher)
|
|
212
201
|
echo "devzone $1: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
213
202
|
exit 1
|
|
214
203
|
;;
|
|
215
|
-
catalog) DEVZONE_STATE="$ETAT" bash "$ICI/catalog.sh" list ;;
|
|
216
204
|
argocd)
|
|
217
205
|
echo "devzone argocd: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
218
206
|
exit 1
|
|
219
207
|
;;
|
|
220
|
-
port)
|
|
221
|
-
|
|
208
|
+
port)
|
|
209
|
+
echo "devzone port: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
210
|
+
exit 1
|
|
211
|
+
;;
|
|
212
|
+
packages)
|
|
213
|
+
echo "devzone packages: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
214
|
+
exit 1
|
|
215
|
+
;;
|
|
222
216
|
passwords)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
bash "$ICI/password.sh" path
|
|
217
|
+
echo "devzone passwords: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
218
|
+
exit 1
|
|
226
219
|
;;
|
|
227
220
|
-h | --help | help) devzone_aide ;;
|
|
228
221
|
test-bash32) bash "$RACINE/manage/test/bash32.sh" ;;
|
|
@@ -88,7 +88,7 @@ change_module() {
|
|
|
88
88
|
# An application of the catalog: the line is written, then applied
|
|
89
89
|
if [ -f "$ICI/catalog/$m/app.conf" ]; then
|
|
90
90
|
write_value "$m" "$1"
|
|
91
|
-
|
|
91
|
+
DEVZONE_STATE="$ETAT" devzone catalog apply
|
|
92
92
|
return
|
|
93
93
|
fi
|
|
94
94
|
echo "devzone : unknown module : $m ; modules : ${MODULES[*]}" >&2
|
|
@@ -78,8 +78,8 @@ repair_workstation() {
|
|
|
78
78
|
if [ "$(value_of mysql)" = on ]; then
|
|
79
79
|
repair_item "mysql relay" devzone mysql relay-start
|
|
80
80
|
fi
|
|
81
|
-
repair_item "catalog watcher" env DEVZONE_CATALOG_REAL=yes
|
|
82
|
-
repair_item "credentials"
|
|
81
|
+
repair_item "catalog watcher" env DEVZONE_STATE="$ETAT" DEVZONE_CATALOG_REAL=yes devzone catalog-watcher start
|
|
82
|
+
repair_item "credentials" devzone passwords regenerate
|
|
83
83
|
devzone cluster clean || true
|
|
84
84
|
return "$repair_failed"
|
|
85
85
|
}
|
|
@@ -87,8 +87,8 @@ apply_kubernetes() {
|
|
|
87
87
|
else
|
|
88
88
|
rm -f "$HOME/.kube/hote.config"
|
|
89
89
|
# metrics-server removed from the clusters where devzone installed it
|
|
90
|
-
# (devzone=installe marker set by
|
|
91
|
-
|
|
90
|
+
# (devzone=installe marker set by the Go command); via its subcommand
|
|
91
|
+
devzone metrics remove || true
|
|
92
92
|
echo "devzone : kubernetes disabled"
|
|
93
93
|
fi
|
|
94
94
|
}
|
|
@@ -152,19 +152,19 @@ apply_postgres() {
|
|
|
152
152
|
write_value postgres off
|
|
153
153
|
return 2
|
|
154
154
|
fi
|
|
155
|
-
actual="$(
|
|
155
|
+
actual="$(devzone kube saved)"
|
|
156
156
|
if [ -n "$wanted" ] && [ -n "$actual" ] && [ "$wanted" != "$actual" ]; then
|
|
157
157
|
echo "devzone : devzone services are on $actual; to change: devzone cluster $wanted" >&2
|
|
158
158
|
write_value postgres off
|
|
159
159
|
return 2
|
|
160
160
|
fi
|
|
161
161
|
if [ -n "$confirm_ctx" ]; then
|
|
162
|
-
ctx="$(
|
|
162
|
+
ctx="$(devzone kube choose "$wanted" --confirm "$confirm_ctx")" || { write_value postgres off; return 2; }
|
|
163
163
|
else
|
|
164
|
-
ctx="$(
|
|
164
|
+
ctx="$(devzone kube choose "$wanted")" || { write_value postgres off; return 2; }
|
|
165
165
|
fi
|
|
166
166
|
# Choice kept before the installation: a resume targets the same cluster
|
|
167
|
-
|
|
167
|
+
devzone kube save "$ctx"
|
|
168
168
|
current_state="$(devzone postgres status)"
|
|
169
169
|
# "relay stopped" first: this line also starts with "ready on"
|
|
170
170
|
if [[ "$current_state" == *"relay stopped"* ]]; then
|
|
@@ -233,7 +233,7 @@ apply_mysql() {
|
|
|
233
233
|
else
|
|
234
234
|
# Removal without deleting the data: volume kept (#441); the databases
|
|
235
235
|
# only leave with a yes (confirm_removal)
|
|
236
|
-
|
|
236
|
+
DEVZONE_STATE="$ETAT" devzone catalog remove mysql
|
|
237
237
|
if [ -n "${DELETE_DATA:-}" ]; then
|
|
238
238
|
devzone mysql delete-data --yes
|
|
239
239
|
fi
|
|
@@ -87,15 +87,15 @@ show_state() {
|
|
|
87
87
|
fi
|
|
88
88
|
# Catalog applications (#414)
|
|
89
89
|
if [ -d "$ICI/catalog" ]; then
|
|
90
|
-
|
|
90
|
+
DEVZONE_STATE="$ETAT" devzone catalog resume
|
|
91
91
|
fi
|
|
92
92
|
# GitLab Rails secret (#347): warning if the secrets were lost
|
|
93
93
|
if [ "$(value_of gitlab)" = on ] && [ ! -f "$RACINE/workspace/.gitlab/rails-secret.yaml" ]; then
|
|
94
94
|
echo " ⚠ gitlab GitLab reinstalled: if the browser shows 422, delete the site data of gitlab.localhost"
|
|
95
95
|
fi
|
|
96
96
|
# Remote devzone cluster: warning in the summary
|
|
97
|
-
current_cluster="$(
|
|
98
|
-
if [ -n "$current_cluster" ] && !
|
|
97
|
+
current_cluster="$(devzone kube saved)"
|
|
98
|
+
if [ -n "$current_cluster" ] && ! devzone kube local "$current_cluster"; then
|
|
99
99
|
printf ' ⚠ cluster remote: %s — services on a remote cluster\n' "$current_cluster"
|
|
100
100
|
fi
|
|
101
101
|
devzone cluster clean --quiet || true
|
|
@@ -108,7 +108,7 @@ show_state() {
|
|
|
108
108
|
case "$ctx_work" in
|
|
109
109
|
kind-gitlab* | kind-devzone*)
|
|
110
110
|
ctx_host="$(KUBECONFIG="${DEVZONE_KUBE_HOST:-$HOME/.kube/hote.config}" kubectl config current-context 2>/dev/null || true)"
|
|
111
|
-
if [ -n "$ctx_host" ] &&
|
|
111
|
+
if [ -n "$ctx_host" ] && devzone kube reachable "$ctx_host"; then
|
|
112
112
|
printf ' ⚠ working cluster: %s (devzone internal cluster); go back: devzone use %s\n' "$ctx_work" "$ctx_host"
|
|
113
113
|
fi
|
|
114
114
|
;;
|
|
@@ -118,7 +118,7 @@ show_state() {
|
|
|
118
118
|
if [ "$ctx_rbac" = "yes" ]; then
|
|
119
119
|
printf ' ⚠ rbac : access to devzone-postgres secrets not restricted\n'
|
|
120
120
|
fi
|
|
121
|
-
ports_state="$(
|
|
121
|
+
ports_state="$(DEVZONE_STATE="$ETAT" devzone port resume 2>/dev/null || echo none)"
|
|
122
122
|
case "$ports_state" in
|
|
123
123
|
none*) printf ' ○ ports to the workstation %s\n' "$ports_state" ;;
|
|
124
124
|
*) printf ' ✔ ports to the workstation %s\n' "$ports_state" ;;
|
package/.devcontainer/help.sh
CHANGED
|
@@ -14,9 +14,11 @@ devzone_aide() {
|
|
|
14
14
|
devzone disable <module> [--yes] disable and apply at once (--yes: also deletes the data)
|
|
15
15
|
devzone apply install what is enabled
|
|
16
16
|
devzone repair repair gitlab, postgres, ports, passwords
|
|
17
|
-
devzone
|
|
17
|
+
devzone catalog [list|apply|sync|resume|json|remove <app>] applications of the catalog
|
|
18
|
+
devzone metrics [context…] | remove [context…] install or remove metrics-server (kubectl top, k9s)
|
|
18
19
|
devzone use CTX [--confirm CTX] switch the kubectl working cluster
|
|
19
20
|
devzone clusters view of the connected clusters (work and services)
|
|
21
|
+
devzone kube saved|choose|save|local|reachable|prompt cluster helpers, in Go
|
|
20
22
|
devzone is-enabled <module> code 0 if enabled
|
|
21
23
|
devzone test-bash32 run the bats tests under bash 3.2 (Docker container)
|
|
22
24
|
devzone test-gitlab end-to-end test of the GitLab module and platform
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Single source for the repowarden version used by workspace-init.sh and manage/scripts/ci/versions.sh.
|
|
2
2
|
REPOWARDEN_VERSION=4.18.1
|
|
3
3
|
|
|
4
|
+
# Pinned metrics-server release installed on the local clusters by devzone.
|
|
5
|
+
METRICS_SERVER_VERSION=v0.9.0
|
|
6
|
+
|
|
4
7
|
# BuildKit client version installed in the workspace image (#514). Must match
|
|
5
8
|
# buildkit.image in charts/devzone-workspace/values.yaml.
|
|
6
9
|
BUILDKIT_VERSION=0.34.2
|
|
@@ -63,12 +63,13 @@ init_prompt() {
|
|
|
63
63
|
log "prompt: cannot write $bashrc"
|
|
64
64
|
return 0
|
|
65
65
|
fi
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
if grep -qE 'invite-kube\.sh|
|
|
69
|
-
sed -i -e '
|
|
70
|
-
-e '
|
|
71
|
-
|
|
66
|
+
# Blocks written before the Go prompt sourced a shell library that no longer
|
|
67
|
+
# exists: drop them, the new block below takes over (migration, idempotent)
|
|
68
|
+
if grep -qE 'invite-kube\.sh|kube-prompt\.sh' "$bashrc" 2>/dev/null; then
|
|
69
|
+
sed -i -e '/devzone prompt >>>/d' -e '/devzone prompt <</d' \
|
|
70
|
+
-e '/invite-kube\.sh/d' -e '/kube-prompt\.sh/d' \
|
|
71
|
+
-e '/devzone_invite_kube/d' -e '/devzone_kube_prompt/d' "$bashrc"
|
|
72
|
+
log "prompt block migrated to the Go command"
|
|
72
73
|
fi
|
|
73
74
|
if grep -qF "$PROMPT_START" "$bashrc" 2>/dev/null; then
|
|
74
75
|
log "prompt block already present"
|
|
@@ -76,9 +77,7 @@ init_prompt() {
|
|
|
76
77
|
fi
|
|
77
78
|
cat >>"$bashrc" <<'PROMPT'
|
|
78
79
|
# >>> devzone prompt >>>
|
|
79
|
-
|
|
80
|
-
. /usr/local/share/devzone/.devcontainer/kube-prompt.sh
|
|
81
|
-
PS1='$(devzone_kube_prompt) '"$PS1"
|
|
80
|
+
PS1='$(devzone kube prompt) '"$PS1"
|
|
82
81
|
# <<< devzone prompt <<<
|
|
83
82
|
PROMPT
|
|
84
83
|
log "prompt block added to $bashrc"
|
package/.gitattributes
CHANGED
|
@@ -14,3 +14,11 @@ manage/devzone text eol=lf
|
|
|
14
14
|
*.yml text eol=lf
|
|
15
15
|
*.md text eol=lf
|
|
16
16
|
charts/** text eol=lf
|
|
17
|
+
# Reference files keep LF bytes on every workstation: with core.autocrlf a
|
|
18
|
+
# CRLF reference no longer matches the LF text from the program, and embedded
|
|
19
|
+
# CRLF data is baked into binaries built on Windows.
|
|
20
|
+
**/testdata/** text eol=lf
|
|
21
|
+
**/golden/** text eol=lf
|
|
22
|
+
**/goldens/** text eol=lf
|
|
23
|
+
*.golden text eol=lf
|
|
24
|
+
*.txt text eol=lf
|
package/README.md
CHANGED
|
@@ -357,7 +357,7 @@ A project's user owns **its** database (it creates tables, indexes, data in it)
|
|
|
357
357
|
|
|
358
358
|
## See my application in the browser
|
|
359
359
|
|
|
360
|
-
On the Kubernetes workstation, `devzone workspace start` starts a port watcher: each TCP port ≥ 1024 that listens in the pod is relayed to `127.0.0.1` of the workstation, at the same number, by `kubectl port-forward`. A server started in the pod (`npm run dev`, port 5173) therefore answers at `http://localhost:5173`, without a command. The enabled services (PostgreSQL, MySQL, Argo CD) are relayed too, on their usual port. The Services of applications deployed in the cluster are relayed the same way, each on a local port (80 → 8080; a port already taken elsewhere becomes another port): `devzone workspace ports status` shows their URL `http://127.0.0.1:<port>`. A Service can be excluded with the annotation `devzone.io/relay: "false"`. The watcher is driven with `devzone workspace ports start|stop|status`; details in the [reference](manage/docs/reference.md#applications-and-services-on-the-workstations-localhost).
|
|
360
|
+
On the Kubernetes workstation, `devzone workspace start` starts a port watcher: each TCP port ≥ 1024 that listens in the pod is relayed to `127.0.0.1` of the workstation, at the same number, by `kubectl port-forward`. A server started in the pod (`npm run dev`, port 5173) therefore answers at `http://localhost:5173`, without a command. The enabled services (PostgreSQL, MySQL, Argo CD) are relayed too, on their usual port. The Services of applications deployed in the cluster are relayed the same way, each on a local port (80 → 8080; a port already taken elsewhere becomes another port): `devzone workspace ports status` shows their URL `http://127.0.0.1:<port>`. A Service can be excluded with the annotation `devzone.io/relay: "false"`. The watcher is driven with `devzone workspace ports start|stop|status`; details in the [reference](manage/docs/reference.md#applications-and-services-on-the-workstations-localhost). Its automatic start needs no command: the Go program installs or repairs it after a folder creation, an update or any successful devzone command from a devzone folder, silently once it is current. `devzone workspace ports disable` and `devzone uninstall` remember the refusal in `.devzone.ports-disabled` in that folder; `devzone workspace ports enable` removes the marker.
|
|
361
361
|
|
|
362
362
|
The relays kept in the state of a workstation instance are listed and closed with `devzone port`:
|
|
363
363
|
|
package/bin/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
da866140afd70f74357e1873c55c5a376443fd6991d4afad92cf12afd08ec09c devzone-linux-amd64
|
|
2
|
+
cb54b8971528165e10775e1cbe3622d4567d274854cb9378446bccdec11cbd36 devzone-linux-arm64
|
|
3
|
+
1b51f6136b3b5d53495a10d81ed4461d87bfbd15c91fb4a0be074c3defb5face devzone-darwin-amd64
|
|
4
|
+
0c062cfcd30734673a5c0572a41436e56bdde30b67fc5a80c33c14424d51b1ba devzone-darwin-arm64
|
|
5
|
+
6faab20cd349abc04711f0ed340304ad491eaf98f6bcbe83fe8747a0e40ed31e devzone-windows-amd64.exe
|
|
6
|
+
62b0a6eb4804a8afcb6b37662681c63ff218b2eb59021015100b8b1b620e2cbe 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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# The one definition of MySQL: the helm-direct path of the catalogue (#414)
|
|
2
|
-
# installs this chart (
|
|
2
|
+
# installs this chart (internal/platform/helm). The secret <name>-admin
|
|
3
3
|
# (root password) is created apart by
|
|
4
4
|
# devzone, never by the chart (#538: secrets out of Git).
|
|
5
5
|
# Name of the application (Service, StatefulSet and secret ref): mysql of the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# The one definition of PostgreSQL: the helm-direct path installs this chart
|
|
2
|
-
# (
|
|
2
|
+
# (internal/platform/helm) as the release postgres. The
|
|
3
3
|
# secret postgres-admin (superuser password) is created apart by devzone,
|
|
4
4
|
# never by the chart (#516: secrets out of Git).
|
|
5
5
|
image: postgres:16.15-alpine
|
package/manage/devzone
CHANGED
|
@@ -183,8 +183,8 @@ EOT
|
|
|
183
183
|
# of .devcontainer/devzone (consistency test in manage/test/cli.bats)
|
|
184
184
|
container_command() {
|
|
185
185
|
case "$1" in
|
|
186
|
-
ai | agent | apply | argocd | build | catalog | cluster | clusters | disable | \
|
|
187
|
-
enable | gitlab | is-enabled | llm | metrics | modules | mysql | packages | \
|
|
186
|
+
ai | agent | apply | argocd | build | catalog | catalog-watcher | cluster | clusters | disable | \
|
|
187
|
+
enable | gitlab | is-enabled | kube | llm | metrics | modules | mysql | packages | \
|
|
188
188
|
passwords | platform | port | postgres | repair | start | state | status | \
|
|
189
189
|
test-bash32 | test-gitlab | ticket | use) return 0 ;;
|
|
190
190
|
*) return 1 ;;
|
|
@@ -185,7 +185,7 @@ else
|
|
|
185
185
|
for i in ${images[@]+"${images[@]}"}; do docker rmi "$i" >/dev/null && echo "✔ image removed: $i"; done
|
|
186
186
|
for v in ${dind[@]+"${dind[@]}"} ${volumes[@]+"${volumes[@]}"}; do docker volume rm "$v" >/dev/null && echo "✔ volume removed: $v"; done
|
|
187
187
|
if [ "${#metrics[@]}" -gt 0 ]; then
|
|
188
|
-
version="$(sed -n 's/^
|
|
188
|
+
version="$(sed -n 's/^METRICS_SERVER_VERSION=//p' "$HERE/.devcontainer/versions.env" | head -1)"
|
|
189
189
|
manifest="https://github.com/kubernetes-sigs/metrics-server/releases/download/${version}/components.yaml"
|
|
190
190
|
for ctx in "${metrics[@]}"; do
|
|
191
191
|
kubectl --context "$ctx" delete -f "$manifest" --ignore-not-found >/dev/null &&
|
|
@@ -131,8 +131,8 @@ 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
|
-
DEVZONE_ROOT="$PWD"
|
|
135
|
-
echo "⚠ .password not updated (
|
|
134
|
+
DEVZONE_ROOT="$PWD" devzone passwords regenerate 2>/dev/null ||
|
|
135
|
+
echo "⚠ .password not updated (devzone passwords regenerate)" >&2
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
# Installs Argo CD (pinned chart and values), idempotent (upgrade --install)
|
package/package.json
CHANGED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck disable=SC2034
|
|
3
|
-
# Model exclusions and network wait of the agent supervisor (#328).
|
|
4
|
-
# Library sourced by agent.sh: no command is launched here.
|
|
5
|
-
|
|
6
|
-
# Known opencode error texts (grep -E); error_cause takes the cause from them.
|
|
7
|
-
ERRORS='not available in your country|Free usage limit|content filter|Model is unavailable|Upstream request failed|ProviderHeaderTimeout|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ECONNRESET|fetch failed|network'
|
|
8
|
-
# Prefix of an opencode error line. Erreur: stays so that French output still matches.
|
|
9
|
-
ERROR_LINE='(^|[[:space:]])(Error|ERROR|Erreur):'
|
|
10
|
-
|
|
11
|
-
# Cause of a failure: pays (country, lasting), quota, filtre (filter), reseau
|
|
12
|
-
# (network, no exclusion) or autre (other). The stored names stay as they are:
|
|
13
|
-
# they are written to the state files and to devzone agent state --json.
|
|
14
|
-
error_cause() {
|
|
15
|
-
local t="$1"
|
|
16
|
-
case "$t" in
|
|
17
|
-
*"not available in your country"*) echo "pays" ;;
|
|
18
|
-
*"Free usage limit"*) echo "quota" ;;
|
|
19
|
-
*"content filter"*) echo "filtre" ;;
|
|
20
|
-
*"ENOTFOUND"* | *"ECONNREFUSED"* | *"ETIMEDOUT"* | *"EAI_AGAIN"* | *"ECONNRESET"* | *"fetch failed"* | *"network"*)
|
|
21
|
-
echo "reseau" ;;
|
|
22
|
-
*) echo "autre" ;;
|
|
23
|
-
esac
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
# Cause name shown to the user, from a stored cause (mute and muet are both silent).
|
|
27
|
-
cause_label() {
|
|
28
|
-
case "$1" in
|
|
29
|
-
pays) echo "country" ;;
|
|
30
|
-
quota) echo "quota" ;;
|
|
31
|
-
filtre) echo "filter" ;;
|
|
32
|
-
reseau) echo "network" ;;
|
|
33
|
-
mute | muet) echo "silent" ;;
|
|
34
|
-
*) echo "other" ;;
|
|
35
|
-
esac
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Duration of an exclusion in seconds: country 7 days (DEVZONE_AGENT_COUNTRY_EXCLUSION), the others 1 h.
|
|
39
|
-
exclusion_duration() {
|
|
40
|
-
case "$1" in
|
|
41
|
-
pays) echo "${DEVZONE_AGENT_COUNTRY_EXCLUSION:-604800}" ;;
|
|
42
|
-
*) echo 3600 ;;
|
|
43
|
-
esac
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# Readable duration of an exclusion for the journal: "7 d", "1 h" or "30 s".
|
|
47
|
-
exclusion_label() {
|
|
48
|
-
local d
|
|
49
|
-
d="$(exclusion_duration "$1")"
|
|
50
|
-
if [ "$d" -ge 86400 ]; then
|
|
51
|
-
echo "$(( d / 86400 )) d"
|
|
52
|
-
elif [ "$d" -ge 3600 ]; then
|
|
53
|
-
echo "$(( d / 3600 )) h"
|
|
54
|
-
else
|
|
55
|
-
echo "${d} s"
|
|
56
|
-
fi
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
# Writes the exclusion of the model: "<start> <cause> <duration>" in $AGENT_STATE/ecart-<model>
|
|
60
|
-
# (the state file keeps its name on disk).
|
|
61
|
-
model_exclude() {
|
|
62
|
-
printf '%s %s %s\n' "$(date +%s)" "$2" "$(exclusion_duration "$2")" >"$AGENT_STATE/ecart-$1"
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
# True (0) when the model is excluded right now. Also reads the old muet-<model>
|
|
66
|
-
# format (timestamp only, 1 h).
|
|
67
|
-
model_excluded() {
|
|
68
|
-
local f e cause d
|
|
69
|
-
f="$AGENT_STATE/ecart-$1"
|
|
70
|
-
if [ ! -f "$f" ]; then f="$AGENT_STATE/muet-$1"; fi
|
|
71
|
-
if [ ! -f "$f" ]; then return 1; fi
|
|
72
|
-
read -r e cause d <<<"$(cat "$f")"
|
|
73
|
-
[ "$(date +%s)" -lt $(( e + ${d:-3600} )) ]
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
# True (0) when opencode.ai resolves and answers over HTTPS: one try, no wait.
|
|
77
|
-
network_reachable() {
|
|
78
|
-
getent hosts opencode.ai >/dev/null 2>&1 && curl -sI --max-time 5 https://opencode.ai >/dev/null 2>&1
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# Waits for the network to come back: a try every DEVZONE_AGENT_NETWORK_STEP s, for
|
|
82
|
-
# DEVZONE_AGENT_NETWORK_MAX s at most. Returns 0 when it is back.
|
|
83
|
-
network_wait() {
|
|
84
|
-
local end
|
|
85
|
-
end=$(( $(date +%s) + ${DEVZONE_AGENT_NETWORK_MAX:-1800} ))
|
|
86
|
-
echo "=== network down, waiting" >>"$AGENT_JOURNAL"
|
|
87
|
-
while [ "$(date +%s)" -lt "$end" ]; do
|
|
88
|
-
if network_reachable; then
|
|
89
|
-
echo "=== network back" >>"$AGENT_JOURNAL"
|
|
90
|
-
return 0
|
|
91
|
-
fi
|
|
92
|
-
sleep "${DEVZONE_AGENT_NETWORK_STEP:-30}"
|
|
93
|
-
done
|
|
94
|
-
return 1
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
# Lists the current exclusions for devzone agent state (muet- too, without cause).
|
|
98
|
-
agent_exclusions() {
|
|
99
|
-
local f m e cause d end now
|
|
100
|
-
now="$(date +%s)"
|
|
101
|
-
for f in "$AGENT_STATE"/ecart-*; do
|
|
102
|
-
[ -e "$f" ] || continue
|
|
103
|
-
m="${f##*/ecart-}"
|
|
104
|
-
read -r e cause d <<<"$(cat "$f")"
|
|
105
|
-
end=$(( e + ${d:-3600} ))
|
|
106
|
-
[ "$now" -lt "$end" ] || continue
|
|
107
|
-
echo " model $m excluded ($(cause_label "$cause")) until $(utc_time "$end")"
|
|
108
|
-
done
|
|
109
|
-
for f in "$AGENT_STATE"/muet-*; do
|
|
110
|
-
[ -e "$f" ] || continue
|
|
111
|
-
m="${f##*/muet-}"
|
|
112
|
-
e="$(cat "$f" 2>/dev/null || true)"
|
|
113
|
-
[ -n "$e" ] || continue
|
|
114
|
-
end=$(( e + 3600 ))
|
|
115
|
-
[ "$now" -lt "$end" ] || continue
|
|
116
|
-
echo " model $m excluded (silent) until $(utc_time "$end")"
|
|
117
|
-
done
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
# Lifts the exclusion of a model, or of all (--all): devzone agent release.
|
|
121
|
-
exclusion_clear() {
|
|
122
|
-
case "$1" in
|
|
123
|
-
--all) rm -f "$AGENT_STATE"/ecart-* "$AGENT_STATE"/muet-* ;;
|
|
124
|
-
*) rm -f "$AGENT_STATE/ecart-$1" "$AGENT_STATE/muet-$1" ;;
|
|
125
|
-
esac
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
# Keeps the opencode log lines of the session written by --print-logs: only the
|
|
129
|
-
# "timestamp=... level=ERROR ..." lines of a failure declare an exclusion, not the
|
|
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.
|
|
133
|
-
error_lines() {
|
|
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
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
# Stops the current session when the journal holds quota, country or filter since
|
|
138
|
-
# its start: the model is excluded and the session is killed (process and children).
|
|
139
|
-
session_fatal_error() {
|
|
140
|
-
local pid="$1" journal="$2" offset="$3" m="$4" folder="$5"
|
|
141
|
-
local output cause
|
|
142
|
-
output="$(tail -c "+$(( offset + 1 ))" "$journal" 2>/dev/null || true)"
|
|
143
|
-
cause="$(error_cause "$(error_lines "$output")")"
|
|
144
|
-
case "$cause" in
|
|
145
|
-
quota | pays | filtre) ;;
|
|
146
|
-
*) return 1 ;;
|
|
147
|
-
esac
|
|
148
|
-
pkill -P "$pid" 2>/dev/null || true
|
|
149
|
-
kill "$pid" 2>/dev/null || true
|
|
150
|
-
wait "$pid" 2>/dev/null || true
|
|
151
|
-
rights_verify "$folder"
|
|
152
|
-
model_exclude "$m" "$cause"
|
|
153
|
-
model_requested_excluded "$m" "$cause" "$journal"
|
|
154
|
-
printf '%s\n' "=== opencode/$m excluded ($(cause_label "$cause")): next model" >>"$journal"
|
|
155
|
-
return 0
|
|
156
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Local model in the rotation of devzone agent (#586), sourced by agent.sh.
|
|
3
|
-
# The local slot is the host model when Ollama answers /api/tags with at least
|
|
4
|
-
# one model (reference devzone-host/<model>). It always comes after every online
|
|
5
|
-
# model; its internal name has no slash (an ecart-<name> file is written for it);
|
|
6
|
-
# opencode gets the reference.
|
|
7
|
-
# Real host model name (Ollama) chosen for this attempt, empty otherwise.
|
|
8
|
-
LOCAL_HOST_REAL=""
|
|
9
|
-
# Internal (slash-free) name of the host model chosen for this attempt.
|
|
10
|
-
LOCAL_HOST_INTERNAL=""
|
|
11
|
-
|
|
12
|
-
# shellcheck source=SCRIPTDIR/ai/host-models.sh
|
|
13
|
-
# shellcheck disable=SC1091
|
|
14
|
-
. "$ICI/ai/host-models.sh"
|
|
15
|
-
|
|
16
|
-
# Sanitizes a model name into an internal name: every character outside
|
|
17
|
-
# [A-Za-z0-9._-] becomes '_'. Used for ecart-<name> files, the journal and
|
|
18
|
-
# the rotation, so a host model such as hf.co/org/model:tag never creates a
|
|
19
|
-
# nested or invalid path.
|
|
20
|
-
internal_name() {
|
|
21
|
-
printf '%s' "$1" | sed 's/[^A-Za-z0-9._-]/_/g'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
# Sets LOCAL_MODEL for this attempt, read by model_at_rank and
|
|
25
|
-
# models_total. Also records the real host model name when the host is chosen.
|
|
26
|
-
local_charge() {
|
|
27
|
-
local nom
|
|
28
|
-
LOCAL_MODEL=""
|
|
29
|
-
LOCAL_HOST_REAL=""
|
|
30
|
-
LOCAL_HOST_INTERNAL=""
|
|
31
|
-
nom="$(premier 2>/dev/null || true)"
|
|
32
|
-
[ -n "$nom" ] || return 0
|
|
33
|
-
LOCAL_HOST_REAL="$nom"
|
|
34
|
-
LOCAL_HOST_INTERNAL="$(internal_name "$nom")"
|
|
35
|
-
LOCAL_MODEL="$LOCAL_HOST_INTERNAL"
|
|
36
|
-
return 0
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# Model reference given to opencode -m
|
|
40
|
-
model_ref() {
|
|
41
|
-
if [ -n "$LOCAL_HOST_INTERNAL" ] && [ "$1" = "$LOCAL_HOST_INTERNAL" ]; then
|
|
42
|
-
echo "devzone-host/$LOCAL_HOST_REAL"
|
|
43
|
-
else
|
|
44
|
-
echo "opencode/$1"
|
|
45
|
-
fi
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# Model of rank $1 in the attempt that starts at $2: online ones in rotation,
|
|
49
|
-
# then the local host model
|
|
50
|
-
model_at_rank() {
|
|
51
|
-
if [ "$1" -lt "${#FREE_MODELS[@]}" ]; then
|
|
52
|
-
echo "${FREE_MODELS[$(( ($2 + $1) % ${#FREE_MODELS[@]} ))]}"
|
|
53
|
-
else
|
|
54
|
-
echo "$LOCAL_MODEL"
|
|
55
|
-
fi
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# Number of models to try: the online ones, plus the local host model if ready
|
|
59
|
-
models_total() {
|
|
60
|
-
local total="${#FREE_MODELS[@]}"
|
|
61
|
-
[ -n "$LOCAL_MODEL" ] && total=$((total + 1))
|
|
62
|
-
echo "$total"
|
|
63
|
-
}
|