devzone 0.59.0 → 1.1.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-erreurs.sh +72 -56
- package/.devcontainer/agent-etat-json.sh +45 -43
- package/.devcontainer/agent-modele.sh +3 -3
- package/.devcontainer/agent-session.sh +122 -125
- package/.devcontainer/agent-workspace.sh +53 -53
- package/.devcontainer/agent.sh +107 -109
- package/.devcontainer/argocd/argocd.sh +4 -16
- package/.devcontainer/catalogue/app.sh +1 -1
- package/.devcontainer/catalogue/catalogue-veilleur.sh +2 -2
- package/.devcontainer/catalogue/mysql/mysql.sh +1 -13
- package/.devcontainer/catalogue.sh +4 -16
- package/.devcontainer/cluster.sh +1 -1
- package/.devcontainer/command-aliases.sh +78 -114
- package/.devcontainer/devzone +34 -48
- package/.devcontainer/etat-json.sh +162 -162
- package/.devcontainer/etat-verrou.sh +25 -24
- package/.devcontainer/etat.sh +122 -123
- package/.devcontainer/gitlab/gitlab.sh +1 -13
- package/.devcontainer/gitlab/installation.sh +3 -3
- package/.devcontainer/gitlab/secrets.sh +1 -1
- package/.devcontainer/gitlab/test-gitlab.sh +1 -1
- package/.devcontainer/help.sh +4 -3
- package/.devcontainer/memoire.sh +58 -58
- package/.devcontainer/metrics-server.sh +52 -51
- package/.devcontainer/paquets.sh +0 -12
- package/.devcontainer/password.sh +88 -87
- package/.devcontainer/ports-auto.sh +6 -6
- package/.devcontainer/ports.sh +1 -13
- package/.devcontainer/postgres/postgres.sh +1 -13
- package/.devcontainer/services-admin.sh +3 -3
- package/.devcontainer/skills/devzone/SKILL.md +2 -2
- package/README.md +13 -3
- package/charts/devzone-workspace/templates/statefulset.yaml +3 -0
- package/manage/devzone +61 -569
- package/manage/scripts/argocd-services.sh +2 -2
- package/manage/scripts/devzone-create.sh +138 -0
- package/manage/scripts/devzone-manifest.sh +171 -0
- package/manage/scripts/devzone-update.sh +222 -0
- package/manage/scripts/migrer.sh +2 -6
- package/manage/scripts/workspace-aliases.sh +4 -31
- package/manage/workspace.sh +7 -12
- package/package.json +1 -1
package/.devcontainer/agent.sh
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# shellcheck disable=SC2034 # RACINE, FREE_MODELS,
|
|
2
|
+
# Drives opencode on a brief: rotation, silence at start, resume.
|
|
3
|
+
# ia module (#221). devzone agent <folder> <brief> | etat | liberer.
|
|
4
|
+
# shellcheck disable=SC2034 # RACINE, FREE_MODELS, PAUSE_RANK: read by the sourced agent-*.sh
|
|
5
5
|
set -euo pipefail
|
|
6
|
-
#
|
|
7
|
-
#
|
|
6
|
+
# Folder of the script, symbolic links followed by hand: readlink -f does not exist
|
|
7
|
+
# on macOS (tests under bash 3.2).
|
|
8
8
|
SOURCE="${BASH_SOURCE[0]}"
|
|
9
9
|
while [ -L "$SOURCE" ]; do
|
|
10
10
|
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
@@ -34,185 +34,183 @@ FREE_MODELS=(big-pickle deepseek-v4.1-flash-free hy4-flash-free nemotron-3.5-sup
|
|
|
34
34
|
# shellcheck source=agent-pod.sh disable=SC1091
|
|
35
35
|
. "$ICI/agent-pod.sh"
|
|
36
36
|
SILENCE="${DEVZONE_AGENT_SILENCE:-45}"
|
|
37
|
-
|
|
37
|
+
FROZEN="${DEVZONE_AGENT_FIGEE:-600}"
|
|
38
38
|
AGENT_ETAT="${DEVZONE_AGENT_ETAT:-$HOME/.local/state/oc-lancer}"
|
|
39
|
-
# Pause
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
if [ -n "${DEVZONE_AGENT_PAUSE_RANG:-}" ] && [ -n "${BATS_TEST_TMPDIR:-}" ]; then
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
refuse() { echo "devzone agent
|
|
46
|
-
|
|
47
|
-
local
|
|
48
|
-
local journal
|
|
49
|
-
local
|
|
50
|
-
local
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
[ -d "$
|
|
54
|
-
[ -r "$
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
#
|
|
39
|
+
# Pause between read and write of the rank (tests only): active only when
|
|
40
|
+
# DEVZONE_AGENT_PAUSE_RANG is set under bats; never a pause by default.
|
|
41
|
+
PAUSE_RANK=0
|
|
42
|
+
if [ -n "${DEVZONE_AGENT_PAUSE_RANG:-}" ] && [ -n "${BATS_TEST_TMPDIR:-}" ]; then PAUSE_RANK="$DEVZONE_AGENT_PAUSE_RANG"; fi
|
|
43
|
+
# Retries of the same session for a network cause, per model, before the next model
|
|
44
|
+
NETWORK_RETRIES=3
|
|
45
|
+
refuse() { echo "devzone agent: $*" >&2; exit 2; }
|
|
46
|
+
agent_launch() {
|
|
47
|
+
local folder="$1" brief="$2"
|
|
48
|
+
local journal state start m i pid code offset size started freeze discard new
|
|
49
|
+
local brief_current resumed=0 now last output recent cause start_t
|
|
50
|
+
local network_for="" network_n=0
|
|
51
|
+
# Paths relative to the calling folder: made absolute before any cd, lock or
|
|
52
|
+
# state write; the name of the brief is kept.
|
|
53
|
+
[ -d "$folder" ] || refuse "folder not found: $folder (searched from $(pwd))"
|
|
54
|
+
[ -r "$brief" ] || refuse "brief not found: $brief (searched from $(pwd))"
|
|
55
|
+
folder="$(cd "$folder" && pwd -P)"
|
|
56
|
+
brief="$(cd "$(dirname "$brief")" && pwd -P)/$(basename "$brief")"
|
|
57
|
+
# ia module required: without assistants, nothing to drive.
|
|
58
58
|
if ! bash "$ICI/devzone" is-enabled ia >/dev/null 2>&1; then
|
|
59
|
-
refuse "
|
|
59
|
+
refuse "ia module disabled: devzone enable ia"
|
|
60
60
|
fi
|
|
61
61
|
configurer
|
|
62
|
-
journal="$(
|
|
62
|
+
journal="$(journal_of "$folder")"
|
|
63
63
|
export AGENT_JOURNAL="$journal"
|
|
64
|
-
|
|
65
|
-
mkdir -p "$(dirname "$journal")" "$
|
|
66
|
-
droits_photo "$
|
|
64
|
+
state="$AGENT_ETAT"
|
|
65
|
+
mkdir -p "$(dirname "$journal")" "$state"
|
|
66
|
+
droits_photo "$folder"
|
|
67
67
|
modeles_charger "$journal"
|
|
68
68
|
local_charge
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
#
|
|
72
|
-
# diff, log),
|
|
73
|
-
|
|
74
|
-
if [ "$
|
|
75
|
-
|
|
69
|
+
start="$(rank_take "$state" "$journal")" || refuse "model rank locked: retry later"
|
|
70
|
+
brief_current="$brief"
|
|
71
|
+
# Resume: a new session restarts from the work already present (git status,
|
|
72
|
+
# diff, log), without conversation history.
|
|
73
|
+
resume() {
|
|
74
|
+
if [ "$resumed" = 1 ]; then return 0; fi
|
|
75
|
+
resumed=1
|
|
76
76
|
local c
|
|
77
77
|
c="$(mktemp)"
|
|
78
|
-
cat "$
|
|
79
|
-
printf '\n\
|
|
80
|
-
|
|
78
|
+
cat "$brief_current" >"$c"
|
|
79
|
+
printf '\n\nRESUME: a previous session was interrupted. Read git status, git diff and git log in the folder, check this work against the brief above, fix what deviates from it and finish what is missing.\n' >>"$c"
|
|
80
|
+
brief_current="$c"
|
|
81
81
|
}
|
|
82
|
-
modele_ordre "$
|
|
82
|
+
modele_ordre "$start"
|
|
83
83
|
i=0
|
|
84
84
|
while [ "$i" -lt "${#ORDRE[@]}" ]; do
|
|
85
85
|
m="${ORDRE[$i]}"
|
|
86
|
-
if [ "$m" != "$
|
|
87
|
-
if
|
|
86
|
+
if [ "$m" != "$network_for" ]; then network_for="$m"; network_n=0; fi
|
|
87
|
+
if model_excluded "$m"; then
|
|
88
88
|
modele_demande_ecart "$m" "$(modele_ecart_cause "$m")" "$journal"
|
|
89
89
|
i=$(( i + 1 ))
|
|
90
90
|
continue
|
|
91
91
|
fi
|
|
92
92
|
modele_demande_choisi "$m" "$journal"
|
|
93
|
-
echo "===
|
|
93
|
+
echo "=== model opencode/$m start $(date -u +%Y-%m-%dT%H:%M:%SZ)" >>"$journal"
|
|
94
94
|
offset="$(wc -c <"$journal")"
|
|
95
|
-
|
|
95
|
+
opencode_launch "$folder" "$m" "$brief_current" "$journal" "$state"
|
|
96
96
|
pid=$!
|
|
97
|
-
|
|
97
|
+
started=0
|
|
98
98
|
discard=0
|
|
99
|
-
|
|
100
|
-
debut_t="$(date +%s)"
|
|
99
|
+
start_t="$(date +%s)"
|
|
101
100
|
while kill -0 "$pid" 2>/dev/null; do
|
|
102
|
-
if
|
|
101
|
+
if session_fatal_error "$pid" "$journal" "$offset" "$m" "$folder"; then discard=1; break; fi
|
|
103
102
|
if [ "$(wc -c <"$journal")" -gt "$offset" ]; then
|
|
104
|
-
|
|
105
|
-
if [ "$(
|
|
103
|
+
new="$(tail -c "+$(( offset + 1 ))" "$journal" 2>/dev/null || true)"
|
|
104
|
+
if [ "$(error_cause "$(error_lines "$new")")" != "quota" ]; then started=1; break; fi
|
|
106
105
|
fi
|
|
107
|
-
if [ $(( $(date +%s) -
|
|
106
|
+
if [ $(( $(date +%s) - start_t )) -ge "$SILENCE" ]; then break; fi
|
|
108
107
|
sleep "${DEVZONE_AGENT_PAS:-1}"
|
|
109
108
|
done
|
|
110
|
-
if [ "$discard" = 1 ]; then
|
|
111
|
-
if kill -0 "$pid" 2>/dev/null && [ "$
|
|
109
|
+
if [ "$discard" = 1 ]; then resume; i=$(( i + 1 )); continue; fi
|
|
110
|
+
if kill -0 "$pid" 2>/dev/null && [ "$started" = 0 ]; then
|
|
112
111
|
pkill -P "$pid" 2>/dev/null || true
|
|
113
112
|
kill "$pid" 2>/dev/null || true
|
|
114
113
|
wait "$pid" 2>/dev/null || true
|
|
115
|
-
droits_verifier "$
|
|
116
|
-
echo "=== opencode/$m
|
|
117
|
-
|
|
114
|
+
droits_verifier "$folder"
|
|
115
|
+
echo "=== opencode/$m silent at start: excluded 1 h, next model" >>"$journal"
|
|
116
|
+
model_exclude "$m" mute
|
|
118
117
|
modele_demande_ecart "$m" mute "$journal"
|
|
119
|
-
|
|
118
|
+
resume
|
|
120
119
|
i=$(( i + 1 ))
|
|
121
120
|
continue
|
|
122
121
|
fi
|
|
123
|
-
#
|
|
124
|
-
#
|
|
122
|
+
# Frozen session: nothing written for FROZEN seconds during the run -> stopped,
|
|
123
|
+
# then a new session with the resume brief.
|
|
125
124
|
freeze=0
|
|
126
|
-
if kill -0 "$pid" 2>/dev/null && [ "$
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
if kill -0 "$pid" 2>/dev/null && [ "$started" = 1 ]; then
|
|
126
|
+
last="$(date +%s)"
|
|
127
|
+
size="$(wc -c <"$journal")"
|
|
129
128
|
while kill -0 "$pid" 2>/dev/null; do
|
|
130
|
-
if
|
|
129
|
+
if session_fatal_error "$pid" "$journal" "$offset" "$m" "$folder"; then discard=1; break; fi
|
|
131
130
|
sleep "${DEVZONE_AGENT_PAS:-1}"
|
|
132
|
-
|
|
133
|
-
if [ "$(wc -c <"$journal")" -gt "$
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
now="$(date +%s)"
|
|
132
|
+
if [ "$(wc -c <"$journal")" -gt "$size" ]; then
|
|
133
|
+
size="$(wc -c <"$journal")"
|
|
134
|
+
last="$now"
|
|
136
135
|
fi
|
|
137
|
-
if [ $((
|
|
136
|
+
if [ $(( now - last )) -gt "$FROZEN" ]; then
|
|
138
137
|
pkill -P "$pid" 2>/dev/null || true
|
|
139
138
|
kill "$pid" 2>/dev/null || true
|
|
140
139
|
wait "$pid" 2>/dev/null || true
|
|
141
|
-
droits_verifier "$
|
|
140
|
+
droits_verifier "$folder"
|
|
142
141
|
freeze=1
|
|
143
142
|
break
|
|
144
143
|
fi
|
|
145
144
|
done
|
|
146
145
|
fi
|
|
147
|
-
if [ "$discard" = 1 ]; then
|
|
146
|
+
if [ "$discard" = 1 ]; then resume; i=$(( i + 1 )); continue; fi
|
|
148
147
|
if [ "$freeze" = 1 ]; then
|
|
149
|
-
echo "=== opencode/$m
|
|
150
|
-
|
|
148
|
+
echo "=== opencode/$m frozen ($FROZEN s without writing): new session, next model" >>"$journal"
|
|
149
|
+
resume
|
|
151
150
|
i=$(( i + 1 ))
|
|
152
151
|
continue
|
|
153
152
|
fi
|
|
154
153
|
code=0
|
|
155
154
|
wait "$pid" || code=$?
|
|
156
|
-
droits_verifier "$
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
#
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
echo "=== erreur réseau signalée mais réseau joignable : traité comme autre" >>"$journal"
|
|
155
|
+
droits_verifier "$folder"
|
|
156
|
+
# Only the output of this attempt counts: an error of a previous model must not
|
|
157
|
+
# condemn the next one. Only its last 30 lines are read, and only when the exit
|
|
158
|
+
# code is non-zero or opencode wrote its own error line: a printed "Free usage
|
|
159
|
+
# limit" in text that ends normally is not a failure.
|
|
160
|
+
output="$(tail -c "+$(( offset + 1 ))" "$journal" 2>/dev/null || true)"
|
|
161
|
+
recent="$(printf '%s\n' "$output" | tail -n 30)"
|
|
162
|
+
if [ "$code" -ne 0 ] || printf '%s\n' "$recent" | grep -qE "$ERROR_LINE"; then
|
|
163
|
+
if printf '%s\n' "$recent" | grep -qE "$ERRORS"; then
|
|
164
|
+
cause="$(error_cause "$(printf '%s\n' "$recent" | grep -oE "$ERRORS" | tail -1)")"
|
|
165
|
+
# A network error is kept only if the network is down now: otherwise it
|
|
166
|
+
# would repeat endlessly on a good network.
|
|
167
|
+
if [ "$cause" = reseau ] && network_reachable; then
|
|
168
|
+
echo "=== network error reported but network reachable: treated as other" >>"$journal"
|
|
171
169
|
cause=autre
|
|
172
170
|
fi
|
|
173
|
-
if [ "$cause" = reseau ] && [ "$
|
|
174
|
-
echo "=== opencode/$m
|
|
171
|
+
if [ "$cause" = reseau ] && [ "$network_n" -ge "$NETWORK_RETRIES" ]; then
|
|
172
|
+
echo "=== opencode/$m network down $NETWORK_RETRIES times: next model, no exclusion" >>"$journal"
|
|
175
173
|
cause=autre
|
|
176
174
|
fi
|
|
177
175
|
if [ "$cause" = reseau ]; then
|
|
178
|
-
if
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
if network_wait; then
|
|
177
|
+
network_n=$(( network_n + 1 ))
|
|
178
|
+
resume
|
|
181
179
|
continue
|
|
182
180
|
fi
|
|
183
|
-
echo "===
|
|
181
|
+
echo "=== network unavailable" >>"$journal"
|
|
184
182
|
exit 4
|
|
185
183
|
fi
|
|
186
184
|
if [ "$cause" = autre ]; then
|
|
187
|
-
echo "=== opencode/$m
|
|
185
|
+
echo "=== opencode/$m error, no exclusion: next model" >>"$journal"
|
|
188
186
|
else
|
|
189
|
-
|
|
187
|
+
model_exclude "$m" "$cause"
|
|
190
188
|
modele_demande_ecart "$m" "$cause" "$journal"
|
|
191
|
-
echo "=== opencode/$m
|
|
189
|
+
echo "=== opencode/$m excluded ($(cause_label "$cause"), $(exclusion_label "$cause")): next model" >>"$journal"
|
|
192
190
|
fi
|
|
193
|
-
|
|
191
|
+
resume
|
|
194
192
|
i=$(( i + 1 ))
|
|
195
193
|
continue
|
|
196
194
|
fi
|
|
197
195
|
fi
|
|
198
196
|
if [ "$code" -ne 0 ]; then
|
|
199
|
-
echo "=== opencode/$m
|
|
200
|
-
|
|
197
|
+
echo "=== opencode/$m stopped on error (code $code): next model" >>"$journal"
|
|
198
|
+
resume
|
|
201
199
|
i=$(( i + 1 ))
|
|
202
200
|
continue
|
|
203
201
|
fi
|
|
204
|
-
echo "===
|
|
202
|
+
echo "=== end with opencode/$m (code $code)" >>"$journal"
|
|
205
203
|
exit "$code"
|
|
206
204
|
done
|
|
207
|
-
echo "===
|
|
205
|
+
echo "=== no free model available" >>"$journal"
|
|
208
206
|
exit 3
|
|
209
207
|
}
|
|
210
208
|
case "${1:-}" in
|
|
211
209
|
status) agent_pod_status ;;
|
|
212
|
-
etat) if [ "${2:-}" = "--json" ]; then exec bash "$ICI/agent-etat-json.sh"; else
|
|
210
|
+
etat) if [ "${2:-}" = "--json" ]; then exec bash "$ICI/agent-etat-json.sh"; else agent_state; fi ;;
|
|
213
211
|
liberer)
|
|
214
212
|
[ -n "${2:-}" ] || { agent_aide >&2; exit 2; }
|
|
215
|
-
|
|
213
|
+
exclusion_clear "$2"
|
|
216
214
|
;;
|
|
217
215
|
-h | --help | aide) agent_aide ;;
|
|
218
216
|
"")
|
|
@@ -222,7 +220,7 @@ case "${1:-}" in
|
|
|
222
220
|
*)
|
|
223
221
|
if [ "${1:-}" = "--modele" ]; then [ -n "${2:-}" ] || { agent_aide >&2; exit 2; }; MODELE_LISTE="$2"; shift 2; fi
|
|
224
222
|
if [ "${1:-}" = "--pod" ]; then
|
|
225
|
-
[ -z "$MODELE_LISTE" ] || refuse "--modele
|
|
223
|
+
[ -z "$MODELE_LISTE" ] || refuse "--modele is not supported with --pod"
|
|
226
224
|
shift
|
|
227
225
|
if [ -z "${1:-}" ] || [ -z "${2:-}" ]; then
|
|
228
226
|
agent_aide >&2
|
|
@@ -230,20 +228,20 @@ case "${1:-}" in
|
|
|
230
228
|
fi
|
|
231
229
|
agent_pod_lancer "$1" "$2"
|
|
232
230
|
fi
|
|
233
|
-
|
|
231
|
+
local_mode=0
|
|
234
232
|
if [ "${1:-}" = "--local" ]; then
|
|
235
|
-
|
|
233
|
+
local_mode=1
|
|
236
234
|
shift
|
|
237
235
|
fi
|
|
238
236
|
if [ "$#" -lt 2 ]; then
|
|
239
237
|
agent_aide >&2
|
|
240
238
|
exit 2
|
|
241
239
|
fi
|
|
242
|
-
if [ "$
|
|
240
|
+
if [ "$local_mode" = 0 ] && workspace_available; then
|
|
243
241
|
code=0
|
|
244
242
|
agent_workspace "$1" "$2" || code=$?
|
|
245
243
|
exit "$code"
|
|
246
244
|
fi
|
|
247
|
-
|
|
245
|
+
agent_launch "$1" "$2"
|
|
248
246
|
;;
|
|
249
247
|
esac
|
|
@@ -21,8 +21,8 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
21
21
|
# shellcheck source=SCRIPTDIR/../isolement.sh
|
|
22
22
|
# shellcheck disable=SC1091
|
|
23
23
|
. "$ICI/../isolement.sh"
|
|
24
|
-
# Shared memory check of the services cluster (#608):
|
|
25
|
-
#
|
|
24
|
+
# Shared memory check of the services cluster (#608): quantity_ki and
|
|
25
|
+
# memory_cluster_ki.
|
|
26
26
|
# shellcheck source=SCRIPTDIR/../memoire.sh
|
|
27
27
|
# shellcheck disable=SC1091
|
|
28
28
|
. "$ICI/../memoire.sh"
|
|
@@ -39,7 +39,7 @@ refuse() { echo "devzone : argocd : $*" >&2; exit 2; }
|
|
|
39
39
|
|
|
40
40
|
# Vue regroupée des identifiants : un échec n'empêche jamais l'opération
|
|
41
41
|
regenerer_identifiants() {
|
|
42
|
-
|
|
42
|
+
password_regenerate ||
|
|
43
43
|
echo "devzone : argocd : identifiants regroupés non mis à jour (devzone passwords)" >&2
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ regenerer_identifiants() {
|
|
|
47
47
|
# message indique où agrandir le cluster et la commande à relancer.
|
|
48
48
|
verifier_memoire() {
|
|
49
49
|
local memoire
|
|
50
|
-
if ! memoire="$(
|
|
50
|
+
if ! memoire="$(memory_cluster_ki)"; then
|
|
51
51
|
echo "devzone : argocd : cluster des services injoignable : devzone cluster" >&2
|
|
52
52
|
return 2
|
|
53
53
|
fi
|
|
@@ -190,18 +190,6 @@ ARGOCD_CONF="${DEVZONE_ARGOCD_CONF:-$RACINE/.argocd.conf}"
|
|
|
190
190
|
# shellcheck disable=SC1091
|
|
191
191
|
. "$ICI/apps.sh"
|
|
192
192
|
argocd_kubectl() { kubectl --context devzone "$@"; }
|
|
193
|
-
# English command names are accepted (#557) : a copied script may miss the file
|
|
194
|
-
# shellcheck source=SCRIPTDIR/../command-aliases.sh
|
|
195
|
-
# shellcheck disable=SC1091
|
|
196
|
-
if [ -f "$ICI/../command-aliases.sh" ]; then
|
|
197
|
-
. "$ICI/../command-aliases.sh"
|
|
198
|
-
fi
|
|
199
|
-
# Subcommand and options become their canonical English names ; the old
|
|
200
|
-
# French names warn on use (#557)
|
|
201
|
-
if command -v canonical_args >/dev/null 2>&1; then
|
|
202
|
-
canonical_args argocd "$@"
|
|
203
|
-
set -- "${ARGS_CANONICAL[@]+"${ARGS_CANONICAL[@]}"}"
|
|
204
|
-
fi
|
|
205
193
|
|
|
206
194
|
case "${1:-}" in
|
|
207
195
|
install) installer ;;
|
|
@@ -60,7 +60,7 @@ app_secret() {
|
|
|
60
60
|
|
|
61
61
|
# Vue regroupée des identifiants : un échec n'empêche jamais l'opération
|
|
62
62
|
regenerer_identifiants() {
|
|
63
|
-
|
|
63
|
+
password_regenerate ||
|
|
64
64
|
echo "devzone : catalogue : identifiants regroupés non mis à jour (devzone passwords)" >&2
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -54,8 +54,8 @@ tour() {
|
|
|
54
54
|
[ -f "$ETAT" ] || return 0
|
|
55
55
|
# État restauré ou reconstruit : le veilleur ne suit pas un état douteux,
|
|
56
56
|
# et ne désinstalle jamais tant que devzone apply ne l'a pas confirmé
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
state_recovery_wait && return 0
|
|
58
|
+
state_recovery_pending && return 0
|
|
59
59
|
mkdir -p "$BASE"
|
|
60
60
|
maintenant="$(stat -c %Y "$ETAT" 2>/dev/null || stat -f %m "$ETAT" 2>/dev/null || true)"
|
|
61
61
|
[ -n "$maintenant" ] || return 0
|
|
@@ -23,18 +23,6 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
23
23
|
# shellcheck source=SCRIPTDIR/../../argocd/catalogue-argocd.sh
|
|
24
24
|
# shellcheck disable=SC1091
|
|
25
25
|
. "$ICI/../../argocd/catalogue-argocd.sh"
|
|
26
|
-
# English command names are accepted (#557) : a copied script may miss the file
|
|
27
|
-
# shellcheck source=SCRIPTDIR/../../command-aliases.sh
|
|
28
|
-
# shellcheck disable=SC1091
|
|
29
|
-
if [ -f "$ICI/../../command-aliases.sh" ]; then
|
|
30
|
-
. "$ICI/../../command-aliases.sh"
|
|
31
|
-
fi
|
|
32
|
-
# Subcommand and options become their canonical English names ; the old
|
|
33
|
-
# French names warn on use (#557)
|
|
34
|
-
if command -v canonical_args >/dev/null 2>&1; then
|
|
35
|
-
canonical_args mysql "$@"
|
|
36
|
-
set -- "${ARGS_CANONICAL[@]+"${ARGS_CANONICAL[@]}"}"
|
|
37
|
-
fi
|
|
38
26
|
NS=devzone-mysql
|
|
39
27
|
SECRETS="$RACINE/workspace/.mysql"
|
|
40
28
|
MYSQL_PORT="${MYSQL_PORT:-3306}"
|
|
@@ -48,7 +36,7 @@ refuse() { echo "devzone : catalogue mysql : $*" >&2; exit 2; }
|
|
|
48
36
|
services_secret_mysql() { mysql_secret; }
|
|
49
37
|
# Régénère la vue .password (échec non bloquant)
|
|
50
38
|
regenerer_identifiants() {
|
|
51
|
-
|
|
39
|
+
password_regenerate ||
|
|
52
40
|
echo "devzone : catalogue mysql : identifiants regroupés non mis à jour (devzone passwords)" >&2
|
|
53
41
|
}
|
|
54
42
|
# Raccourci kubectl dans le namespace devzone-mysql
|
|
@@ -24,18 +24,6 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
|
24
24
|
# shellcheck source=SCRIPTDIR/catalogue/app.sh
|
|
25
25
|
# shellcheck disable=SC1091
|
|
26
26
|
. "$ICI/catalogue/app.sh"
|
|
27
|
-
# English command names are accepted (#557) : a copied script may miss the file
|
|
28
|
-
# shellcheck source=SCRIPTDIR/command-aliases.sh
|
|
29
|
-
# shellcheck disable=SC1091
|
|
30
|
-
if [ -f "$ICI/command-aliases.sh" ]; then
|
|
31
|
-
. "$ICI/command-aliases.sh"
|
|
32
|
-
fi
|
|
33
|
-
# Subcommand and options become their canonical English names ; the old
|
|
34
|
-
# French names warn on use (#557)
|
|
35
|
-
if command -v canonical_args >/dev/null 2>&1; then
|
|
36
|
-
canonical_args catalog "$@"
|
|
37
|
-
set -- "${ARGS_CANONICAL[@]+"${ARGS_CANONICAL[@]}"}"
|
|
38
|
-
fi
|
|
39
27
|
|
|
40
28
|
refuse() { echo "devzone : catalogue : $*" >&2; exit 2; }
|
|
41
29
|
|
|
@@ -111,9 +99,9 @@ catalogue_synchroniser() (
|
|
|
111
99
|
local app entete manque="" tmp
|
|
112
100
|
[ -f "$ETAT" ] || return 0
|
|
113
101
|
entete="# Applications du catalogue : passer à on pour installer (devzone catalog)"
|
|
114
|
-
|
|
102
|
+
state_lock_take || return 1
|
|
115
103
|
# Le verrou est rendu à la sortie, y compris sur une erreur sous set -e
|
|
116
|
-
trap '
|
|
104
|
+
trap 'state_lock_release' EXIT
|
|
117
105
|
while IFS= read -r app; do
|
|
118
106
|
[ -n "$app" ] || continue
|
|
119
107
|
grep -qE "^${app}=" "$ETAT" 2>/dev/null && continue
|
|
@@ -126,7 +114,7 @@ catalogue_synchroniser() (
|
|
|
126
114
|
grep -qF "$entete" "$ETAT" || echo "$entete"
|
|
127
115
|
echo "$manque"
|
|
128
116
|
} >"$tmp"
|
|
129
|
-
|
|
117
|
+
state_replace "$tmp"
|
|
130
118
|
rm -f "$tmp"
|
|
131
119
|
)
|
|
132
120
|
|
|
@@ -169,7 +157,7 @@ app_relais_arrete() {
|
|
|
169
157
|
fi
|
|
170
158
|
script="$ICI/catalogue/$app/$app.sh"
|
|
171
159
|
if [ -f "$script" ]; then
|
|
172
|
-
etat="$(bash "$script"
|
|
160
|
+
etat="$(bash "$script" status 2>/dev/null || true)"
|
|
173
161
|
case "$etat" in *"relais arrêté"*) return 0 ;; esac
|
|
174
162
|
fi
|
|
175
163
|
! relais_actif "$app"
|