devzone 0.14.1 → 0.14.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# À chaque démarrage, dans l'ordre : identité git (déduite du compte gh),
|
|
3
|
-
# clusters Kubernetes,
|
|
3
|
+
# clusters Kubernetes, nom gitlab.localhost si le module gitlab est actif,
|
|
4
|
+
# puis récapitulatif de ce qui reste à faire (devzone).
|
|
4
5
|
# Séquentiel : le récapitulatif voit l'identité tout juste posée ; l'échec
|
|
5
6
|
# d'une étape n'empêche pas les suivantes.
|
|
6
7
|
# Jamais de question (gh, kubectl et ses plugins d'authentification) : sortie
|
|
@@ -9,5 +10,11 @@ exec </dev/null
|
|
|
9
10
|
ICI="$(dirname "$0")"
|
|
10
11
|
bash "$ICI/git-identite.sh" || echo "démarrage : identité git non traitée (bash $ICI/git-identite.sh)"
|
|
11
12
|
bash "$ICI/kube-config.sh" || echo "démarrage : clusters non traités (bash $ICI/kube-config.sh)"
|
|
13
|
+
# Module gitlab actif : /etc/hosts est un montage Docker régénéré à chaque
|
|
14
|
+
# démarrage, gitlab.localhost doit être re-pose (ssh, glab et getent passent
|
|
15
|
+
# par le résolveur système) ; hote-poser n'échoue jamais (avertissement seul)
|
|
16
|
+
if bash "$ICI/devzone" actif gitlab; then
|
|
17
|
+
bash "$ICI/gitlab/gitlab.sh" hote-poser || echo "démarrage : nom gitlab.localhost non posé (bash $ICI/gitlab/gitlab.sh hote-poser)"
|
|
18
|
+
fi
|
|
12
19
|
echo
|
|
13
20
|
bash "$ICI/devzone"
|
package/.devcontainer/devzone
CHANGED
|
@@ -312,6 +312,8 @@ appliquer_gitlab() {
|
|
|
312
312
|
etat_courant="$(bash "$ICI/gitlab/gitlab.sh" etat)"
|
|
313
313
|
if [[ "$etat_courant" == *"prêt"* && "$etat_courant" == *"runner en ligne"* ]]; then
|
|
314
314
|
echo "devzone : gitlab déjà actif, rien à faire."
|
|
315
|
+
# /etc/hosts régénéré par Docker : gitlab.localhost re-pose ici aussi
|
|
316
|
+
bash "$ICI/gitlab/gitlab.sh" hote-poser
|
|
315
317
|
else
|
|
316
318
|
echo "devzone : gitlab activation via installer…"
|
|
317
319
|
if ! bash "$ICI/gitlab/gitlab.sh" installer; then
|
|
@@ -17,6 +17,11 @@ GITLAB_ATTENTE="${GITLAB_ATTENTE:-1200}"
|
|
|
17
17
|
# Secrets stockés dans $RACINE/workspace/.gitlab/ (chmod 600), jamais affichés.
|
|
18
18
|
GITLAB_SECRETS_DIR="$RACINE/workspace/.gitlab"
|
|
19
19
|
|
|
20
|
+
# ---- /etc/hosts du conteneur ----
|
|
21
|
+
# DEVZONE_HOSTS pour les tests (jamais le /etc/hosts réel)
|
|
22
|
+
HOSTS="${DEVZONE_HOSTS:-/etc/hosts}"
|
|
23
|
+
GITLAB_HOTE_MARQUE="# devzone:gitlab"
|
|
24
|
+
|
|
20
25
|
# ---- Helper : vérifier la RAM libre (refus < 8 Go) ----
|
|
21
26
|
gitlab_verifier_ram() {
|
|
22
27
|
local ram_kb
|
|
@@ -174,6 +179,48 @@ gitlab_seed() {
|
|
|
174
179
|
echo "✔ Seed GitLab terminé."
|
|
175
180
|
}
|
|
176
181
|
|
|
182
|
+
# ---- hote-poser / hote-retirer : gitlab.localhost dans /etc/hosts ----
|
|
183
|
+
# Pourquoi : ssh (clone ssh://git@gitlab.localhost:2224/…), glab et getent
|
|
184
|
+
# passent par le résolveur système, qui ne connaît pas gitlab.localhost ;
|
|
185
|
+
# seul curl résout les noms en .localhost lui-même. /etc/hosts est un
|
|
186
|
+
# montage Docker que Docker régénère au démarrage du conteneur, d'où le
|
|
187
|
+
# re-pose à chaque démarrage (demarrage.sh) et à chaque activation.
|
|
188
|
+
# Jamais de sed -i ni de mv : le montage ne peut pas être renommé
|
|
189
|
+
# (l'écriture en place seulement) ; directe si le fichier est inscriptible,
|
|
190
|
+
# sinon sudo -n. Un échec n'échoue jamais : avertissement sur stderr et
|
|
191
|
+
# code 0, pour ne pas faire échouer l'installation pour un nom d'hôte.
|
|
192
|
+
gitlab_hote_poser() {
|
|
193
|
+
# Déjà posée : rien (idempotent)
|
|
194
|
+
if grep -q "$GITLAB_HOTE_MARQUE" "$HOSTS" 2>/dev/null; then
|
|
195
|
+
return 0
|
|
196
|
+
fi
|
|
197
|
+
if [ -w "$HOSTS" ]; then
|
|
198
|
+
printf '127.0.0.1\tgitlab.localhost %s\n' "$GITLAB_HOTE_MARQUE" >>"$HOSTS" 2>/dev/null ||
|
|
199
|
+
echo "devzone : gitlab : nom gitlab.localhost non posé dans $HOSTS (droits d'écriture insuffisants)" >&2
|
|
200
|
+
elif ! printf '127.0.0.1\tgitlab.localhost %s\n' "$GITLAB_HOTE_MARQUE" | sudo -n tee -a "$HOSTS" >/dev/null 2>&1; then
|
|
201
|
+
echo "devzone : gitlab : nom gitlab.localhost non posé dans $HOSTS (sudo -n indisponible ou refusé)" >&2
|
|
202
|
+
fi
|
|
203
|
+
return 0
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
gitlab_hote_retirer() {
|
|
207
|
+
# Aucune ligne repérée : rien (y compris fichier illisible)
|
|
208
|
+
if ! grep -q "$GITLAB_HOTE_MARQUE" "$HOSTS" 2>/dev/null; then
|
|
209
|
+
return 0
|
|
210
|
+
fi
|
|
211
|
+
local tmp
|
|
212
|
+
tmp="$(mktemp)"
|
|
213
|
+
grep -v "$GITLAB_HOTE_MARQUE" "$HOSTS" >"$tmp" 2>/dev/null || true
|
|
214
|
+
if [ -w "$HOSTS" ]; then
|
|
215
|
+
cp "$tmp" "$HOSTS" 2>/dev/null ||
|
|
216
|
+
echo "devzone : gitlab : ligne gitlab.localhost non retirée de $HOSTS (droits d'écriture insuffisants)" >&2
|
|
217
|
+
elif ! sudo -n cp "$tmp" "$HOSTS" >/dev/null 2>&1; then
|
|
218
|
+
echo "devzone : gitlab : ligne gitlab.localhost non retirée de $HOSTS (sudo -n indisponible ou refusé)" >&2
|
|
219
|
+
fi
|
|
220
|
+
rm -f "$tmp"
|
|
221
|
+
return 0
|
|
222
|
+
}
|
|
223
|
+
|
|
177
224
|
# ---- installer : installer GitLab dans kind ----
|
|
178
225
|
gitlab_installer() {
|
|
179
226
|
# RAM libre (refus < 8 Go) : seulement avant de créer le cluster ; une
|
|
@@ -228,6 +275,10 @@ gitlab_installer() {
|
|
|
228
275
|
--timeout "${GITLAB_ATTENTE}s" \
|
|
229
276
|
--wait
|
|
230
277
|
|
|
278
|
+
# Nom gitlab.localhost dans /etc/hosts avant l'attente : ssh, glab et
|
|
279
|
+
# getent en ont besoin dès que le service monte (curl, lui, résout seul)
|
|
280
|
+
gitlab_hote_poser
|
|
281
|
+
|
|
231
282
|
# Attendre que GitLab soit prêt
|
|
232
283
|
gitlab_attendre_pret
|
|
233
284
|
|
|
@@ -282,6 +333,9 @@ gitlab_desinstaller() {
|
|
|
282
333
|
# Supprimer $RACINE/workspace/.gitlab/
|
|
283
334
|
rm -rf "$GITLAB_SECRETS_DIR"
|
|
284
335
|
|
|
336
|
+
# Nom gitlab.localhost retiré : la configuration suit le service
|
|
337
|
+
gitlab_hote_retirer
|
|
338
|
+
|
|
285
339
|
echo "✔ GitLab désinstallé."
|
|
286
340
|
}
|
|
287
341
|
|
|
@@ -315,11 +369,13 @@ gitlab_etat() {
|
|
|
315
369
|
|
|
316
370
|
# Gestion des sous-commandes
|
|
317
371
|
case "${1:-}" in
|
|
318
|
-
installer)
|
|
372
|
+
installer) gitlab_installer ;;
|
|
319
373
|
desinstaller) gitlab_desinstaller ;;
|
|
320
|
-
etat)
|
|
321
|
-
seed)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
374
|
+
etat) gitlab_etat ;;
|
|
375
|
+
seed) gitlab_seed ;;
|
|
376
|
+
hote-poser) gitlab_hote_poser ;;
|
|
377
|
+
hote-retirer) gitlab_hote_retirer ;;
|
|
378
|
+
*) echo "devzone : commande inconnue : ${1:-} (devzone gitlab --help)" >&2
|
|
379
|
+
exit 1
|
|
380
|
+
;;
|
|
325
381
|
esac
|
package/package.json
CHANGED