devzone 2.0.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/agent-errors.sh +6 -6
- package/.devcontainer/agent-pod-manifest.sh +4 -4
- package/.devcontainer/agent-session.sh +2 -2
- package/.devcontainer/agent-state-json.sh +2 -2
- package/.devcontainer/agent-workspace.sh +1 -1
- package/.devcontainer/agent.sh +7 -7
- package/.devcontainer/ai/host-models.sh +2 -2
- package/.devcontainer/ai/plugins/devzone-guard-v2.js +3 -3
- package/.devcontainer/ai/plugins/devzone-guard.js +3 -3
- package/.devcontainer/argocd/argocd.sh +90 -89
- package/.devcontainer/argocd/catalog-argocd.sh +2 -2
- package/.devcontainer/argocd/services-hook.sh +3 -3
- package/.devcontainer/argocd/services.sh +1 -1
- package/.devcontainer/catalog/app.sh +114 -116
- package/.devcontainer/catalog/catalog-watcher.sh +62 -62
- package/.devcontainer/catalog/mysql/app.conf +1 -1
- package/.devcontainer/catalog/mysql/install.sh +40 -40
- package/.devcontainer/catalog/mysql/mysql.sh +141 -141
- package/.devcontainer/catalog/mysql/volume.sh +39 -39
- package/.devcontainer/catalog.sh +112 -112
- package/.devcontainer/chart-direct.sh +1 -1
- package/.devcontainer/cluster.sh +216 -218
- package/.devcontainer/clusters.sh +41 -41
- package/.devcontainer/devzone +92 -1495
- 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/chart.sh +2 -2
- package/.devcontainer/gitlab/gitlab.sh +81 -82
- package/.devcontainer/gitlab/installation.sh +109 -109
- 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 +30 -30
- package/.devcontainer/kind-wrapper.sh +17 -17
- package/.devcontainer/kube-account.sh +112 -113
- package/.devcontainer/kube-config.sh +45 -46
- package/.devcontainer/{invite-kube.sh → kube-prompt.sh} +6 -6
- package/.devcontainer/kube-reachable.sh +40 -40
- package/.devcontainer/memory.sh +1 -1
- package/.devcontainer/metrics-server.sh +2 -2
- package/.devcontainer/opencode.jsonc +2 -2
- package/.devcontainer/packages.sh +136 -135
- package/.devcontainer/password.sh +1 -1
- package/.devcontainer/ports-auto.sh +152 -153
- package/.devcontainer/ports-json.sh +16 -15
- package/.devcontainer/ports.sh +126 -122
- package/.devcontainer/post-create.sh +52 -52
- package/.devcontainer/postgres/postgres.sh +174 -174
- package/.devcontainer/rename-legacy-files.sh +103 -0
- package/.devcontainer/services-admin.sh +3 -3
- package/.devcontainer/skills/devzone/SKILL.md +40 -41
- package/.devcontainer/startup.sh +48 -49
- package/.devcontainer/state-gitops.sh +1 -1
- package/.devcontainer/state-json.sh +36 -62
- package/.devcontainer/state.sh +2 -2
- package/.devcontainer/workspace-init.sh +16 -2
- package/Makefile +1 -1
- package/README.md +195 -194
- package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
- package/manage/devzone +5 -7
- package/manage/scripts/argocd-workspace.sh +1 -1
- package/manage/scripts/check-names.sh +6 -5
- package/manage/scripts/create-cluster.sh +1 -1
- package/manage/scripts/create-mode.sh +2 -2
- package/manage/scripts/devzone-create.sh +3 -3
- package/manage/scripts/devzone-manifest.sh +1 -1
- package/manage/scripts/devzone-update.sh +12 -8
- package/manage/scripts/launch.sh +7 -48
- package/manage/scripts/migrate-revert.sh +3 -3
- package/manage/scripts/migrate.sh +7 -13
- package/manage/scripts/ports-apps.sh +1 -1
- package/manage/scripts/ports-workspace.sh +7 -7
- package/manage/scripts/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/package.json +1 -1
- package/.devcontainer/docker-relay.sh +0 -149
- package/.devcontainer/docker-without-host.sh +0 -12
- package/.devcontainer/git-identite.sh +0 -28
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# MySQL volumes (#440): choice, listing and deletion of the -mysql-0 PVCs.
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
# Lists the PVCs of the namespace whose name ends with -mysql-0
|
|
5
5
|
mysql_volumes() {
|
|
6
6
|
local ns="$1"
|
|
7
7
|
kubectl --context devzone -n "$ns" get pvc -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' 2>/dev/null |
|
|
8
8
|
grep -E '\-mysql-0$' || true
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
local ns="$1"
|
|
14
|
-
|
|
15
|
-
if [ -z "$
|
|
16
|
-
|
|
17
|
-
if [ "$
|
|
18
|
-
echo "devzone :
|
|
19
|
-
printf '%s\n' "$
|
|
20
|
-
echo "devzone :
|
|
11
|
+
# Claim prefix: 1 PVC -> its prefix, 0 -> donnees, >1 -> refusal (code 2)
|
|
12
|
+
mysql_claim_choose() {
|
|
13
|
+
local ns="$1" list count
|
|
14
|
+
list="$(mysql_volumes "$ns")"
|
|
15
|
+
if [ -z "$list" ]; then echo donnees; return 0; fi
|
|
16
|
+
count="$(printf '%s\n' "$list" | grep -c .)"
|
|
17
|
+
if [ "$count" -eq 1 ]; then echo "${list%-mysql-0}"; return 0; fi
|
|
18
|
+
echo "devzone : catalog mysql : several volumes found:" >&2
|
|
19
|
+
printf '%s\n' "$list" | sed 's/^/ /' >&2
|
|
20
|
+
echo "devzone : catalog mysql : choose one with devzone mysql volume <name>" >&2
|
|
21
21
|
return 2
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
# Claim
|
|
25
|
-
|
|
24
|
+
# Claim carried by the StatefulSet (empty if absent)
|
|
25
|
+
mysql_claim_mounted() {
|
|
26
26
|
local ns="$1"
|
|
27
27
|
kubectl --context devzone -n "$ns" get statefulset mysql \
|
|
28
28
|
-o jsonpath='{.spec.volumeClaimTemplates[0].metadata.name}' 2>/dev/null || true
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# volume subcommand: lists, or selects/deletes a PVC
|
|
32
32
|
mysql_volume() {
|
|
33
|
-
local ns="$1"
|
|
33
|
+
local ns="$1" name="" yes="" delete="" arg answer pvc mounted claim
|
|
34
34
|
shift
|
|
35
35
|
for arg in "$@"; do
|
|
36
36
|
case "$arg" in
|
|
37
|
-
--delete)
|
|
38
|
-
--yes)
|
|
39
|
-
*)
|
|
37
|
+
--delete) delete=1 ;;
|
|
38
|
+
--yes) yes=1 ;;
|
|
39
|
+
*) name="$arg" ;;
|
|
40
40
|
esac
|
|
41
41
|
done
|
|
42
|
-
if [ -n "$
|
|
43
|
-
[ -n "$
|
|
44
|
-
pvc="$
|
|
42
|
+
if [ -n "$delete" ]; then
|
|
43
|
+
[ -n "$name" ] || refuse "volume --delete: missing name"
|
|
44
|
+
pvc="$name"
|
|
45
45
|
[[ "$pvc" == *-mysql-0 ]] || pvc="$pvc-mysql-0"
|
|
46
|
-
|
|
47
|
-
[ "${pvc%-mysql-0}" != "$
|
|
48
|
-
if [ -z "$
|
|
49
|
-
|
|
50
|
-
printf '
|
|
51
|
-
read -r
|
|
52
|
-
case "$
|
|
53
|
-
|
|
54
|
-
*) echo "
|
|
46
|
+
mounted="$(mysql_claim_mounted "$ns")"
|
|
47
|
+
[ "${pvc%-mysql-0}" != "$mounted" ] || refuse "mounted volume, deletion refused: $name"
|
|
48
|
+
if [ -z "$yes" ]; then
|
|
49
|
+
cluster_interactive || refuse "confirmation needs a terminal: devzone mysql volume --delete $name --yes"
|
|
50
|
+
printf 'Delete volume %s? [y/N] ' "$pvc" >&2
|
|
51
|
+
read -r answer || answer=""
|
|
52
|
+
case "$answer" in
|
|
53
|
+
y | Y | yes) ;;
|
|
54
|
+
*) echo "Aborted: nothing was deleted."; return 0 ;;
|
|
55
55
|
esac
|
|
56
56
|
fi
|
|
57
57
|
kubectl --context devzone -n "$ns" delete pvc "$pvc" >/dev/null
|
|
58
|
-
echo "✔ volume $pvc
|
|
58
|
+
echo "✔ volume $pvc deleted"
|
|
59
59
|
return 0
|
|
60
60
|
fi
|
|
61
|
-
if [ -z "$
|
|
62
|
-
|
|
63
|
-
mysql_volumes "$ns" | awk -v m="$
|
|
61
|
+
if [ -z "$name" ]; then
|
|
62
|
+
mounted="$(mysql_claim_mounted "$ns")"
|
|
63
|
+
mysql_volumes "$ns" | awk -v m="$mounted-mysql-0" 'NF { mark = ($0 == m) ? " (mounted)" : ""; printf " %s%s\n", $0, mark; n++ } END { if (!n) print " (no volume)" }'
|
|
64
64
|
return 0
|
|
65
65
|
fi
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
claim="$
|
|
66
|
+
module_context >/dev/null
|
|
67
|
+
installed || refuse "module disabled: devzone enable mysql"
|
|
68
|
+
claim="$name"
|
|
69
69
|
[[ "$claim" == *-mysql-0 ]] && claim="${claim%-mysql-0}"
|
|
70
|
-
|
|
70
|
+
mysql_install_claim "$ns" "$claim"
|
|
71
71
|
}
|
package/.devcontainer/catalog.sh
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# .devcontainer/catalog/<app>/ (app.conf
|
|
4
|
-
#
|
|
5
|
-
#
|
|
2
|
+
# Application catalog (#414): one preconfigured application per folder
|
|
3
|
+
# .devcontainer/catalog/<app>/ (app.conf; the chart charts/devzone-<app>, #559),
|
|
4
|
+
# installed in the devzone services cluster under the namespace of its app.conf;
|
|
5
|
+
# the wanted state is the line <app>=on|off of .devzone.modules.
|
|
6
6
|
# catalog.sh sync | apply | list | resume | json | remove <app>
|
|
7
7
|
set -euo pipefail
|
|
8
8
|
|
|
9
9
|
ICI="$(cd "$(dirname "$0")" && pwd)"
|
|
10
|
-
RACINE="${
|
|
11
|
-
ETAT="${
|
|
10
|
+
RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
|
|
11
|
+
ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
12
12
|
# shellcheck source=SCRIPTDIR/cluster.sh
|
|
13
13
|
# shellcheck disable=SC1091
|
|
14
14
|
. "$ICI/cluster.sh"
|
|
@@ -25,38 +25,38 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
25
25
|
# shellcheck disable=SC1091
|
|
26
26
|
. "$ICI/catalog/app.sh"
|
|
27
27
|
|
|
28
|
-
refuse() { echo "devzone :
|
|
28
|
+
refuse() { echo "devzone : catalog : $*" >&2; exit 2; }
|
|
29
29
|
|
|
30
|
-
#
|
|
31
|
-
|
|
30
|
+
# Catalog folder (overridable by the tests)
|
|
31
|
+
catalog_dir() { echo "${DEVZONE_CATALOG:-$ICI/catalog}"; }
|
|
32
32
|
|
|
33
|
-
#
|
|
34
|
-
|
|
33
|
+
# Catalog applications: folders holding an app.conf, sorted
|
|
34
|
+
catalog_apps() {
|
|
35
35
|
local d
|
|
36
|
-
for d in "$(
|
|
36
|
+
for d in "$(catalog_dir)"/*; do
|
|
37
37
|
[ -f "$d/app.conf" ] || continue
|
|
38
38
|
echo "${d##*/}"
|
|
39
39
|
done | LC_ALL=C sort
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
grep -E "^$2=" "$(
|
|
42
|
+
# app.conf key (name, description, image, port, memoire, taille, namespace)
|
|
43
|
+
app_read() {
|
|
44
|
+
grep -E "^$2=" "$(catalog_dir)/$1/app.conf" 2>/dev/null | tail -1 | cut -d= -f2- || true
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
#
|
|
48
|
-
|
|
47
|
+
# Application namespace: the one of app.conf (required)
|
|
48
|
+
app_namespace() {
|
|
49
49
|
local ns
|
|
50
|
-
ns="$(
|
|
51
|
-
[ -n "$ns" ] || refuse "namespace
|
|
50
|
+
ns="$(app_read "$1" namespace)"
|
|
51
|
+
[ -n "$ns" ] || refuse "missing namespace in app.conf of $1"
|
|
52
52
|
echo "$ns"
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
#
|
|
56
|
-
|
|
55
|
+
# Failure marker of an application: same scheme as the failure file of the modules
|
|
56
|
+
failure_file() { echo "$ETAT-failed-$1"; }
|
|
57
57
|
|
|
58
|
-
#
|
|
59
|
-
|
|
58
|
+
# Wanted state: on if the line <app>=on exists, off by default
|
|
59
|
+
wanted() {
|
|
60
60
|
local v
|
|
61
61
|
v="$(grep -E "^$1=" "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true)"
|
|
62
62
|
[ "$v" = on ] && echo on || echo off
|
|
@@ -66,166 +66,166 @@ voulu() {
|
|
|
66
66
|
# service resolves in the cluster DNS (no RBAC needed, #515). Elsewhere: labelled
|
|
67
67
|
# namespace and StatefulSet of the app name; reading the namespaces is reserved
|
|
68
68
|
# to the administrator (#430). Nothing without a chosen cluster or when absent.
|
|
69
|
-
|
|
69
|
+
present() {
|
|
70
70
|
local ctx ns
|
|
71
|
-
ns="$(
|
|
71
|
+
ns="$(app_namespace "$1")"
|
|
72
72
|
if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
|
|
73
73
|
# In the pod there is no kubeconfig and the limited service account
|
|
74
74
|
# cannot list StatefulSets (#430): presence is the cluster DNS
|
|
75
75
|
# resolving the service, no RBAC needed, the pod service account
|
|
76
76
|
# stays limited
|
|
77
|
-
getent hosts "$(
|
|
77
|
+
getent hosts "$(app_read "$1" name).${ns}.svc" >/dev/null 2>&1
|
|
78
78
|
return
|
|
79
79
|
fi
|
|
80
|
-
ctx="$(
|
|
80
|
+
ctx="$(cluster_saved)"
|
|
81
81
|
[ -n "$ctx" ] || return 1
|
|
82
|
-
|
|
82
|
+
account_admin "$ctx" get namespace "$ns" >/dev/null 2>&1 &&
|
|
83
83
|
kubectl --context devzone -n "$ns" get statefulset "$1" >/dev/null 2>&1
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
# Application
|
|
87
|
-
|
|
86
|
+
# Application ready: the StatefulSet has one ready replica
|
|
87
|
+
app_ready() {
|
|
88
88
|
local ns
|
|
89
|
-
ns="$(
|
|
89
|
+
ns="$(app_namespace "$1")"
|
|
90
90
|
[ "$(kubectl --context devzone -n "$ns" get statefulset "$1" \
|
|
91
91
|
-o jsonpath='{.status.readyReplicas}' 2>/dev/null || true)" = 1 ]
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
#
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
local app entete manque="" tmp
|
|
94
|
+
# Adds to the state the <app>=off lines of the absent applications (once each,
|
|
95
|
+
# an existing line is never changed), preceded once by the comment; reading and
|
|
96
|
+
# writing hold the same lock (#417): a concurrent write cannot be lost between the two
|
|
97
|
+
catalog_sync() (
|
|
98
|
+
local app header missing="" tmp
|
|
100
99
|
[ -f "$ETAT" ] || return 0
|
|
101
|
-
|
|
100
|
+
header="# Catalog applications: set to on to install (devzone catalog)"
|
|
102
101
|
state_lock_take || return 1
|
|
103
|
-
#
|
|
102
|
+
# The lock is released on exit, including on an error under set -e
|
|
104
103
|
trap 'state_lock_release' EXIT
|
|
105
104
|
while IFS= read -r app; do
|
|
106
105
|
[ -n "$app" ] || continue
|
|
107
106
|
grep -qE "^${app}=" "$ETAT" 2>/dev/null && continue
|
|
108
|
-
|
|
109
|
-
done <<<"$(
|
|
110
|
-
[ -n "$
|
|
107
|
+
missing="${missing}${missing:+$'\n'}${app}=off"
|
|
108
|
+
done <<<"$(catalog_apps)"
|
|
109
|
+
[ -n "$missing" ] || return 0
|
|
111
110
|
tmp="$(mktemp)"
|
|
112
111
|
{
|
|
113
112
|
cat "$ETAT"
|
|
114
|
-
grep -qF "$
|
|
115
|
-
echo "$
|
|
113
|
+
grep -qF -e "$header" "$ETAT" || echo "$header"
|
|
114
|
+
echo "$missing"
|
|
116
115
|
} >"$tmp"
|
|
117
116
|
state_replace "$tmp"
|
|
118
117
|
rm -f "$tmp"
|
|
119
118
|
)
|
|
120
119
|
|
|
121
|
-
#
|
|
122
|
-
|
|
120
|
+
# Real state of an application: available, expected, installed, failed. These
|
|
121
|
+
# values are the etat field of devzone status --json: keep them
|
|
122
|
+
app_state() {
|
|
123
123
|
local app="$1"
|
|
124
|
-
if [ "$(
|
|
125
|
-
echo
|
|
126
|
-
elif [ -f "$(
|
|
127
|
-
echo
|
|
128
|
-
elif
|
|
129
|
-
echo
|
|
124
|
+
if [ "$(wanted "$app")" != on ]; then
|
|
125
|
+
echo available
|
|
126
|
+
elif [ -f "$(failure_file "$app")" ]; then
|
|
127
|
+
echo failed
|
|
128
|
+
elif present "$app"; then
|
|
129
|
+
echo installed
|
|
130
130
|
else
|
|
131
|
-
echo
|
|
131
|
+
echo expected
|
|
132
132
|
fi
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
# devzone catalog
|
|
136
|
-
|
|
137
|
-
local app
|
|
135
|
+
# devzone catalog: name, state (off, on installed, on failed), description
|
|
136
|
+
catalog_list() {
|
|
137
|
+
local app state label
|
|
138
138
|
while IFS= read -r app; do
|
|
139
139
|
[ -n "$app" ] || continue
|
|
140
|
-
|
|
141
|
-
case "$
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*)
|
|
140
|
+
state="$(app_state "$app")"
|
|
141
|
+
case "$state" in
|
|
142
|
+
available) label='off available' ;;
|
|
143
|
+
installed) label='on installed' ;;
|
|
144
|
+
failed) label='on failed' ;;
|
|
145
|
+
*) label='on expected' ;;
|
|
146
146
|
esac
|
|
147
|
-
printf ' %-12s %-14s %s\n' "$app" "$
|
|
148
|
-
done <<<"$(
|
|
147
|
+
printf ' %-12s %-14s %s\n' "$app" "$label" "$(app_read "$app" description)"
|
|
148
|
+
done <<<"$(catalog_apps)"
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
#
|
|
152
|
-
|
|
153
|
-
local app="$1" script
|
|
151
|
+
# Relay of the installed application: state of its script, else the relay pid
|
|
152
|
+
app_relay_stopped() {
|
|
153
|
+
local app="$1" script state
|
|
154
154
|
if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
|
|
155
155
|
# In the pod, no relay: the access goes through the workspace ports
|
|
156
156
|
return 1
|
|
157
157
|
fi
|
|
158
158
|
script="$ICI/catalog/$app/$app.sh"
|
|
159
159
|
if [ -f "$script" ]; then
|
|
160
|
-
|
|
161
|
-
case "$
|
|
160
|
+
state="$(bash "$script" status 2>/dev/null || true)"
|
|
161
|
+
case "$state" in *"relay stopped"*) return 0 ;; esac
|
|
162
162
|
fi
|
|
163
|
-
!
|
|
163
|
+
! relay_active "$app"
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
|
|
166
|
+
# Application lines of devzone's summary: ○ available, ✔ installed (relay
|
|
167
|
+
# address), ✖ failed, ⚠ expected
|
|
168
|
+
catalog_summary() {
|
|
169
169
|
local app
|
|
170
170
|
while IFS= read -r app; do
|
|
171
171
|
[ -n "$app" ] || continue
|
|
172
|
-
case "$(
|
|
173
|
-
|
|
174
|
-
"$app" "$(
|
|
175
|
-
|
|
176
|
-
if
|
|
177
|
-
printf ' ⚠ application %-12s
|
|
172
|
+
case "$(app_state "$app")" in
|
|
173
|
+
available) printf ' ○ application %-12s available, %s: devzone enable %s\n' \
|
|
174
|
+
"$app" "$(app_read "$app" description)" "$app" ;;
|
|
175
|
+
installed)
|
|
176
|
+
if app_relay_stopped "$app"; then
|
|
177
|
+
printf ' ⚠ application %-12s installed, relay stopped: devzone repair\n' "$app"
|
|
178
178
|
else
|
|
179
179
|
if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
|
|
180
|
-
printf ' ✔ application %-12s
|
|
180
|
+
printf ' ✔ application %-12s installed: local access: devzone workspace ports\n' "$app"
|
|
181
181
|
else
|
|
182
|
-
printf ' ✔ application %-12s
|
|
183
|
-
"$app" "$(
|
|
182
|
+
printf ' ✔ application %-12s installed: 127.0.0.1:%s\n' \
|
|
183
|
+
"$app" "$(app_read "$app" port)"
|
|
184
184
|
fi
|
|
185
185
|
fi ;;
|
|
186
|
-
|
|
187
|
-
*) printf ' ✖ application %s
|
|
188
|
-
"$app" "$(head -1 "$(
|
|
186
|
+
expected) printf ' ⚠ application %-12s expected: devzone apply\n' "$app" ;;
|
|
187
|
+
*) printf ' ✖ application %s failed: %s: devzone apply\n' \
|
|
188
|
+
"$app" "$(head -1 "$(failure_file "$app")")" ;;
|
|
189
189
|
esac
|
|
190
|
-
done <<<"$(
|
|
191
|
-
|
|
190
|
+
done <<<"$(catalog_apps)"
|
|
191
|
+
app_unused_mysql_volumes 2>/dev/null || true
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
#
|
|
195
|
-
|
|
196
|
-
local app
|
|
194
|
+
# Applications section of devzone status --json: same fields as the modules
|
|
195
|
+
catalog_json() {
|
|
196
|
+
local app active state failure cmd json='[]'
|
|
197
197
|
while IFS= read -r app; do
|
|
198
198
|
[ -n "$app" ] || continue
|
|
199
|
-
|
|
200
|
-
[ "$(
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
active=false
|
|
200
|
+
[ "$(wanted "$app")" = on ] && active=true
|
|
201
|
+
state="$(app_state "$app")"
|
|
202
|
+
failure=""
|
|
203
203
|
cmd="devzone apply"
|
|
204
|
-
case "$
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
case "$state" in
|
|
205
|
+
available) cmd="devzone enable $app" ;;
|
|
206
|
+
installed) cmd="devzone disable $app" ;;
|
|
207
|
+
failed) failure="$(head -1 "$(failure_file "$app")")" ;;
|
|
208
208
|
esac
|
|
209
|
-
json="$(jq -cn --argjson
|
|
210
|
-
--arg description "$(
|
|
211
|
-
--arg
|
|
212
|
-
--arg
|
|
213
|
-
'$
|
|
214
|
-
done <<<"$(
|
|
209
|
+
json="$(jq -cn --argjson before "$json" --arg name "$app" --argjson active "$active" \
|
|
210
|
+
--arg description "$(app_read "$app" description)" \
|
|
211
|
+
--arg state "$state" --arg port "$(app_read "$app" port)" \
|
|
212
|
+
--arg failure "$failure" --arg command "$cmd" \
|
|
213
|
+
'$before + [{name:$name,active:$active,description:$description,port:$port,state:$state,failed:(if $failure=="" then null else $failure end),command:(if $command=="" then null else $command end)}]')"
|
|
214
|
+
done <<<"$(catalog_apps)"
|
|
215
215
|
printf '%s\n' "$json"
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
case "${1:-}" in
|
|
219
|
-
sync)
|
|
220
|
-
apply)
|
|
221
|
-
list)
|
|
222
|
-
resume)
|
|
223
|
-
json)
|
|
224
|
-
#
|
|
225
|
-
remove)
|
|
219
|
+
sync) catalog_sync ;;
|
|
220
|
+
apply) catalog_apply ;;
|
|
221
|
+
list) catalog_list ;;
|
|
222
|
+
resume) catalog_summary ;;
|
|
223
|
+
json) catalog_json ;;
|
|
224
|
+
# Removal of an application: StatefulSet and service, volume kept (#441)
|
|
225
|
+
remove) app_remove "$2" ;;
|
|
226
226
|
-h | --help | aide) sed -n '2,6p' "$0" | sed 's/^# \{0,1\}//' ;;
|
|
227
227
|
*)
|
|
228
|
-
echo "devzone :
|
|
228
|
+
echo "devzone : catalog : sync | apply | list | resume | json | remove <app>" >&2
|
|
229
229
|
exit 1
|
|
230
230
|
;;
|
|
231
231
|
esac
|
|
@@ -33,7 +33,7 @@ chart_install() {
|
|
|
33
33
|
shift 2
|
|
34
34
|
chart="$CHART_CODE/charts/devzone-$svc"
|
|
35
35
|
if [ ! -f "$chart/Chart.yaml" ]; then
|
|
36
|
-
echo "✖ $svc : chart charts/devzone-$svc missing (manage/docs/reference.md#charts
|
|
36
|
+
echo "✖ $svc : chart charts/devzone-$svc missing (manage/docs/reference.md#devzone-charts)" >&2
|
|
37
37
|
return 2
|
|
38
38
|
fi
|
|
39
39
|
sets=()
|