devzone 0.37.0 → 0.38.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/.dockerignore +1 -1
- package/.devcontainer/argocd/argocd.sh +6 -7
- package/.devcontainer/argocd/catalogue-argocd.sh +114 -0
- package/.devcontainer/argocd/services.sh +138 -0
- package/.devcontainer/catalogue/app.sh +58 -17
- package/.devcontainer/catalogue/mysql/installer.sh +31 -0
- package/.devcontainer/catalogue/mysql/mysql.sh +12 -0
- package/.devcontainer/devzone +1 -1
- package/.devcontainer/password.sh +8 -0
- package/README.md +1 -1
- package/charts/devzone-argocd/Chart.lock +6 -0
- package/charts/devzone-argocd/Chart.yaml +13 -0
- package/charts/devzone-argocd/values.yaml +28 -0
- package/charts/devzone-mysql/Chart.yaml +6 -0
- package/charts/devzone-mysql/templates/service.yaml +15 -0
- package/charts/devzone-mysql/templates/statefulset.yaml +55 -0
- package/charts/devzone-mysql/values.yaml +19 -0
- package/manage/devzone +2 -1
- package/manage/scripts/argocd-services-svc.sh +110 -0
- package/manage/scripts/argocd-services.sh +21 -85
- package/manage/scripts/argocd-workspace.sh +8 -6
- package/manage/scripts/ci-dns.sh +10 -10
- package/manage/scripts/desinstaller.sh +137 -135
- package/manage/scripts/docker.sh +26 -22
- package/manage/scripts/lancer.sh +103 -103
- package/manage/scripts/migrer-retour.sh +37 -34
- package/manage/scripts/migrer.sh +154 -138
- package/manage/scripts/ports-workspace.sh +87 -82
- package/manage/scripts/poste.sh +48 -49
- package/manage/scripts/services-workspace.sh +15 -10
- package/manage/scripts/versions.sh +88 -88
- package/manage/scripts/workspace-aliases.sh +47 -0
- package/manage/scripts/workspace-wait.sh +26 -23
- package/manage/workspace.sh +124 -111
- package/package.json +1 -1
- package/.devcontainer/argocd/values.yaml +0 -25
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# assistants
|
|
4
|
-
#
|
|
2
|
+
# Pinned container versions: compares repowarden (versions.env) and AI
|
|
3
|
+
# assistants (IA_… lines, devzone) to the latest npm version, or applies an
|
|
4
|
+
# upgrade.
|
|
5
5
|
# bash manage/scripts/versions.sh
|
|
6
|
-
#
|
|
7
|
-
# bash manage/scripts/versions.sh --
|
|
8
|
-
#
|
|
9
|
-
# bash manage/scripts/versions.sh --
|
|
10
|
-
#
|
|
11
|
-
# bash manage/scripts/versions.sh --ticket
|
|
12
|
-
#
|
|
13
|
-
# Compatible bash 3.2 (macOS).
|
|
6
|
+
# one "package old new" line per outdated package, nothing otherwise
|
|
7
|
+
# bash manage/scripts/versions.sh --installed
|
|
8
|
+
# one "package pinned installed" line per installed tool behind its pin
|
|
9
|
+
# bash manage/scripts/versions.sh --apply <package> <version>
|
|
10
|
+
# replaces that pinned version in its file, nothing else
|
|
11
|
+
# bash manage/scripts/versions.sh --existing-ticket <package> <author>
|
|
12
|
+
# "number<TAB>title" of the open ticket by <author>, nothing otherwise
|
|
13
|
+
# Compatible with bash 3.2 (macOS).
|
|
14
14
|
set -euo pipefail
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
VERSIONS_ENV="$
|
|
18
|
-
DEVZONE="$
|
|
16
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
17
|
+
VERSIONS_ENV="$HERE/.devcontainer/versions.env"
|
|
18
|
+
DEVZONE="$HERE/.devcontainer/devzone"
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
local
|
|
20
|
+
# List "package version" of pinned versions in both files; in devzone, one
|
|
21
|
+
# IA_<NAME>=<package>@<version> line per AI assistant
|
|
22
|
+
pinned() {
|
|
23
|
+
local item
|
|
24
24
|
if [ -f "$VERSIONS_ENV" ]; then
|
|
25
25
|
# shellcheck disable=SC1090
|
|
26
26
|
. "$VERSIONS_ENV"
|
|
27
27
|
[ -z "${REPOWARDEN_VERSION:-}" ] || echo "repowarden $REPOWARDEN_VERSION"
|
|
28
28
|
fi
|
|
29
|
-
while read -r
|
|
30
|
-
case "$
|
|
31
|
-
?*@*) echo "${
|
|
29
|
+
while read -r item; do
|
|
30
|
+
case "$item" in
|
|
31
|
+
?*@*) echo "${item%@*} ${item##*@}" ;;
|
|
32
32
|
esac
|
|
33
33
|
done < <(sed -nE 's/^IA_[A-Z0-9_]+=([^[:space:]()"]+)$/\1/p' "$DEVZONE")
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
#
|
|
37
|
-
|
|
36
|
+
# True if version $1 is newer than $2 (numeric components)
|
|
37
|
+
newer() {
|
|
38
38
|
local i x y
|
|
39
39
|
local IFS=.
|
|
40
40
|
local a b
|
|
@@ -53,117 +53,117 @@ plus_recente() {
|
|
|
53
53
|
return 1
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
#
|
|
57
|
-
|
|
56
|
+
# Latest version published on npm (empty if npm does not respond)
|
|
57
|
+
latest() {
|
|
58
58
|
npm view "$1" version 2>/dev/null | tail -1 | tr -d '[:space:]'
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
local
|
|
64
|
-
while read -r
|
|
65
|
-
[ -n "$
|
|
66
|
-
|
|
67
|
-
if [ -z "$
|
|
68
|
-
echo "versions
|
|
61
|
+
# One line per outdated package, nothing if everything is up to date
|
|
62
|
+
list_outdated() {
|
|
63
|
+
local package old new
|
|
64
|
+
while read -r package old; do
|
|
65
|
+
[ -n "$package" ] || continue
|
|
66
|
+
new="$(latest "$package")"
|
|
67
|
+
if [ -z "$new" ]; then
|
|
68
|
+
echo "versions: cannot read npm version for $package" >&2
|
|
69
69
|
exit 1
|
|
70
70
|
fi
|
|
71
|
-
if
|
|
72
|
-
echo "$
|
|
71
|
+
if newer "$new" "$old"; then
|
|
72
|
+
echo "$package $old $new"
|
|
73
73
|
fi
|
|
74
|
-
done < <(
|
|
74
|
+
done < <(pinned)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
|
|
77
|
+
# Globally installed versions (package version), read once;
|
|
78
|
+
# fails if npm or jq does not respond (state then omits the line)
|
|
79
|
+
installed_packages() {
|
|
80
80
|
local json
|
|
81
81
|
json="$(npm ls -g --depth=0 --json 2>/dev/null || true)"
|
|
82
82
|
[ -n "$json" ] || return 1
|
|
83
83
|
printf '%s\n' "$json" | jq -r '.dependencies // {} | to_entries[] | "\(.key) \(.value.version)"'
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
local
|
|
90
|
-
|
|
91
|
-
while read -r
|
|
92
|
-
[ -n "$
|
|
93
|
-
|
|
94
|
-
[ -n "$
|
|
95
|
-
[ "$
|
|
96
|
-
done < <(
|
|
86
|
+
# One "package pinned installed" line per installed tool whose version differs
|
|
87
|
+
# from the pinned version; a tool not installed is not listed
|
|
88
|
+
compare_installed() {
|
|
89
|
+
local package pin installed list
|
|
90
|
+
list="$(installed_packages)"
|
|
91
|
+
while read -r package pin; do
|
|
92
|
+
[ -n "$package" ] || continue
|
|
93
|
+
installed="$(printf '%s\n' "$list" | awk -v p="$package" '$1 == p { print $2; exit }')"
|
|
94
|
+
[ -n "$installed" ] || continue
|
|
95
|
+
[ "$installed" = "$pin" ] || echo "$package $pin $installed"
|
|
96
|
+
done < <(pinned)
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
-
local
|
|
99
|
+
# Prints "number<TAB>title" of the open ticket by $2 whose title starts with
|
|
100
|
+
# "$1", nothing otherwise: a ticket with the same title opened by someone else is ignored.
|
|
101
|
+
existing_ticket() {
|
|
102
|
+
local package="$1" author="$2" tickets number title ticket_author
|
|
103
103
|
tickets="$(gh issue list --state open --limit 200 --json number,title,author \
|
|
104
104
|
--jq '.[] | "\(.number)\t\(.title)\t\(.author.login)"')"
|
|
105
|
-
while IFS=$'\t' read -r
|
|
106
|
-
[ -n "$
|
|
107
|
-
case "$
|
|
108
|
-
"$
|
|
105
|
+
while IFS=$'\t' read -r number title ticket_author; do
|
|
106
|
+
[ -n "$number" ] || continue
|
|
107
|
+
case "$title" in
|
|
108
|
+
"$package "*) ;;
|
|
109
109
|
*) continue ;;
|
|
110
110
|
esac
|
|
111
|
-
[ "$
|
|
112
|
-
printf '%s\t%s\n' "$
|
|
111
|
+
[ "$ticket_author" = "$author" ] || continue
|
|
112
|
+
printf '%s\t%s\n' "$number" "$title"
|
|
113
113
|
return 0
|
|
114
114
|
done <<<"$tickets"
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
#
|
|
118
|
-
|
|
117
|
+
# Escapes $1 for a sed pattern (delimiter is "|")
|
|
118
|
+
escape_sed() {
|
|
119
119
|
printf '%s' "$1" | sed "s/[][\\\\.*^$()+?{}|]/\\\\&/g"
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
local
|
|
122
|
+
# Replaces the single pinned version of $1 with $2 in its file. Content is
|
|
123
|
+
# written back into the existing file (no mv): its permissions, including the
|
|
124
|
+
# execute bit on devzone, are preserved.
|
|
125
|
+
apply() {
|
|
126
|
+
local package="$1" version="$2" pattern tmp file
|
|
127
127
|
case "$version" in
|
|
128
128
|
"" | *[!0-9A-Za-z.+-]*)
|
|
129
|
-
echo "versions
|
|
129
|
+
echo "versions: invalid version: ${version:-(none)}" >&2
|
|
130
130
|
exit 1
|
|
131
131
|
;;
|
|
132
132
|
esac
|
|
133
|
-
if [ "$
|
|
134
|
-
|
|
135
|
-
grep -qE '^REPOWARDEN_VERSION=' "$
|
|
136
|
-
{ echo "versions
|
|
133
|
+
if [ "$package" = repowarden ]; then
|
|
134
|
+
file="$VERSIONS_ENV"
|
|
135
|
+
grep -qE '^REPOWARDEN_VERSION=' "$file" ||
|
|
136
|
+
{ echo "versions: unknown package: $package" >&2; exit 1; }
|
|
137
137
|
tmp="$(mktemp)"
|
|
138
|
-
sed -E "s|^(REPOWARDEN_VERSION=)[^[:space:]]+$|\1${version}|" "$
|
|
138
|
+
sed -E "s|^(REPOWARDEN_VERSION=)[^[:space:]]+$|\1${version}|" "$file" >"$tmp"
|
|
139
139
|
else
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{ echo "versions
|
|
143
|
-
|
|
140
|
+
file="$DEVZONE"
|
|
141
|
+
pinned | awk -v p="$package" '$1 == p { found = 1 } END { exit found ? 0 : 1 }' ||
|
|
142
|
+
{ echo "versions: unknown package: $package" >&2; exit 1; }
|
|
143
|
+
pattern="$(escape_sed "$package")"
|
|
144
144
|
tmp="$(mktemp)"
|
|
145
|
-
sed -E "s|^(IA_[A-Z0-9_]+=${
|
|
145
|
+
sed -E "s|^(IA_[A-Z0-9_]+=${pattern}@)[^[:space:]]+$|\1${version}|" "$file" >"$tmp"
|
|
146
146
|
fi
|
|
147
|
-
cat "$tmp" >"$
|
|
147
|
+
cat "$tmp" >"$file"
|
|
148
148
|
rm -f "$tmp"
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
case "${1:-}" in
|
|
152
|
-
"")
|
|
153
|
-
--installees)
|
|
154
|
-
--appliquer)
|
|
152
|
+
"") list_outdated ;;
|
|
153
|
+
--installed | --installees) compare_installed ;;
|
|
154
|
+
--apply | --appliquer)
|
|
155
155
|
[ "$#" -eq 3 ] ||
|
|
156
|
-
{ echo "usage
|
|
157
|
-
|
|
156
|
+
{ echo "usage: bash manage/scripts/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2; exit 2; }
|
|
157
|
+
apply "$2" "$3"
|
|
158
158
|
;;
|
|
159
|
-
--ticket-existant)
|
|
159
|
+
--existing-ticket | --ticket-existant)
|
|
160
160
|
[ "$#" -eq 3 ] ||
|
|
161
|
-
{ echo "usage
|
|
162
|
-
|
|
161
|
+
{ echo "usage: bash manage/scripts/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2; exit 2; }
|
|
162
|
+
existing_ticket "$2" "$3"
|
|
163
163
|
;;
|
|
164
164
|
-h | --help) sed -n '2,17p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//' ;;
|
|
165
165
|
*)
|
|
166
|
-
echo "usage
|
|
166
|
+
echo "usage: bash manage/scripts/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2
|
|
167
167
|
exit 2
|
|
168
168
|
;;
|
|
169
169
|
esac
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Names of the workspace command during the English migration (#502, lot 3),
|
|
3
|
+
# sourced by manage/workspace.sh:
|
|
4
|
+
# workspace_command <name> French subcommand name turned into the English one
|
|
5
|
+
# workspace_ports_command <name> same for the ports subcommand
|
|
6
|
+
# compatibility aliases of the renamed functions, kept until lot 4 (#509)
|
|
7
|
+
# Why: command_canonical (.devcontainer/command-aliases.sh) still gives the
|
|
8
|
+
# French name; workspace.sh switches on the English ones. bash 3.2 (macOS).
|
|
9
|
+
|
|
10
|
+
workspace_command() {
|
|
11
|
+
case "${1:-}" in
|
|
12
|
+
demarrer) echo start ;;
|
|
13
|
+
arreter) echo stop ;;
|
|
14
|
+
etat) echo status ;;
|
|
15
|
+
copier-vers) echo copy-to ;;
|
|
16
|
+
copier-depuis) echo copy-from ;;
|
|
17
|
+
migrer) echo migrate ;;
|
|
18
|
+
revenir) echo revert ;;
|
|
19
|
+
nettoyer-docker) echo clean-docker ;;
|
|
20
|
+
*) echo "${1:-}" ;;
|
|
21
|
+
esac
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
workspace_ports_command() {
|
|
25
|
+
case "${1:-}" in
|
|
26
|
+
demarrer) echo start ;;
|
|
27
|
+
arreter) echo stop ;;
|
|
28
|
+
etat) echo status ;;
|
|
29
|
+
*) echo "${1:-}" ;;
|
|
30
|
+
esac
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# compatibility aliases, removed with lot 4 (#509); RACINE and ICI are still
|
|
34
|
+
# read by the scripts of the lot 5 files (argocd-*.sh, services-workspace.sh)
|
|
35
|
+
# shellcheck disable=SC2034
|
|
36
|
+
RACINE="$ROOT"
|
|
37
|
+
# shellcheck disable=SC2034
|
|
38
|
+
ICI="$HERE"
|
|
39
|
+
drapeau_kubectl() { kubectl_flag "$@"; }
|
|
40
|
+
drapeau_helm() { helm_flag "$@"; }
|
|
41
|
+
chemin_chart() { chart_path "$@"; }
|
|
42
|
+
image_par_defaut() { default_image_tag "$@"; }
|
|
43
|
+
demarrer() { start_workspace "$@"; }
|
|
44
|
+
arreter() { stop_workspace "$@"; }
|
|
45
|
+
etat() { status_workspace "$@"; }
|
|
46
|
+
copier_vers() { copy_to "$@"; }
|
|
47
|
+
copier_depuis() { copy_from "$@"; }
|
|
@@ -1,53 +1,56 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Waits for the workspace pod after helm upgrade (#486, #494, #512), sourced by
|
|
3
3
|
# manage/workspace.sh: moved here to keep workspace.sh under 250 lines (#515).
|
|
4
|
-
# Uses
|
|
4
|
+
# Uses kubectl_flag and helm_flag from workspace.sh.
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
local image="$1"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
while [ $((SECONDS -
|
|
6
|
+
# Waits for the workspace pod; missing image or slow pod are reported clearly.
|
|
7
|
+
wait_for_pod() {
|
|
8
|
+
local image="$1" timeout step start state events arch target_revision pod_revision
|
|
9
|
+
timeout="${DEVZONE_WORKSPACE_ATTENTE:-120}"
|
|
10
|
+
step="${DEVZONE_WORKSPACE_PAS:-2}"
|
|
11
|
+
start="$SECONDS"
|
|
12
|
+
while [ $((SECONDS - start)) -lt "$timeout" ]; do
|
|
13
13
|
# Why: after helm upgrade the pod is still the old one; judge only the revision the StatefulSet is updating to, within the same wait bound.
|
|
14
14
|
# shellcheck disable=SC2046
|
|
15
|
-
target_revision="$(kubectl $(
|
|
15
|
+
target_revision="$(kubectl $(kubectl_flag) get statefulset devzone-workspace --namespace devzone-workspace -o jsonpath='{.status.updateRevision}' 2>/dev/null)" || true
|
|
16
16
|
# shellcheck disable=SC2046
|
|
17
|
-
pod_revision="$(kubectl $(
|
|
18
|
-
if [ -z "$target_revision" ] || [ -z "$pod_revision" ] || [ "$target_revision" != "$pod_revision" ]; then sleep "$
|
|
17
|
+
pod_revision="$(kubectl $(kubectl_flag) get pod devzone-workspace-0 --namespace devzone-workspace -o jsonpath='{.metadata.labels.controller-revision-hash}' 2>/dev/null)" || true
|
|
18
|
+
if [ -z "$target_revision" ] || [ -z "$pod_revision" ] || [ "$target_revision" != "$pod_revision" ]; then sleep "$step"; continue; fi
|
|
19
19
|
# shellcheck disable=SC2046
|
|
20
|
-
|
|
20
|
+
state="$(kubectl $(kubectl_flag) get pod devzone-workspace-0 --namespace devzone-workspace \
|
|
21
21
|
-o jsonpath='{.status.phase} {.status.initContainerStatuses[*].state.waiting.reason} {.status.containerStatuses[*].state.waiting.reason}' 2>/dev/null)" || true
|
|
22
|
-
case "$
|
|
22
|
+
case "$state" in
|
|
23
23
|
*ErrImagePull* | *ImagePullBackOff*)
|
|
24
24
|
# shellcheck disable=SC2046
|
|
25
|
-
|
|
25
|
+
events="$(kubectl $(kubectl_flag) get events --namespace devzone-workspace \
|
|
26
26
|
--field-selector involvedObject.name=devzone-workspace-0 \
|
|
27
27
|
-o jsonpath='{.items[*].message}' 2>/dev/null)" || true
|
|
28
|
-
case "$
|
|
28
|
+
case "$events" in
|
|
29
29
|
*"no match for platform"*)
|
|
30
30
|
# shellcheck disable=SC2046
|
|
31
|
-
arch="$(kubectl $(
|
|
31
|
+
arch="$(kubectl $(kubectl_flag) get nodes \
|
|
32
32
|
-o jsonpath='{.items[0].status.nodeInfo.architecture}' 2>/dev/null)" || true
|
|
33
|
-
echo "✖ image $image
|
|
33
|
+
echo "✖ image $image has no build for $arch: devzone releases publish it for amd64 and arm64." >&2
|
|
34
34
|
;;
|
|
35
35
|
*)
|
|
36
|
-
echo "✖ image $image
|
|
36
|
+
echo "✖ image $image not found: it is published at each devzone release." >&2
|
|
37
37
|
;;
|
|
38
38
|
esac
|
|
39
|
-
echo "
|
|
40
|
-
#
|
|
39
|
+
echo " For a manually built image: devzone workspace start --image <repository:tag>" >&2
|
|
40
|
+
# Argo CD Application or helm release (#516): selfHeal would otherwise recreate the pod
|
|
41
41
|
workspace_undeploy >/dev/null 2>&1 || true
|
|
42
42
|
return 1
|
|
43
43
|
;;
|
|
44
44
|
Running*)
|
|
45
|
-
echo "✔ workspace
|
|
45
|
+
echo "✔ workspace started ($image)"
|
|
46
46
|
return 0
|
|
47
47
|
;;
|
|
48
48
|
esac
|
|
49
|
-
sleep "$
|
|
49
|
+
sleep "$step"
|
|
50
50
|
done
|
|
51
|
-
echo "⚠ pod
|
|
51
|
+
echo "⚠ pod not ready after $timeout s: devzone workspace status" >&2
|
|
52
52
|
return 0
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
# compatibility alias, removed with lot 4 (#509)
|
|
56
|
+
attendre_pod() { wait_for_pod "$@"; }
|