devzone 1.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/Dockerfile +4 -4
- package/.devcontainer/{agent-erreurs.sh → agent-errors.sh} +6 -6
- package/.devcontainer/agent-local.sh +2 -2
- package/.devcontainer/{agent-modele.messages → agent-model.messages} +1 -1
- package/.devcontainer/{agent-modele.sh → agent-model.sh} +5 -5
- package/.devcontainer/agent-pod-manifest.sh +4 -4
- package/.devcontainer/{agent-droits.sh → agent-rights.sh} +2 -2
- package/.devcontainer/agent-session.sh +3 -3
- package/.devcontainer/{agent-etat-json.sh → agent-state-json.sh} +6 -6
- package/.devcontainer/agent-workspace.sh +1 -1
- package/.devcontainer/agent.sh +14 -14
- package/.devcontainer/{ia/docker-garde.sh → ai/docker-guard.sh} +1 -1
- package/.devcontainer/{ia → ai}/host-models.sh +2 -2
- package/.devcontainer/{ia/plugins/devzone-garde-v2.js → ai/plugins/devzone-guard-v2.js} +7 -7
- package/.devcontainer/{ia/plugins/devzone-garde.js → ai/plugins/devzone-guard.js} +6 -6
- package/.devcontainer/argocd/argocd.sh +94 -93
- package/.devcontainer/argocd/{catalogue-argocd.sh → catalog-argocd.sh} +3 -3
- package/.devcontainer/argocd/services-hook.sh +8 -8
- package/.devcontainer/argocd/services.sh +1 -1
- package/.devcontainer/catalog/app.sh +209 -0
- package/.devcontainer/catalog/catalog-watcher.sh +130 -0
- package/.devcontainer/{catalogue → catalog}/mysql/app.conf +1 -1
- package/.devcontainer/catalog/mysql/install.sh +87 -0
- package/.devcontainer/catalog/mysql/mysql.sh +262 -0
- package/.devcontainer/catalog/mysql/volume.sh +71 -0
- package/.devcontainer/catalog.sh +231 -0
- package/.devcontainer/chart-direct.sh +1 -1
- package/.devcontainer/cluster.sh +222 -224
- package/.devcontainer/clusters.sh +41 -41
- package/.devcontainer/devcontainer.json +1 -1
- package/.devcontainer/devzone +103 -1506
- package/.devcontainer/devzone-ai-guard.sh +76 -0
- package/.devcontainer/devzone-ai.sh +201 -0
- package/.devcontainer/devzone-cluster.sh +210 -0
- package/.devcontainer/devzone-modules.sh +126 -0
- package/.devcontainer/devzone-platform.sh +189 -0
- package/.devcontainer/devzone-repair.sh +94 -0
- package/.devcontainer/devzone-services.sh +241 -0
- package/.devcontainer/devzone-skill.sh +97 -0
- package/.devcontainer/devzone-status.sh +140 -0
- package/.devcontainer/devzone-version.sh +78 -0
- package/.devcontainer/git-identity.sh +28 -0
- package/.devcontainer/gitlab/argocd.sh +2 -2
- package/.devcontainer/gitlab/chart.sh +2 -2
- package/.devcontainer/gitlab/gitlab.sh +83 -84
- package/.devcontainer/gitlab/installation.sh +111 -111
- package/.devcontainer/gitlab/secrets.sh +47 -47
- package/.devcontainer/gitlab/seed.sh +77 -77
- package/.devcontainer/gitlab/test-gitlab.sh +242 -243
- package/.devcontainer/help.sh +1 -1
- package/.devcontainer/isolation.sh +65 -0
- package/.devcontainer/kind-wrapper.sh +45 -0
- package/.devcontainer/kube-account.sh +199 -0
- package/.devcontainer/kube-config.sh +45 -46
- package/.devcontainer/{invite-kube.sh → kube-prompt.sh} +6 -6
- package/.devcontainer/kube-reachable.sh +64 -0
- package/.devcontainer/{memoire.sh → memory.sh} +1 -1
- package/.devcontainer/metrics-server.sh +2 -2
- package/.devcontainer/opencode.jsonc +2 -2
- package/.devcontainer/packages.sh +228 -0
- package/.devcontainer/password.sh +1 -1
- package/.devcontainer/ports-auto.sh +152 -153
- package/.devcontainer/ports-json.sh +16 -15
- package/.devcontainer/ports.sh +127 -123
- package/.devcontainer/post-create.sh +52 -52
- package/.devcontainer/postgres/postgres.sh +176 -176
- package/.devcontainer/rename-legacy-files.sh +103 -0
- package/.devcontainer/services-admin.sh +5 -5
- package/.devcontainer/skills/devzone/SKILL.md +40 -41
- package/.devcontainer/startup.sh +65 -0
- package/.devcontainer/{etat-gitops.sh → state-gitops.sh} +1 -1
- package/.devcontainer/{etat-json.sh → state-json.sh} +39 -65
- package/.devcontainer/{etat-verrou.sh → state-lock.sh} +1 -1
- package/.devcontainer/{etat.sh → state.sh} +4 -4
- package/.devcontainer/workspace-init.sh +17 -3
- package/Makefile +8 -8
- package/README.md +195 -194
- package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
- package/manage/devzone +8 -10
- package/manage/scripts/argocd-workspace.sh +1 -1
- package/manage/scripts/check-go-layout.sh +40 -0
- package/manage/scripts/check-names.sh +61 -0
- package/manage/scripts/create-cluster.sh +1 -1
- package/manage/scripts/create-mode.sh +2 -2
- package/manage/scripts/devzone-create.sh +5 -5
- package/manage/scripts/devzone-manifest.sh +3 -3
- package/manage/scripts/devzone-update.sh +12 -8
- package/manage/scripts/docker-workstation.sh +2 -2
- package/manage/scripts/docker.sh +2 -2
- package/manage/scripts/{lancer.sh → launch.sh} +10 -51
- package/manage/scripts/{migrer-retour.sh → migrate-revert.sh} +4 -4
- package/manage/scripts/{migrer.sh → migrate.sh} +8 -14
- package/manage/scripts/ports-apps.sh +1 -1
- package/manage/scripts/ports-workspace.sh +7 -7
- package/manage/scripts/{desinstaller.sh → uninstall.sh} +8 -8
- package/manage/scripts/workspace-egress.sh +2 -2
- package/manage/scripts/workspace-update.sh +5 -2
- package/manage/scripts/workspace-wait.sh +2 -2
- package/manage/workspace.sh +4 -4
- package/package.json +1 -1
- package/.devcontainer/catalogue/app.sh +0 -211
- package/.devcontainer/catalogue/catalogue-veilleur.sh +0 -130
- package/.devcontainer/catalogue/mysql/installer.sh +0 -87
- package/.devcontainer/catalogue/mysql/mysql.sh +0 -262
- package/.devcontainer/catalogue/mysql/volume.sh +0 -71
- package/.devcontainer/catalogue.sh +0 -231
- package/.devcontainer/demarrage.sh +0 -66
- package/.devcontainer/docker-relais.sh +0 -149
- package/.devcontainer/docker-sans-hote.sh +0 -12
- package/.devcontainer/git-identite.sh +0 -28
- package/.devcontainer/isolement.sh +0 -65
- package/.devcontainer/kind-enveloppe.sh +0 -45
- package/.devcontainer/kube-compte.sh +0 -200
- package/.devcontainer/kube-joignable.sh +0 -64
- package/.devcontainer/paquets.sh +0 -227
- /package/.devcontainer/{ia/docker-garde.message → ai/docker-guard.message} +0 -0
- /package/.devcontainer/{ia → ai}/host-check.message +0 -0
- /package/.devcontainer/{ia → ai}/host-check.sh +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# System packages kept after a rebuild (#351): a list in the devzone folder
|
|
3
|
+
# (<root>/.devzone.packages, a comment header + one package name per line, sorted,
|
|
4
|
+
# without duplicates), reinstalled at each container creation (post-create.sh).
|
|
5
|
+
# A package installed by hand is lost by a rebuild, unless it is in this list.
|
|
6
|
+
# packages.sh or packages.sh list list with the state of each package
|
|
7
|
+
# packages.sh add <name>… validates, installs, adds to the list
|
|
8
|
+
# packages.sh remove <name>… removes from the list and uninstalls (except image packages)
|
|
9
|
+
# packages.sh apply installs everything missing (post-create.sh)
|
|
10
|
+
# The state of a package comes from dpkg-query -W -f='${Status}'; the system
|
|
11
|
+
# commands go through overridable variables for the tests (sudo, apt-get,
|
|
12
|
+
# apt-cache, dpkg-query, mark, timestamp). Compatible with bash 3.2 (macOS).
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
|
|
15
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
16
|
+
ROOT="${DEVZONE_ROOT:-$(dirname "$HERE")}"
|
|
17
|
+
LIST="${ROOT}/.devzone.packages"
|
|
18
|
+
MARK="${DEVZONE_PACKAGES_MARKER:-/tmp/devzone-packages.failed}"
|
|
19
|
+
UPDATED="${DEVZONE_PACKAGES_UPDATE:-/tmp/devzone-paquets.maj}"
|
|
20
|
+
SUDO="${DEVZONE_PACKAGES_SUDO-sudo}"
|
|
21
|
+
APT="${DEVZONE_PACKAGES_APT:-apt-get}"
|
|
22
|
+
APTCACHE="${DEVZONE_PACKAGES_APTCACHE:-apt-cache}"
|
|
23
|
+
DPKGQUERY="${DEVZONE_PACKAGES_DPKG_QUERY:-dpkg-query}"
|
|
24
|
+
FORMAT="-f=\${Status}"
|
|
25
|
+
# Stored values, kept byte for byte (the users' list file): the header and the
|
|
26
|
+
# « already present » mark are written in UTF-8 as byte escapes (contract).
|
|
27
|
+
HEADER=$'# paquets ajout\303\251s par devzone packages add ; r\303\251install\303\251s \303\240 chaque cr\303\251ation du conteneur'
|
|
28
|
+
PRESENT_MARK=$'# d\303\251j\303\240 pr\303\251sent'
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
refuse() { echo "devzone : packages : $*" >&2; exit 1; }
|
|
32
|
+
|
|
33
|
+
as_root() {
|
|
34
|
+
if [ -n "$SUDO" ]; then
|
|
35
|
+
"$SUDO" "$@"
|
|
36
|
+
else
|
|
37
|
+
env "$@"
|
|
38
|
+
fi
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
is_installed() {
|
|
42
|
+
"$DPKGQUERY" -W "$FORMAT" "$1" 2>/dev/null | grep -q 'install ok installed'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# List lines as they are (name, or name followed by the present mark).
|
|
46
|
+
list_lines() {
|
|
47
|
+
[ -f "$LIST" ] || return 0
|
|
48
|
+
grep -vE '^[[:space:]]*(#|$)' "$LIST" 2>/dev/null |
|
|
49
|
+
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e '/^$/d' |
|
|
50
|
+
sort -k1,1 -u || true
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Names only: the end-of-line mark is ignored.
|
|
54
|
+
list_names() {
|
|
55
|
+
list_lines | sed -e 's/[[:space:]]*#.*$//' | sort -u || true
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
name_listed() {
|
|
59
|
+
local name
|
|
60
|
+
while IFS= read -r name; do
|
|
61
|
+
[ "$name" = "$1" ] && return 0
|
|
62
|
+
done < <(list_names)
|
|
63
|
+
return 1
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# True if the package was marked as already present in the image.
|
|
67
|
+
mark_present() {
|
|
68
|
+
grep -qxF -e "$1 $PRESENT_MARK" "$LIST" 2>/dev/null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Rewrites the list: a single header, then the given lines (sorted by name).
|
|
72
|
+
write_list() {
|
|
73
|
+
local tmp
|
|
74
|
+
tmp="$(mktemp)"
|
|
75
|
+
{
|
|
76
|
+
echo "$HEADER"
|
|
77
|
+
[ "$#" -eq 0 ] || printf '%s\n' "$@" | sort -k1,1 -u
|
|
78
|
+
} >"$tmp"
|
|
79
|
+
mv "$tmp" "$LIST"
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
update_index() {
|
|
83
|
+
local last
|
|
84
|
+
last="$(cat "$UPDATED" 2>/dev/null || true)"
|
|
85
|
+
if [ -n "$last" ] && [ $(( $(date +%s) - last )) -lt 3600 ]; then
|
|
86
|
+
return 0
|
|
87
|
+
fi
|
|
88
|
+
as_root "$APT" update || return 1
|
|
89
|
+
date +%s >"$UPDATED"
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
list_packages() {
|
|
93
|
+
local packages package
|
|
94
|
+
packages="$(list_names)"
|
|
95
|
+
if [ -z "$packages" ]; then
|
|
96
|
+
echo "no package (devzone packages add <name>)"
|
|
97
|
+
return 0
|
|
98
|
+
fi
|
|
99
|
+
while IFS= read -r package; do
|
|
100
|
+
[ -n "$package" ] || continue
|
|
101
|
+
if is_installed "$package"; then
|
|
102
|
+
echo " ✔ $package"
|
|
103
|
+
else
|
|
104
|
+
echo " ○ $package"
|
|
105
|
+
fi
|
|
106
|
+
done < <(printf '%s\n' "$packages")
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
add_packages() {
|
|
110
|
+
local -a a=()
|
|
111
|
+
local -a entries=()
|
|
112
|
+
local arg name line already=""
|
|
113
|
+
for arg in "$@"; do
|
|
114
|
+
case "$arg" in
|
|
115
|
+
-*) refuse "unknown argument: $arg (devzone packages add <name>…)" ;;
|
|
116
|
+
*) a+=("$arg") ;;
|
|
117
|
+
esac
|
|
118
|
+
done
|
|
119
|
+
[ "${#a[@]}" -gt 0 ] || refuse "add expects at least one name: devzone packages add <name>…"
|
|
120
|
+
update_index || echo "apt index not updated" >&2
|
|
121
|
+
for name in "${a[@]}"; do
|
|
122
|
+
if ! "$APTCACHE" show "$name" >/dev/null 2>&1; then
|
|
123
|
+
refuse "unknown package: $name (list unchanged)"
|
|
124
|
+
fi
|
|
125
|
+
done
|
|
126
|
+
# What is already installed before the installation comes from the image: marked
|
|
127
|
+
for name in "${a[@]}"; do
|
|
128
|
+
if is_installed "$name"; then
|
|
129
|
+
already="$already $name"
|
|
130
|
+
fi
|
|
131
|
+
done
|
|
132
|
+
if as_root DEBIAN_FRONTEND=noninteractive "$APT" install -y --no-install-recommends "${a[@]}"; then
|
|
133
|
+
while IFS= read -r line; do
|
|
134
|
+
entries+=("$line")
|
|
135
|
+
done < <(list_lines)
|
|
136
|
+
for name in "${a[@]}"; do
|
|
137
|
+
if name_listed "$name"; then
|
|
138
|
+
continue
|
|
139
|
+
fi
|
|
140
|
+
case " $already " in
|
|
141
|
+
*" $name "*)
|
|
142
|
+
entries+=("$name $PRESENT_MARK")
|
|
143
|
+
echo "$name : already present before devzone packages (marked ; removing will leave it installed)"
|
|
144
|
+
;;
|
|
145
|
+
*) entries+=("$name") ;;
|
|
146
|
+
esac
|
|
147
|
+
done
|
|
148
|
+
write_list "${entries[@]}"
|
|
149
|
+
else
|
|
150
|
+
refuse "installation failed: ${a[*]} (list unchanged)"
|
|
151
|
+
fi
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
remove_packages() {
|
|
155
|
+
local -a a=()
|
|
156
|
+
local -a removals=()
|
|
157
|
+
local -a remaining=()
|
|
158
|
+
local arg name line name_line
|
|
159
|
+
for arg in "$@"; do
|
|
160
|
+
case "$arg" in
|
|
161
|
+
-*) refuse "unknown argument: $arg (devzone packages remove <name>…)" ;;
|
|
162
|
+
*) a+=("$arg") ;;
|
|
163
|
+
esac
|
|
164
|
+
done
|
|
165
|
+
[ "${#a[@]}" -gt 0 ] || refuse "remove expects at least one name: devzone packages remove <name>…"
|
|
166
|
+
for name in "${a[@]}"; do
|
|
167
|
+
name_listed "$name" ||
|
|
168
|
+
refuse "package not listed: $name (provided by the image?) : devzone packages remove does not add image packages"
|
|
169
|
+
if ! mark_present "$name"; then
|
|
170
|
+
removals+=("$name")
|
|
171
|
+
fi
|
|
172
|
+
done
|
|
173
|
+
if [ "${#removals[@]}" -gt 0 ] && ! as_root "$APT" remove -y "${removals[@]}"; then
|
|
174
|
+
refuse "removal failed: ${removals[*]} (list unchanged)"
|
|
175
|
+
fi
|
|
176
|
+
for name in "${a[@]}"; do
|
|
177
|
+
if mark_present "$name"; then
|
|
178
|
+
echo "$name : removed from the list, left installed (present before devzone packages)"
|
|
179
|
+
fi
|
|
180
|
+
done
|
|
181
|
+
while IFS= read -r line; do
|
|
182
|
+
name_line="${line%% *}"
|
|
183
|
+
case " ${a[*]} " in
|
|
184
|
+
*" $name_line "*) ;;
|
|
185
|
+
*) remaining+=("$line") ;;
|
|
186
|
+
esac
|
|
187
|
+
done < <(list_lines)
|
|
188
|
+
write_list "${remaining[@]+"${remaining[@]}"}"
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
apply_packages() {
|
|
192
|
+
local package
|
|
193
|
+
local -a missing=()
|
|
194
|
+
while IFS= read -r package; do
|
|
195
|
+
[ -n "$package" ] || continue
|
|
196
|
+
if ! is_installed "$package"; then
|
|
197
|
+
missing+=("$package")
|
|
198
|
+
fi
|
|
199
|
+
done < <(printf '%s\n' "$(list_names)")
|
|
200
|
+
if [ "${#missing[@]}" -eq 0 ]; then
|
|
201
|
+
rm -f "$MARK"
|
|
202
|
+
return 0
|
|
203
|
+
fi
|
|
204
|
+
update_index || echo "apt index not updated" >&2
|
|
205
|
+
for package in "${missing[@]}"; do
|
|
206
|
+
as_root DEBIAN_FRONTEND=noninteractive "$APT" install -y --no-install-recommends "$package" || true
|
|
207
|
+
done
|
|
208
|
+
local -a still_missing=()
|
|
209
|
+
for package in "${missing[@]}"; do
|
|
210
|
+
if ! is_installed "$package"; then
|
|
211
|
+
still_missing+=("$package")
|
|
212
|
+
fi
|
|
213
|
+
done
|
|
214
|
+
if [ "${#still_missing[@]}" -gt 0 ]; then
|
|
215
|
+
printf '%s\n' "${still_missing[@]}" >"$MARK"
|
|
216
|
+
return 1
|
|
217
|
+
fi
|
|
218
|
+
rm -f "$MARK"
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
case "${1:-}" in
|
|
222
|
+
'' | list) list_packages ;;
|
|
223
|
+
add) add_packages "${@:2}" ;;
|
|
224
|
+
remove) remove_packages "${@:2}" ;;
|
|
225
|
+
apply) apply_packages ;;
|
|
226
|
+
-h | --help | aide) awk 'NR==1{next} /^#$/{exit} /^#/{sub(/^# ?/,""); print; next} {exit}' "${BASH_SOURCE[0]}" ;;
|
|
227
|
+
*) refuse "unknown command: ${1:-(none)} (devzone packages --help)" ;;
|
|
228
|
+
esac
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
set -euo pipefail
|
|
9
9
|
|
|
10
10
|
PASSWORD_HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
-
PASSWORD_ROOT="${
|
|
11
|
+
PASSWORD_ROOT="${DEVZONE_ROOT:-$(dirname "$PASSWORD_HERE")}"
|
|
12
12
|
PASSWORD_TARGET="$PASSWORD_ROOT/.password"
|
|
13
13
|
|
|
14
14
|
# Regenerates $ROOT/.password from workspace/.gitlab, workspace/.postgres,
|