devzone 7.5.0 → 7.5.2
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/devzone +15 -16
- package/.devcontainer/devzone-status.sh +3 -3
- package/.devcontainer/services-admin.sh +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/manage/devzone +33 -13
- package/manage/scripts/workspace/argocd-services.sh +1 -1
- package/manage/scripts/workspace/argocd-workspace.sh +1 -1
- package/manage/workspace.sh +11 -27
- package/package.json +1 -1
- package/.devcontainer/devzone-repair.sh +0 -85
- package/.devcontainer/devzone-version.sh +0 -78
- package/.devcontainer/help.sh +0 -46
- package/manage/scripts/create-mode.sh +0 -103
- package/manage/scripts/devzone-create.sh +0 -110
- package/manage/scripts/devzone-update.sh +0 -237
- package/manage/scripts/kube-ready.sh +0 -75
- package/manage/scripts/workspace/ports-apps.sh +0 -156
- package/manage/scripts/workspace/ports-workspace.sh +0 -235
- package/manage/scripts/workspace/services-workspace.sh +0 -193
- package/manage/scripts/workspace/workspace-clone.sh +0 -12
- package/manage/scripts/workspace/workspace-copies.sh +0 -44
- package/manage/scripts/workspace/workspace-egress.sh +0 -184
- package/manage/scripts/workspace/workspace-update.sh +0 -106
- package/manage/scripts/workspace/workspace-wait.sh +0 -56
package/.devcontainer/devzone
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# shellcheck disable=SC2034 # shared variables, read by the sourced devzone-*.sh
|
|
3
|
-
# devzone help (devzone --help):
|
|
3
|
+
# devzone help (devzone --help): the Go command of the pod, below.
|
|
4
4
|
#
|
|
5
5
|
# Per-instance state: $RACINE/.devzone.modules (a folder mounted from the host,
|
|
6
6
|
# survives rebuilds), one line "module=on|off"; the chosen platform is kept
|
|
@@ -20,7 +20,9 @@ while [ -L "$SOURCE" ]; do
|
|
|
20
20
|
esac
|
|
21
21
|
done
|
|
22
22
|
ICI="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
23
|
+
export DEVZONE_POD_SCRIPT="${DEVZONE_POD_SCRIPT:-$ICI/devzone}"
|
|
23
24
|
# Go first (#754): a command ported to Go runs in the devzone-pod binary of the image.
|
|
25
|
+
# DEVZONE_HOST_BIN also names that binary when a test builds it outside the image.
|
|
24
26
|
# DEVZONE_NO_GO=1 forces the shell, DEVZONE_FROM_GO=1 avoids loops.
|
|
25
27
|
# DEVZONE_FROM_GO only concerns this call: not inherited, so that a "devzone …"
|
|
26
28
|
# run by this script reaches the Go command again (#864).
|
|
@@ -33,18 +35,23 @@ if [ -z "${DEVZONE_NO_GO:-}" ] && [ -z "$FROM_GO" ]; then
|
|
|
33
35
|
*) POD_GO_ARCH="" ;;
|
|
34
36
|
esac
|
|
35
37
|
POD_GO="$ICI/bin/devzone-pod-$(uname -s | tr '[:upper:]' '[:lower:]')-$POD_GO_ARCH"
|
|
38
|
+
if [ -n "${DEVZONE_HOST_BIN:-}" ] && [ -x "$DEVZONE_HOST_BIN" ]; then
|
|
39
|
+
POD_GO="$DEVZONE_HOST_BIN"
|
|
40
|
+
fi
|
|
41
|
+
if [ -x "$POD_GO" ]; then
|
|
42
|
+
# Shell helpers still in use call the Go program by this variable.
|
|
43
|
+
export DEVZONE_HOST_BIN="$POD_GO"
|
|
44
|
+
fi
|
|
36
45
|
if [ -n "$POD_GO_ARCH" ] && [ -x "$POD_GO" ] && "$POD_GO" handles "${1:-}" >/dev/null 2>&1; then
|
|
37
46
|
DEVZONE_POD_SCRIPT="$ICI/devzone" exec "$POD_GO" "$@"
|
|
38
47
|
fi
|
|
39
48
|
fi
|
|
40
|
-
# shellcheck source=SCRIPTDIR/help.sh
|
|
41
|
-
# shellcheck disable=SC1091
|
|
42
|
-
. "$ICI/help.sh"
|
|
43
49
|
VERSIONS="$ICI/../manage/scripts/ci/versions.sh"
|
|
44
50
|
# devzone folder (/workspaces/devzone); DEVZONE_ROOT for the tests
|
|
45
51
|
RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
|
|
46
52
|
# Default state of the instance; DEVZONE_STATE takes precedence (tests, CI)
|
|
47
53
|
ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
54
|
+
export DEVZONE_STATE="$ETAT"
|
|
48
55
|
MODULES=(ai kubernetes gitlab postgres argocd mysql)
|
|
49
56
|
INSTANCE_SUFFIX=""
|
|
50
57
|
[ "${DEVZONE_INSTANCE:-devzone}" = devzone ] || INSTANCE_SUFFIX="-${DEVZONE_INSTANCE}"
|
|
@@ -90,15 +97,9 @@ GITLAB_URL_MODULE=http://gitlab.localhost:8929
|
|
|
90
97
|
# shellcheck source=SCRIPTDIR/devzone-services.sh
|
|
91
98
|
# shellcheck disable=SC1091
|
|
92
99
|
. "$ICI/devzone-services.sh"
|
|
93
|
-
# shellcheck source=SCRIPTDIR/devzone-repair.sh
|
|
94
|
-
# shellcheck disable=SC1091
|
|
95
|
-
. "$ICI/devzone-repair.sh"
|
|
96
100
|
# shellcheck source=SCRIPTDIR/devzone-platform.sh
|
|
97
101
|
# shellcheck disable=SC1091
|
|
98
102
|
. "$ICI/devzone-platform.sh"
|
|
99
|
-
# shellcheck source=SCRIPTDIR/devzone-version.sh
|
|
100
|
-
# shellcheck disable=SC1091
|
|
101
|
-
. "$ICI/devzone-version.sh"
|
|
102
103
|
# shellcheck source=SCRIPTDIR/devzone-status.sh
|
|
103
104
|
# shellcheck disable=SC1091
|
|
104
105
|
. "$ICI/devzone-status.sh"
|
|
@@ -109,11 +110,11 @@ case "${1:-}" in
|
|
|
109
110
|
state)
|
|
110
111
|
export DEVZONE_STATE="$ETAT"
|
|
111
112
|
case "${2:-}" in
|
|
112
|
-
write|remove|replace|init|recovery-mark|recovery-wait|recovery-pending|recovery-confirm|catalog-sync|gitops-line|held|json)
|
|
113
|
+
write|remove|replace|init|recovery-mark|recovery-wait|recovery-pending|recovery-confirm|catalog-sync|gitops-line|held|outdated-tools|missing-worktrees|json)
|
|
113
114
|
# shellcheck disable=SC2034 # DEVZONE_STATE used by state helpers
|
|
114
115
|
ETAT="$DEVZONE_STATE"
|
|
115
116
|
;;
|
|
116
|
-
*) echo "devzone state: write|remove|replace|init|recovery-mark|recovery-wait|recovery-pending|recovery-confirm|catalog-sync|gitops-line|held|json" >&2; exit 1 ;;
|
|
117
|
+
*) echo "devzone state: write|remove|replace|init|recovery-mark|recovery-wait|recovery-pending|recovery-confirm|catalog-sync|gitops-line|held|outdated-tools|missing-worktrees|json" >&2; exit 1 ;;
|
|
117
118
|
esac
|
|
118
119
|
ici_state="$ICI"
|
|
119
120
|
pod_state=""
|
|
@@ -135,7 +136,7 @@ case "${1:-}" in
|
|
|
135
136
|
# The user confirms the current state (#417, step 4): the watchers
|
|
136
137
|
# may uninstall again
|
|
137
138
|
DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state recovery-confirm
|
|
138
|
-
|
|
139
|
+
"${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" apply-repowarden
|
|
139
140
|
[ "$(value_of ai)" = off ] || DEVZONE_STATE="$ETAT" "$ICI/devzone" ai apply on
|
|
140
141
|
# gitlab, postgres, argocd: installed from the workstation in the
|
|
141
142
|
# Kubernetes workspace pod (#528), by their installer elsewhere
|
|
@@ -153,10 +154,9 @@ case "${1:-}" in
|
|
|
153
154
|
build)
|
|
154
155
|
bash "$ICI/workspace-build.sh" "${@:2}"
|
|
155
156
|
;;
|
|
156
|
-
repair) repair_workstation ;;
|
|
157
157
|
# Go only: reached when the binary did not take the call. Never call
|
|
158
158
|
# "devzone" again from here, it would loop forever, see #864
|
|
159
|
-
cluster | clusters | metrics | use | kube | ai | agent | postgres | mysql | gitlab | test-gitlab | catalog | catalog-watcher)
|
|
159
|
+
-h | --help | help | repair | apply-repowarden | cluster | clusters | metrics | use | kube | ai | agent | postgres | mysql | gitlab | test-gitlab | catalog | catalog-watcher)
|
|
160
160
|
echo "devzone $1: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
161
161
|
exit 1
|
|
162
162
|
;;
|
|
@@ -176,7 +176,6 @@ case "${1:-}" in
|
|
|
176
176
|
echo "devzone passwords: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
177
177
|
exit 1
|
|
178
178
|
;;
|
|
179
|
-
-h | --help | help) devzone_aide ;;
|
|
180
179
|
test-bash32) bash "$RACINE/manage/test/bash32.sh" ;;
|
|
181
180
|
platform)
|
|
182
181
|
if [ -n "${2:-}" ]; then
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
show_state() {
|
|
10
10
|
local name email status m late path ports_state ctx_work ctx_host packages_mark packages_names argocd_repo
|
|
11
11
|
echo "devzone: state (devzone to show it again)"
|
|
12
|
-
|
|
12
|
+
"${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" version-available-line
|
|
13
13
|
name="$(git config --get user.name || true)"
|
|
14
14
|
email="$(git config --get user.email || true)"
|
|
15
15
|
if [ -n "$name" ] && [ -n "$email" ]; then
|
|
@@ -41,7 +41,7 @@ show_state() {
|
|
|
41
41
|
echo " ✔ GitHub connected"
|
|
42
42
|
fi
|
|
43
43
|
fi
|
|
44
|
-
if late="$(
|
|
44
|
+
if late="$("${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" state outdated-tools 2>/dev/null)"; then
|
|
45
45
|
if [ -z "$late" ]; then
|
|
46
46
|
echo " ✔ tools pinned versions"
|
|
47
47
|
else
|
|
@@ -54,7 +54,7 @@ show_state() {
|
|
|
54
54
|
while IFS= read -r path; do
|
|
55
55
|
[ -n "$path" ] || continue
|
|
56
56
|
echo " ⚠ worktree $path absent here (created outside the container?): manage it on that side, never git worktree prune here (manage/docs/reference.md, Git worktrees)"
|
|
57
|
-
done < <(
|
|
57
|
+
done < <("${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" state missing-worktrees)
|
|
58
58
|
for m in "${MODULES[@]}"; do
|
|
59
59
|
if in_pod && service_module "$m"; then
|
|
60
60
|
# Kubernetes workspace pod (#528): presence by the cluster DNS
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# the Kubernetes workspace pod, with a temporary administrator token (#528).
|
|
4
4
|
# services-admin.sh enable|disable <service> [options of devzone enable]
|
|
5
5
|
# services-admin.sh seed gitlab data of gitlab seeded again, in the pod (#538)
|
|
6
|
-
# Run by the workstation (
|
|
6
|
+
# Run by the workstation (devzone workspace services, Go) through
|
|
7
7
|
# kubectl exec -i: the token comes on stdin, is never printed and lives only
|
|
8
8
|
# in a temporary kubeconfig removed at the end.
|
|
9
9
|
# Why: the pod has no kubeconfig and its service account is limited (#430),
|
package/bin/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
3289788a2d0ab9065361c2de6179e7c201279d5ffeb71c7ac4ea4b938e65639d devzone-linux-amd64
|
|
2
|
+
e19ef85c224cf459a5552f666af575710aba5b8c1c0b66e7ac4595d411599b1d devzone-linux-arm64
|
|
3
|
+
e9326ac11614d813221740a862c9514a8567abdaf04bdd5a3e331e8b7ca3013f devzone-darwin-amd64
|
|
4
|
+
1c3c524989be3b4356da86b3ab294bca1a29e48fc7ca141b05167c2edcf41e31 devzone-darwin-arm64
|
|
5
|
+
ae7959a3a5bbdf36fa78bd0338f873f4824b8f31dde628bd8bea61f06415e253 devzone-windows-amd64.exe
|
|
6
|
+
4ef9712349ebae0806f80c73b846d6e8578a530222db77935844d06f5b7366ee 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
|
package/manage/devzone
CHANGED
|
@@ -108,13 +108,38 @@ go_install() {
|
|
|
108
108
|
|
|
109
109
|
# Runs the Go binary when it applies (never returns then); otherwise returns
|
|
110
110
|
go_launch() {
|
|
111
|
-
local platform ext="" name bin want have ver base target
|
|
111
|
+
local platform ext="" name bin want have ver base target tmpgo
|
|
112
112
|
if [ -n "${DEVZONE_NO_GO:-}" ] || [ -n "${DEVZONE_FROM_GO:-}" ]; then return 0; fi
|
|
113
113
|
platform="$(go_platform)" || return 0
|
|
114
114
|
case "$platform" in windows-*) ext=.exe ;; esac
|
|
115
115
|
name="devzone-$platform$ext"
|
|
116
116
|
bin="$PAQUET/bin/$name"
|
|
117
|
-
[ -f "$bin" ]
|
|
117
|
+
if [ ! -f "$bin" ]; then
|
|
118
|
+
# No packaged binary (a checkout): resolve one with go when it is
|
|
119
|
+
# available, into the cache, and export it; stay in bash then (#884)
|
|
120
|
+
ver="$(version)"
|
|
121
|
+
base="${XDG_CACHE_HOME:-}"
|
|
122
|
+
if [ -z "$base" ] && [ -n "${HOME:-}" ]; then base="$HOME/.cache"; fi
|
|
123
|
+
target=""
|
|
124
|
+
if [ -n "$base" ] && [ "$ver" != inconnue ] && command -v go >/dev/null 2>&1; then
|
|
125
|
+
target="$base/devzone/bin/$ver/devzone$ext"
|
|
126
|
+
if [ ! -x "$target" ] || [ "$(cat "$target.sha256" 2>/dev/null)" != built ]; then
|
|
127
|
+
tmpgo="$(mktemp "${TMPDIR:-/tmp}/devzone-go.XXXXXX")" || tmpgo=""
|
|
128
|
+
if [ -n "$tmpgo" ] && (cd "$PAQUET" && go build -o "$tmpgo" ./cmd/devzone 2>/dev/null) \
|
|
129
|
+
&& mkdir -p "$(dirname "$target")" && mv -f "$tmpgo" "$target" && printf 'built\n' >"$target.sha256"; then
|
|
130
|
+
:
|
|
131
|
+
else
|
|
132
|
+
rm -f "$tmpgo"
|
|
133
|
+
target=""
|
|
134
|
+
fi
|
|
135
|
+
fi
|
|
136
|
+
fi
|
|
137
|
+
if [ -n "$target" ]; then export DEVZONE_HOST_BIN="$target"; fi
|
|
138
|
+
return 0
|
|
139
|
+
fi
|
|
140
|
+
# The shell scripts still run call the Go program for their checks (#884):
|
|
141
|
+
# the launcher exports it first; the exec path below refines it to the cache
|
|
142
|
+
export DEVZONE_HOST_BIN="$bin"
|
|
118
143
|
ver="$(version)"
|
|
119
144
|
[ "$ver" != inconnue ] || return 0
|
|
120
145
|
base="${XDG_CACHE_HOME:-}"
|
|
@@ -186,7 +211,7 @@ EOT
|
|
|
186
211
|
# of .devcontainer/devzone (consistency test in manage/test/cli.bats)
|
|
187
212
|
container_command() {
|
|
188
213
|
case "$1" in
|
|
189
|
-
ai | agent | apply | argocd | build | catalog | catalog-watcher | cluster | clusters | disable | \
|
|
214
|
+
ai | agent | apply | apply-repowarden | argocd | build | catalog | catalog-watcher | cluster | clusters | disable | \
|
|
190
215
|
enable | gitlab | is-enabled | kube | llm | metrics | modules | mysql | packages | \
|
|
191
216
|
passwords | platform | port | postgres | repair | start | state | status | \
|
|
192
217
|
test-bash32 | test-gitlab | ticket | use) return 0 ;;
|
|
@@ -200,11 +225,9 @@ case "${1:-}" in
|
|
|
200
225
|
"" | -h | --help | help) show_help ;;
|
|
201
226
|
-v | --version) version ;;
|
|
202
227
|
update)
|
|
203
|
-
#
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
. "$PAQUET/manage/scripts/devzone-update.sh"
|
|
207
|
-
update_workstation "${@:2}"
|
|
228
|
+
# The update is the Go program's (#884); the package folder is passed through
|
|
229
|
+
# DEVZONE_BASH_ENTRY, as the launcher exports it when it runs the binary
|
|
230
|
+
DEVZONE_BASH_ENTRY="$PAQUET/manage/devzone" "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" update "${@:2}"
|
|
208
231
|
;;
|
|
209
232
|
uninstall)
|
|
210
233
|
# Devzone folder (.devcontainer/); an older devzone has its uninstall.sh
|
|
@@ -233,10 +256,7 @@ case "${1:-}" in
|
|
|
233
256
|
echo "✖ devzone $1: pod command; run it in the pod (make shell), or choose another folder name" >&2
|
|
234
257
|
exit 2
|
|
235
258
|
fi
|
|
236
|
-
#
|
|
237
|
-
|
|
238
|
-
# shellcheck source=SCRIPTDIR/scripts/devzone-create.sh
|
|
239
|
-
. "$PAQUET/manage/scripts/devzone-create.sh"
|
|
240
|
-
create_workstation "$1" "${@:2}"
|
|
259
|
+
# Creation lives in Go (#884): the shell only names the folder and the package
|
|
260
|
+
DEVZONE_PAQUET="$PAQUET" "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" create-workstation "$1" "${@:2}"
|
|
241
261
|
;;
|
|
242
262
|
esac
|
|
@@ -110,7 +110,7 @@ workspace_deploy() {
|
|
|
110
110
|
[ -z "$with_image" ] || params="$params image.repository=$repository"
|
|
111
111
|
[ "$tag" != latest ] || params="$params image.pullPolicy=Always"
|
|
112
112
|
# egress proxy settings of .devzone.modules (#633): replayed at each start and update
|
|
113
|
-
params="$params $(
|
|
113
|
+
params="$params $("${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace egress params)"
|
|
114
114
|
chart_require workspace || return $?
|
|
115
115
|
# GitOps repository created or designated first, with its root Application
|
|
116
116
|
gitops_init || return 1
|
|
@@ -159,7 +159,7 @@ argocd_install() {
|
|
|
159
159
|
argocd_ensure() {
|
|
160
160
|
argocd_wanted || return 0
|
|
161
161
|
argocd_installed && return 0
|
|
162
|
-
if !
|
|
162
|
+
if ! "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" kube-ready >/dev/null; then
|
|
163
163
|
echo "⚠ Argo CD not checked: the cluster does not answer (devzone workspace services enable argocd once it does)" >&2
|
|
164
164
|
return 0
|
|
165
165
|
fi
|
package/manage/workspace.sh
CHANGED
|
@@ -53,7 +53,7 @@ default_image_tag() {
|
|
|
53
53
|
# Installs or upgrades the workspace in the cluster; the cluster is checked first (#565): no Argo CD, helm or pod wait for a stopped one.
|
|
54
54
|
start_workspace() {
|
|
55
55
|
local repo tag image with_image="" args=()
|
|
56
|
-
|
|
56
|
+
"${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" kube-ready --hint >&2 || return 1
|
|
57
57
|
repo="$IMAGE_REPO"
|
|
58
58
|
tag="$(default_image_tag)"
|
|
59
59
|
while [ $# -gt 0 ]; do
|
|
@@ -88,9 +88,9 @@ start_workspace() {
|
|
|
88
88
|
if [ -n "${DEVZONE_FROM_GO:-}" ] && argocd_active; then devzone workspace deploy "$repo" "$tag" "$with_image"; else workspace_deploy "$repo" "$tag" "$with_image"; fi
|
|
89
89
|
# Projects of .argocd.conf held too (#516)
|
|
90
90
|
argocd_reconcile || true
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
"${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace wait "$image" || return 1
|
|
92
|
+
"${DEVZONE_HOST_BIN:-false}" workspace agents-guard || true
|
|
93
|
+
"${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace ports start
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
# helm direct: the chart of the package, image set by the options
|
|
@@ -103,14 +103,14 @@ workspace_helm_deploy() {
|
|
|
103
103
|
# the old one with IfNotPresent (#515)
|
|
104
104
|
[ "$tag" != latest ] || args+=(--set "image.pullPolicy=Always")
|
|
105
105
|
# egress proxy settings (#633), replayed at each start: commas escaped for helm
|
|
106
|
-
for p in $(
|
|
106
|
+
for p in $("${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace egress params | sed 's/,/\\,/g'); do args+=(--set "$p"); done
|
|
107
107
|
# shellcheck disable=SC2046
|
|
108
108
|
helm $(helm_flag) upgrade --install devzone-workspace "$(chart_path)" "${args[@]}"
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
# Uninstalls the workspace from the cluster (Argo CD Application or helm release).
|
|
112
112
|
stop_workspace() {
|
|
113
|
-
|
|
113
|
+
"${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace ports stop || true
|
|
114
114
|
workspace_undeploy
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -120,37 +120,21 @@ shell_workspace() {
|
|
|
120
120
|
kubectl $(kubectl_flag) exec -it devzone-workspace-0 --namespace devzone-workspace -c workspace -- bash
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
# shellcheck source=manage/scripts/kube-ready.sh
|
|
124
|
-
. "$HERE/scripts/kube-ready.sh"
|
|
125
|
-
# shellcheck source=manage/scripts/workspace/workspace-wait.sh
|
|
126
|
-
. "$HERE/scripts/workspace/workspace-wait.sh"
|
|
127
|
-
# shellcheck source=manage/scripts/workspace/workspace-clone.sh
|
|
128
|
-
. "$HERE/scripts/workspace/workspace-clone.sh"
|
|
129
|
-
# shellcheck source=manage/scripts/workspace/workspace-copies.sh
|
|
130
|
-
. "$HERE/scripts/workspace/workspace-copies.sh"
|
|
131
|
-
# shellcheck source=manage/scripts/workspace/ports-workspace.sh
|
|
132
|
-
. "$HERE/scripts/workspace/ports-workspace.sh"
|
|
133
|
-
# shellcheck source=manage/scripts/workspace/services-workspace.sh
|
|
134
|
-
. "$HERE/scripts/workspace/services-workspace.sh"
|
|
135
123
|
# shellcheck source=manage/scripts/workspace/argocd-workspace.sh
|
|
136
124
|
. "$HERE/scripts/workspace/argocd-workspace.sh"
|
|
137
125
|
# shellcheck source=manage/scripts/workspace/argocd-services.sh
|
|
138
126
|
. "$HERE/scripts/workspace/argocd-services.sh"
|
|
139
|
-
# shellcheck source=manage/scripts/workspace/workspace-update.sh
|
|
140
|
-
. "$HERE/scripts/workspace/workspace-update.sh"
|
|
141
|
-
# shellcheck source=manage/scripts/workspace/workspace-egress.sh
|
|
142
|
-
. "$HERE/scripts/workspace/workspace-egress.sh"
|
|
143
127
|
|
|
144
128
|
case "${1:-}" in
|
|
145
129
|
start) start_workspace "${@:2}" ;;
|
|
146
|
-
update)
|
|
130
|
+
update) "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace update "${@:2}" ;;
|
|
147
131
|
stop) stop_workspace ;;
|
|
148
|
-
status)
|
|
132
|
+
status) "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace status ;;
|
|
149
133
|
shell) shell_workspace ;;
|
|
150
|
-
ports) ports "${@:2}" ;;
|
|
151
|
-
services) services "${@:2}" ;;
|
|
134
|
+
ports) "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace ports "${@:2}" ;;
|
|
135
|
+
services) "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace services "${@:2}" ;;
|
|
152
136
|
argocd) argocd_cmd "${@:2}" ;;
|
|
153
|
-
egress)
|
|
137
|
+
egress) "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" workspace egress "${@:2}" ;;
|
|
154
138
|
'' | -h | --help | help)
|
|
155
139
|
echo "devzone workspace start|stop|status|shell|ports|services|argocd|update|egress"
|
|
156
140
|
echo " start [--image repository:tag] install workspace (image for devzone version by default)"
|
package/package.json
CHANGED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# devzone, repair of the workstation.
|
|
4
|
-
# Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
|
|
5
|
-
# functions only, shared variables are defined in devzone.
|
|
6
|
-
|
|
7
|
-
# Lines "package pinned installed" of the outdated tools; fails if the versions.sh
|
|
8
|
-
# script is missing or cannot answer (the state then omits the line)
|
|
9
|
-
outdated_tools() {
|
|
10
|
-
[ -f "$VERSIONS" ] || return 1
|
|
11
|
-
bash "$VERSIONS" --installees 2>/dev/null
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
# Sets repowarden back to the pinned version if it differs (it installs the
|
|
15
|
-
# global git hooks)
|
|
16
|
-
apply_repowarden() {
|
|
17
|
-
local line pinned installed package=repowarden
|
|
18
|
-
[ -f "$VERSIONS" ] || return 0
|
|
19
|
-
line="$(bash "$VERSIONS" --installees 2>/dev/null | awk '$1 == "repowarden"' || true)"
|
|
20
|
-
[ -n "$line" ] || return 0
|
|
21
|
-
read -r _ pinned installed <<<"$line"
|
|
22
|
-
echo "devzone : installing repowarden ${pinned}…"
|
|
23
|
-
npm install -g "$package@$pinned" >/dev/null
|
|
24
|
-
repowarden install --global --lang fr
|
|
25
|
-
echo "devzone : repowarden $installed → $pinned"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
# Paths of the worktrees of the devzone repository and of the workspace
|
|
29
|
-
# repositories absent here: created on the other side (host), a git worktree
|
|
30
|
-
# prune would break them. Read-only: nothing is deleted or repaired.
|
|
31
|
-
missing_worktrees() {
|
|
32
|
-
local repo line path
|
|
33
|
-
{
|
|
34
|
-
[ -e "$RACINE/.git" ] && echo "$RACINE"
|
|
35
|
-
find "$RACINE/workspace" -mindepth 2 -maxdepth 3 -name .git -type d 2>/dev/null | sed 's|/\.git$||'
|
|
36
|
-
} | while IFS= read -r repo; do
|
|
37
|
-
{ git -C "$repo" worktree list --porcelain 2>/dev/null || true; } | while IFS= read -r line; do
|
|
38
|
-
case "$line" in
|
|
39
|
-
"worktree "*)
|
|
40
|
-
path="${line#worktree }"
|
|
41
|
-
[ -d "$path" ] || echo "$path"
|
|
42
|
-
;;
|
|
43
|
-
esac
|
|
44
|
-
done
|
|
45
|
-
done || true
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# Repair (#341): repairs the workstation: relays, watchers, credentials.
|
|
49
|
-
# Each item is really repaired; ✔ or ✖ with the reason.
|
|
50
|
-
repair_item() {
|
|
51
|
-
local name="$1" output code reason
|
|
52
|
-
shift
|
|
53
|
-
if output="$("$@" 2>&1)"; then
|
|
54
|
-
echo "✔ $name"
|
|
55
|
-
else
|
|
56
|
-
code=$?
|
|
57
|
-
reason="$(printf '%s\n' "$output" | sed '/^[[:space:]]*$/d' | tail -1)"
|
|
58
|
-
[ -n "$reason" ] || reason="failed (code $code)"
|
|
59
|
-
echo "✖ $name : $reason"
|
|
60
|
-
repair_failed=1
|
|
61
|
-
fi
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
# Application repairs (#341): active services, ports and credentials; a failure
|
|
65
|
-
# does not stop the following ones.
|
|
66
|
-
repair_workstation() {
|
|
67
|
-
repair_failed=0
|
|
68
|
-
if [ "$(value_of gitlab)" = on ]; then
|
|
69
|
-
repair_item "gitlab name" "$ICI/devzone" gitlab host-set
|
|
70
|
-
repair_item "gitlab relay" "$ICI/devzone" gitlab relay-start
|
|
71
|
-
fi
|
|
72
|
-
if [ "$(value_of postgres)" = on ]; then
|
|
73
|
-
repair_item "postgres relay" "$ICI/devzone" postgres relay-start
|
|
74
|
-
fi
|
|
75
|
-
if [ "$(value_of argocd)" = on ]; then
|
|
76
|
-
repair_item "argocd relay" "$ICI/devzone" argocd relay-start
|
|
77
|
-
fi
|
|
78
|
-
if [ "$(value_of mysql)" = on ]; then
|
|
79
|
-
repair_item "mysql relay" "$ICI/devzone" mysql relay-start
|
|
80
|
-
fi
|
|
81
|
-
repair_item "catalog watcher" env DEVZONE_STATE="$ETAT" DEVZONE_CATALOG_REAL=yes "$ICI/devzone" catalog-watcher start
|
|
82
|
-
repair_item "credentials" "$ICI/devzone" passwords regenerate
|
|
83
|
-
"$ICI/devzone" cluster clean || true
|
|
84
|
-
return "$repair_failed"
|
|
85
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# devzone, version of the folder and of the published release.
|
|
4
|
-
# Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
|
|
5
|
-
# functions only, shared variables are defined in devzone.
|
|
6
|
-
|
|
7
|
-
# Version of the devzone folder (manifest written by the workstation CLI),
|
|
8
|
-
# nothing if the folder predates the manifest
|
|
9
|
-
folder_version() {
|
|
10
|
-
local v
|
|
11
|
-
[ -f "$RACINE/.devzone.version" ] || return 1
|
|
12
|
-
v="$(sed -n '1s/^version //p' "$RACINE/.devzone.version" 2>/dev/null | head -1 || true)"
|
|
13
|
-
[ -n "$v" ] || return 1
|
|
14
|
-
printf '%s\n' "$v"
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
# True if the first version is newer than the second
|
|
18
|
-
version_is_newer() {
|
|
19
|
-
awk -v a="$1" -v b="$2" 'BEGIN {
|
|
20
|
-
na = split(a, x, ".")
|
|
21
|
-
nb = split(b, y, ".")
|
|
22
|
-
n = (na > nb ? na : nb)
|
|
23
|
-
for (i = 1; i <= n; i++) {
|
|
24
|
-
p = (i <= na ? x[i] : 0) + 0
|
|
25
|
-
q = (i <= nb ? y[i] : 0) + 0
|
|
26
|
-
if (p > q) exit 0
|
|
27
|
-
if (p < q) exit 1
|
|
28
|
-
}
|
|
29
|
-
exit 1
|
|
30
|
-
}'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# Version published on npm, at most once a day, cached under
|
|
34
|
-
# ~/.cache/devzone/; 5 s at most, silent offline
|
|
35
|
-
published_version() {
|
|
36
|
-
local cache day npm v tmp pid waited
|
|
37
|
-
cache="$HOME/.cache/devzone/version-publiee"
|
|
38
|
-
day="$(date +%Y-%m-%d)"
|
|
39
|
-
if [ -f "$cache" ] && [ "$(sed -n '1p' "$cache" 2>/dev/null || true)" = "$day" ]; then
|
|
40
|
-
sed -n '2p' "$cache" 2>/dev/null || true
|
|
41
|
-
return 0
|
|
42
|
-
fi
|
|
43
|
-
npm="${DEVZONE_NPM:-npm}"
|
|
44
|
-
v=""
|
|
45
|
-
if command -v "$npm" >/dev/null 2>&1; then
|
|
46
|
-
mkdir -p "$(dirname "$cache")" 2>/dev/null || true
|
|
47
|
-
tmp="$cache.$$"
|
|
48
|
-
"$npm" view devzone version >"$tmp" 2>/dev/null &
|
|
49
|
-
pid=$!
|
|
50
|
-
waited=0
|
|
51
|
-
while kill -0 "$pid" 2>/dev/null; do
|
|
52
|
-
sleep 1
|
|
53
|
-
waited=$((waited + 1))
|
|
54
|
-
if [ "$waited" -ge 5 ]; then
|
|
55
|
-
kill "$pid" 2>/dev/null || true
|
|
56
|
-
break
|
|
57
|
-
fi
|
|
58
|
-
done
|
|
59
|
-
wait "$pid" 2>/dev/null || true
|
|
60
|
-
v="$(sed -n '1p' "$tmp" 2>/dev/null | tr -d '[:space:]' || true)"
|
|
61
|
-
rm -f "$tmp"
|
|
62
|
-
fi
|
|
63
|
-
mkdir -p "$(dirname "$cache")" 2>/dev/null || true
|
|
64
|
-
printf '%s\n%s\n' "$day" "$v" >"$cache" 2>/dev/null || true
|
|
65
|
-
[ -n "$v" ] && printf '%s\n' "$v"
|
|
66
|
-
return 0
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
version_available_line() {
|
|
70
|
-
local folder published
|
|
71
|
-
folder="$(folder_version)" || return 0
|
|
72
|
-
published="$(published_version)" || return 0
|
|
73
|
-
published="${published#v}"
|
|
74
|
-
[ -n "$published" ] || return 0
|
|
75
|
-
if version_is_newer "$published" "$folder"; then
|
|
76
|
-
printf ' ○ devzone %s available: on the workstation, devzone update\n' "$published"
|
|
77
|
-
fi
|
|
78
|
-
}
|
package/.devcontainer/help.sh
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Help of devzone (devzone --help, #557), sourced by devzone : English command
|
|
3
|
-
# names only ; the French names are refused and print the new name (#695).
|
|
4
|
-
# devzone_aide prints the list, indented like the other usage texts.
|
|
5
|
-
devzone_aide() {
|
|
6
|
-
cat <<'AIDE'
|
|
7
|
-
Optional modules of devzone, enabled on demand, without rebuild:
|
|
8
|
-
devzone state of the modules
|
|
9
|
-
devzone --version version of the workspace image (DEVZONE_VERSION)
|
|
10
|
-
devzone platform GitHub (default) or GitLab
|
|
11
|
-
devzone platform github back to GitHub: glab and config removed
|
|
12
|
-
devzone platform gitlab GitLab, [--url URL] (default: gitlab module)
|
|
13
|
-
devzone enable <module> enable and apply at once
|
|
14
|
-
devzone disable <module> [--yes] disable and apply at once (--yes: also deletes the data)
|
|
15
|
-
devzone apply install what is enabled
|
|
16
|
-
devzone repair repair gitlab, postgres, ports, passwords
|
|
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)
|
|
19
|
-
devzone use CTX [--confirm CTX] switch the kubectl working cluster
|
|
20
|
-
devzone clusters view of the connected clusters (work and services)
|
|
21
|
-
devzone kube saved|choose|save|local|reachable|prompt cluster helpers, in Go
|
|
22
|
-
devzone is-enabled <module> code 0 if enabled
|
|
23
|
-
devzone test-bash32 run the bats tests under bash 3.2 (Docker container)
|
|
24
|
-
devzone test-gitlab end-to-end test of the GitLab module and platform
|
|
25
|
-
devzone agent <folder> <instructions> drive opencode with the instructions file
|
|
26
|
-
devzone ai list the host (Ollama) models detected and the default model
|
|
27
|
-
devzone ai check|rapport update state of each model | sizes, choices and reasons
|
|
28
|
-
devzone ai guard [--format claude] check one tool call on standard input (agent guard)
|
|
29
|
-
devzone ticket <n> [--repo devzone|repowarden] ticket worktree (ticket done <n> removes it)
|
|
30
|
-
devzone build <folder> [--tag <name>] build an image in the Kubernetes workspace (BuildKit)
|
|
31
|
-
devzone enable postgres [--context CTX] [--confirm CTX] shared PostgreSQL, cluster of choice
|
|
32
|
-
devzone postgres create <project> database and user of a project (also: list, psql, delete)
|
|
33
|
-
devzone mysql create <project> database and user of a MySQL project (also: list, delete)
|
|
34
|
-
devzone enable llm [--preset light] local code model (llama.cpp), devzone llm status
|
|
35
|
-
devzone llm status | delete-data [--yes] model and reachability | namespace and model removed
|
|
36
|
-
devzone gitlab migrate [--yes] GitLab in the services cluster, then the old kind cluster deleted
|
|
37
|
-
devzone gitlab new-password [root|dev] random password (root or dev) regenerated
|
|
38
|
-
devzone enable argocd Argo CD in the services cluster, access https://127.0.0.1:8443
|
|
39
|
-
devzone argocd status|relay-start|relay-stop Argo CD (argocd module)
|
|
40
|
-
devzone argocd app add <repo url> [path]|list|remove <N> projects deployed by Argo CD (#516)
|
|
41
|
-
devzone cluster [CTX] [--yes] [--confirm CTX] services cluster of devzone, or change it
|
|
42
|
-
devzone port [--close <n>] list or remove a relay of the workstation
|
|
43
|
-
devzone passwords regenerate .password and print its path
|
|
44
|
-
devzone packages [add|remove|apply] … system packages kept after a rebuild
|
|
45
|
-
AIDE
|
|
46
|
-
}
|