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,73 +1,72 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: devzone
|
|
3
|
-
description:
|
|
3
|
+
description: Use to work in a devzone container — modules and catalog, devzone agent, worktrees, guard.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<!-- devzone : skill
|
|
6
|
+
<!-- devzone : skill set by devzone enable ia -->
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# devzone skill (AI assistants)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
This skill is for Claude Code (lead) and opencode (developer) in a devzone container. It is set by `devzone enable ia` in `~/.claude/skills/devzone/` and `~/.config/opencode/skills/devzone/` (volumes, kept across rebuilds). To customize it without it being replaced, remove the marker line above.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Golden rule
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Everything is done in the container, with the `devzone` commands, never by running the scripts of `.devcontainer/` by hand.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
In bats tests, only use fake tools in a temporary `bin` folder: never a real system script (`devzone`, `kubectl`, `helm`…) under bats.
|
|
17
17
|
|
|
18
18
|
## Worktrees
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Projects live in `workspace/`; ticket worktrees under `workspace/wt/`. A worktree is created and removed **in the container** (`git worktree add` / `git worktree remove`). Never `git worktree prune` from the host, nor a host tool (VS Code, GitHub Desktop). A worktree created on the workstation has an absolute path that the container cannot see: manage it on the side that created it.
|
|
21
21
|
|
|
22
|
-
## Modules
|
|
22
|
+
## Modules and catalog
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Modules are disabled by default, enabled on demand, without a rebuild:
|
|
25
25
|
|
|
26
|
-
- `devzone enable ia
|
|
27
|
-
- `devzone disable ia
|
|
28
|
-
- `devzone enable kubernetes
|
|
29
|
-
- `devzone enable gitlab
|
|
30
|
-
- `devzone enable postgres
|
|
31
|
-
- `devzone enable mysql
|
|
32
|
-
- `devzone enable argocd
|
|
33
|
-
- `devzone disable
|
|
34
|
-
- `devzone
|
|
35
|
-
- `devzone
|
|
36
|
-
- `devzone
|
|
37
|
-
- `devzone status --json` : récapitulatif complet en JSON, pour les outils (aucun secret, commande à lancer par point à traiter).
|
|
26
|
+
- `devzone enable ia`: Claude Code and opencode (pinned versions), repowarden guard, default opencode configuration. Then log in: `claude` (then `/login`), `opencode auth login`.
|
|
27
|
+
- `devzone disable ia`: uninstalls the assistants; removes the guard and the default opencode configuration; keeps the state of `devzone agent`, the logs `workspace/.agents/` and the logins.
|
|
28
|
+
- `devzone enable kubernetes`: connects to the machine's cluster at each startup and installs metrics-server on local clusters.
|
|
29
|
+
- `devzone enable gitlab`: installs a test GitLab in the services cluster (namespace `devzone-gitlab*`).
|
|
30
|
+
- `devzone enable postgres`: shared PostgreSQL, one database per project (`devzone postgres create <project>`).
|
|
31
|
+
- `devzone enable mysql`: shared MySQL of the catalog, one database per project.
|
|
32
|
+
- `devzone enable argocd`: Argo CD of the services cluster, interface in the container at https://127.0.0.1:8443.
|
|
33
|
+
- `devzone disable <module>`: disables and applies at once.
|
|
34
|
+
- `devzone apply`: installs what is active.
|
|
35
|
+
- `devzone repair`: relaunches gitlab, postgres, mysql, argocd, labelled ports and the catalog watcher.
|
|
36
|
+
- `devzone status --json`: full summary in JSON, for tools (no secret; the `command` field of each item gives the command to run).
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
The application catalog is consulted with `devzone catalog`; a watcher applies the changes of `.devzone.modules` on the fly, and `devzone repair` relaunches it. MySQL is driven with `devzone mysql create <project>`, `devzone mysql list`, `devzone mysql delete <project>`, `devzone mysql volume [<name>|--delete <name>]` and `devzone mysql delete-data` (data kept by default).
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
The choice is specific to each devzone, kept in `.devzone.modules` of the devzone folder.
|
|
42
41
|
|
|
43
|
-
##
|
|
42
|
+
## Directing opencode (devzone agent)
|
|
44
43
|
|
|
45
|
-
`devzone agent <
|
|
46
|
-
- `devzone agent etat
|
|
47
|
-
- `devzone agent liberer <
|
|
44
|
+
`devzone agent <folder> <instruction-file>` directs opencode on an instruction, in the foreground or in parallel (`&`, one per ticket and per worktree).
|
|
45
|
+
- `devzone agent etat`: sessions, discarded models and their cause.
|
|
46
|
+
- `devzone agent liberer <model>|--tous`: lifts a model discard.
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
The log is `workspace/.agents/<folder>.log`. `--auto` avoids waiting for a permission; `< /dev/null` avoids a silent session.
|
|
50
49
|
|
|
51
|
-
##
|
|
50
|
+
## Guard and protected files
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
With `ia` active, the repowarden guard is plugged in for Claude Code and opencode: the agent is stopped before modifying `main`/`develop`, committing without `repowarden cc` or bypassing the hooks. `repowarden cc -m "…"` to commit.
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
Protected rights files (never written by an agent, fixed list, no variable changes it): `.devcontainer/opencode/agent.json`, `.devcontainer/opencode.jsonc`, `.repowarden.conf`, `.devcontainer/agent-rights.sh`. An agent that touches them is refused and the change is reverted in the tree.
|
|
56
55
|
|
|
57
|
-
## Kubernetes
|
|
56
|
+
## Kubernetes only
|
|
58
57
|
|
|
59
|
-
devzone
|
|
58
|
+
devzone is described with **the cluster**, **the pod** and **the nodes**; never "Docker" to describe devzone. Only **pods** are containers.
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
For a disposable test, create a disposable **pod** or **namespace** (`kubectl run`, `kubectl create ns`), then delete it. Do not run `docker`.
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
A guard stops agents that run `docker` or `docker-compose`; `DEVZONE_ALLOW_DOCKER=1` is reserved for an action on the **host** itself, never on the cluster.
|
|
64
63
|
|
|
65
|
-
##
|
|
64
|
+
## Kubernetes services and workspace
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
The services (PostgreSQL, MySQL, GitLab, Argo CD) live on the **devzone services cluster**, chosen once (`devzone cluster CTX`) and kept in the state. The kubectl `devzone` context is set on this cluster. Services namespaces: `devzone-*`. `devzone cluster` shows the cluster and the possible ones, `devzone clusters` gives the work/services view; the active `kubernetes` module connects to the machine's cluster and installs metrics-server at startup.
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
The development workstation can run in the cluster: `devzone workspace start|stop|status|shell|vscode|copy-to <folder>|copy-from <folder>` drives the Kubernetes workspace (run from the workstation).
|
|
70
69
|
|
|
71
|
-
##
|
|
70
|
+
## What falls to the maintainer
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
The developer (opencode) codes, tests and commits with `repowarden cc`; the lead (Claude Code) reviews, pushes, does the real test, follows CI and can move a PR to ready when all its jobs are green. Logins (GitHub, Claude Code, opencode), ticket validation, deployment approvals and release launches remain with the maintainer. The “repowarden” skill is already placed by `repowarden agents init`: just check that it is present.
|
package/.devcontainer/startup.sh
CHANGED
|
@@ -1,66 +1,65 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
# invisible derrière make, une attente bloquerait (voir post-create.sh)
|
|
2
|
+
# At each startup, in order: git identity (deduced from the gh account),
|
|
3
|
+
# Kubernetes clusters, gitlab.localhost name and 8929/2224
|
|
4
|
+
# relay of the gitlab module if enabled, relays of the postgres and argocd
|
|
5
|
+
# modules if enabled, port relays to the workstation, grouped credentials
|
|
6
|
+
# (.password), then the summary of what remains to be done (devzone).
|
|
7
|
+
# Sequential: the summary sees the identity just set; the failure of one step
|
|
8
|
+
# does not prevent the following ones.
|
|
9
|
+
# Never a question (gh, kubectl and its authentication plugins): output hidden
|
|
10
|
+
# behind make, a wait would block (see post-create.sh)
|
|
12
11
|
exec </dev/null
|
|
13
12
|
ICI="$(dirname "$0")"
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
bash "$ICI/git-
|
|
18
|
-
bash "$ICI/kube-config.sh" || echo "
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
bash "$ICI/kube-account.sh" jeton || echo "
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
13
|
+
# Former French names renamed first (#733): the packages check below reads the
|
|
14
|
+
# English names
|
|
15
|
+
bash "$ICI/rename-legacy-files.sh" || echo "startup : legacy names not renamed (devzone repair)"
|
|
16
|
+
bash "$ICI/git-identity.sh" || echo "startup : git identity not handled (devzone start)"
|
|
17
|
+
bash "$ICI/kube-config.sh" || echo "startup : clusters not handled (devzone start)"
|
|
18
|
+
# Token of the limited Kubernetes account (#430): 24 h, renewed at each
|
|
19
|
+
# startup; account set up on the way if missing. Without a chosen services
|
|
20
|
+
# cluster, nothing to do
|
|
21
|
+
bash "$ICI/kube-account.sh" jeton || echo "startup : kubernetes account token not renewed (devzone repair)"
|
|
22
|
+
# gitlab module enabled: /etc/hosts is a Docker mount regenerated at each
|
|
23
|
+
# startup, gitlab.localhost must be set again (ssh, glab and getent go through
|
|
24
|
+
# the system resolver); hote-poser never fails (warning only)
|
|
26
25
|
if bash "$ICI/devzone" is-enabled gitlab; then
|
|
27
|
-
bash "$ICI/gitlab/gitlab.sh" hote-poser || echo "
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
bash "$ICI/gitlab/gitlab.sh" relay-start || echo "
|
|
26
|
+
bash "$ICI/gitlab/gitlab.sh" hote-poser || echo "startup : gitlab.localhost name not set (devzone repair)"
|
|
27
|
+
# TCP relay 8929/2224: curl and git over HTTP go through the local loop for
|
|
28
|
+
# *.localhost, the relay must be restarted after each startup
|
|
29
|
+
bash "$ICI/gitlab/gitlab.sh" relay-start || echo "startup : gitlab relay not started (devzone repair)"
|
|
31
30
|
fi
|
|
32
|
-
#
|
|
33
|
-
#
|
|
31
|
+
# postgres module enabled: the relay (port-forward to 127.0.0.1:5432) does not
|
|
32
|
+
# survive the container stop, restarted here after the clusters
|
|
34
33
|
if bash "$ICI/devzone" is-enabled postgres; then
|
|
35
|
-
bash "$ICI/postgres/postgres.sh" relay-start || echo "
|
|
34
|
+
bash "$ICI/postgres/postgres.sh" relay-start || echo "startup : postgres relay not started (devzone repair)"
|
|
36
35
|
fi
|
|
37
|
-
#
|
|
38
|
-
#
|
|
36
|
+
# argocd module enabled: relay (port-forward to 127.0.0.1:8443), restarted
|
|
37
|
+
# after the clusters like the one of postgres
|
|
39
38
|
if bash "$ICI/devzone" is-enabled argocd; then
|
|
40
|
-
bash "$ICI/argocd/argocd.sh" relay-start || echo "
|
|
39
|
+
bash "$ICI/argocd/argocd.sh" relay-start || echo "startup : argocd relay not started (devzone repair)"
|
|
41
40
|
fi
|
|
42
|
-
#
|
|
43
|
-
# postgres
|
|
41
|
+
# mysql module enabled: the relay 127.0.0.1:3306, restarted like the one of
|
|
42
|
+
# postgres after each startup
|
|
44
43
|
if bash "$ICI/devzone" is-enabled mysql; then
|
|
45
|
-
bash "$ICI/catalog/mysql/mysql.sh" relay-start || echo "
|
|
44
|
+
bash "$ICI/catalog/mysql/mysql.sh" relay-start || echo "startup : mysql relay not started (devzone repair)"
|
|
46
45
|
fi
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
bash "$ICI/ports.sh" restart || echo "
|
|
50
|
-
#
|
|
51
|
-
# instance
|
|
46
|
+
# Port relays to the workstation (#290): the container IP changes at each
|
|
47
|
+
# startup, each relay of the state is recreated; a failure prevents nothing
|
|
48
|
+
bash "$ICI/ports.sh" restart || echo "startup : port relays not restarted (devzone repair)"
|
|
49
|
+
# Automatic port watcher to the workstation (#394, guard #293): a single
|
|
50
|
+
# instance in the background, real context set for this call only.
|
|
52
51
|
# Kubernetes workspace (#517): no watcher, ports go through devzone workspace ports
|
|
53
52
|
if [ "${DEVZONE_WORKSPACE:-}" != kubernetes ]; then
|
|
54
|
-
|
|
53
|
+
DEVZONE_PORTS_AUTO_REAL=yes bash "$ICI/ports-auto.sh" demarrer >/dev/null 2>&1 || echo "startup : auto ports watcher not started (devzone repair)"
|
|
55
54
|
fi
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
bash "$ICI/catalog.sh" sync || echo "
|
|
59
|
-
#
|
|
60
|
-
|
|
55
|
+
# Application catalog: one <app>=off line per absent application, written
|
|
56
|
+
# once, never an existing line modified (#414)
|
|
57
|
+
bash "$ICI/catalog.sh" sync || echo "startup : catalog not synchronized (devzone repair)"
|
|
58
|
+
# Catalog watcher: applies again on the fly as soon as .devzone.modules changes
|
|
59
|
+
DEVZONE_CATALOG_REAL=yes bash "$ICI/catalog/catalog-watcher.sh" demarrer >/dev/null 2>&1 || echo "startup : catalog watcher not started (devzone repair)"
|
|
61
60
|
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
bash "$ICI/password.sh" regenerer || echo "
|
|
61
|
+
# Grouped view of the credentials (#332), regenerated at each startup; a failure
|
|
62
|
+
# prevents nothing and the content is never displayed
|
|
63
|
+
bash "$ICI/password.sh" regenerer || echo "startup : grouped credentials not updated (devzone repair)"
|
|
65
64
|
echo
|
|
66
65
|
bash "$ICI/devzone"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# The pod has no kubeconfig and its service account cannot read Applications
|
|
4
4
|
# today: one short read of the root Application tells whether Argo CD manages
|
|
5
5
|
# the cluster from Git; a refusal or an absence falls back to the workstation
|
|
6
|
-
# state. Sourced by devzone, called only when
|
|
6
|
+
# state. Sourced by devzone, called only when in_pod is true.
|
|
7
7
|
|
|
8
8
|
# Namespace of the Argo CD of devzone: GITOPS_NS when the includer knows it
|
|
9
9
|
# (argocd/gitops.sh), otherwise the namespace of the module.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Machine output of devzone status (--json): stable, versioned JSON object.
|
|
3
|
-
# Sourced by devzone: reuses its functions (
|
|
4
|
-
# rewrite etat(). Built only with jq. JSON keys are a contract:
|
|
3
|
+
# Sourced by devzone: reuses its functions (value_of, description, …), does not
|
|
4
|
+
# rewrite etat(). Built only with jq. JSON keys are a contract: English names
|
|
5
|
+
# (#733), listed in manage/docs/reference.md.
|
|
5
6
|
|
|
6
7
|
# Adds an entry to $errors: the section that failed and why.
|
|
7
8
|
add_error() {
|
|
@@ -15,7 +16,7 @@ append_alert() {
|
|
|
15
16
|
--arg code "$code" \
|
|
16
17
|
--arg message "$message" \
|
|
17
18
|
--arg command "$command" \
|
|
18
|
-
'. + [{code:$code,message:$message,
|
|
19
|
+
'. + [{code:$code,message:$message,command:(if $command=="" then null else $command end)}]' \
|
|
19
20
|
<<<"$alerts_json")"
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -29,7 +30,6 @@ state_json() {
|
|
|
29
30
|
local platform_name platform_url="" github_json="null"
|
|
30
31
|
local tools_late_json='[]' tools_command=""
|
|
31
32
|
local modules_json='[]' m active desc failure_file content state_value failure_value command_value out argocd_repo=""
|
|
32
|
-
local docker_host=false docker_host_active=false relay_source
|
|
33
33
|
local services_cluster="" services_remote=false
|
|
34
34
|
local work_ctx="" work_internal=false host_ctx=""
|
|
35
35
|
local clusters_services_raw="" clusters_work_raw="" clusters_command=""
|
|
@@ -37,15 +37,15 @@ state_json() {
|
|
|
37
37
|
local applications_json='[]'
|
|
38
38
|
local credentials_raw=""
|
|
39
39
|
local late_out package frozen installed count
|
|
40
|
-
local
|
|
40
|
+
local packages_marker packages_names n path wt_out
|
|
41
41
|
local gh_status gh_code
|
|
42
42
|
|
|
43
|
-
if v="$(
|
|
43
|
+
if v="$(folder_version 2>/dev/null)"; then
|
|
44
44
|
dv_raw="$v"
|
|
45
45
|
else
|
|
46
|
-
add_error devzone "
|
|
46
|
+
add_error devzone "folder_version unavailable"
|
|
47
47
|
fi
|
|
48
|
-
dvp_raw="$(
|
|
48
|
+
dvp_raw="$(published_version 2>/dev/null || true)"
|
|
49
49
|
|
|
50
50
|
id_name="$(git config --get user.name 2>/dev/null || true)"
|
|
51
51
|
id_email="$(git config --get user.email 2>/dev/null || true)"
|
|
@@ -55,9 +55,9 @@ state_json() {
|
|
|
55
55
|
id_command='gh auth login -s workflow (automatic), or git config --file ~/.config/git/config user.name "<name>" and user.email "<email>"'
|
|
56
56
|
fi
|
|
57
57
|
|
|
58
|
-
platform_name="$(
|
|
58
|
+
platform_name="$(platform_read)"
|
|
59
59
|
if [ "$platform_name" = gitlab ]; then
|
|
60
|
-
platform_url="$(
|
|
60
|
+
platform_url="$(gitlab_url_read)"
|
|
61
61
|
else
|
|
62
62
|
platform_url=""
|
|
63
63
|
fi
|
|
@@ -68,16 +68,16 @@ state_json() {
|
|
|
68
68
|
add_error github "gh auth status failed"
|
|
69
69
|
else
|
|
70
70
|
if printf '%s\n' "$gh_status" | grep -q "Token scopes:" && ! printf '%s\n' "$gh_status" | grep -q "'workflow'"; then
|
|
71
|
-
github_json="$(jq -cn '{
|
|
71
|
+
github_json="$(jq -cn '{connected:true,workflow:false,command:"gh auth refresh -h github.com -s workflow"}')"
|
|
72
72
|
else
|
|
73
|
-
github_json="$(jq -cn '{
|
|
73
|
+
github_json="$(jq -cn '{connected:true,workflow:true,command:null}')"
|
|
74
74
|
fi
|
|
75
75
|
fi
|
|
76
76
|
else
|
|
77
77
|
github_json="null"
|
|
78
78
|
fi
|
|
79
79
|
|
|
80
|
-
if late_out="$(
|
|
80
|
+
if late_out="$(outdated_tools 2>/dev/null)"; then
|
|
81
81
|
tools_late_json='[]'
|
|
82
82
|
while IFS= read -r line; do
|
|
83
83
|
[ -n "$line" ] || continue
|
|
@@ -87,7 +87,7 @@ state_json() {
|
|
|
87
87
|
[ -n "$package" ] || continue
|
|
88
88
|
tools_late_json="$(jq -c \
|
|
89
89
|
--arg p "$package" --arg f "$frozen" --arg i "$installed" \
|
|
90
|
-
'. + [{
|
|
90
|
+
'. + [{package:$p,frozen:$f,installed:$i}]' <<<"$tools_late_json")"
|
|
91
91
|
done <<<"$late_out"
|
|
92
92
|
count="$(jq 'length' <<<"$tools_late_json" 2>/dev/null || echo 0)"
|
|
93
93
|
if [ "$count" -gt 0 ]; then
|
|
@@ -95,18 +95,18 @@ state_json() {
|
|
|
95
95
|
fi
|
|
96
96
|
else
|
|
97
97
|
tools_late_json="null"
|
|
98
|
-
add_error
|
|
98
|
+
add_error tools "outdated_tools unavailable"
|
|
99
99
|
fi
|
|
100
100
|
|
|
101
101
|
modules_json='[]'
|
|
102
102
|
for m in "${MODULES[@]}"; do
|
|
103
103
|
active=false
|
|
104
|
-
[ "$(
|
|
104
|
+
[ "$(value_of "$m")" = on ] && active=true
|
|
105
105
|
desc="$(description "$m")"
|
|
106
106
|
failure_value=""
|
|
107
107
|
state_value=""
|
|
108
108
|
command_value=""
|
|
109
|
-
if
|
|
109
|
+
if in_pod && service_module "$m"; then
|
|
110
110
|
# Kubernetes workspace pod (#528): presence by the cluster DNS,
|
|
111
111
|
# installation from the workstation; no failure marker read here
|
|
112
112
|
if service_present "$m"; then
|
|
@@ -119,7 +119,7 @@ state_json() {
|
|
|
119
119
|
command_value="devzone workspace services enable $m"
|
|
120
120
|
fi
|
|
121
121
|
elif [ "$active" = true ]; then
|
|
122
|
-
failure_file="$(
|
|
122
|
+
failure_file="$(failure_marker_file "$m")"
|
|
123
123
|
if [ -f "$failure_file" ]; then
|
|
124
124
|
content="$(cat "$failure_file" 2>/dev/null || true)"
|
|
125
125
|
failure_value="$content"
|
|
@@ -167,37 +167,20 @@ state_json() {
|
|
|
167
167
|
--arg state "$state_value" \
|
|
168
168
|
--arg failure "$failure_value" \
|
|
169
169
|
--arg command "$command_value" \
|
|
170
|
-
'. + [{
|
|
170
|
+
'. + [{name:$name,active:$active,description:$description,state:(if $state=="" then null else $state end),failed:(if $failure=="" then null else $failure end),command:(if $command=="" then null else $command end)}]' \
|
|
171
171
|
<<<"$modules_json")"
|
|
172
172
|
done
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
# In the Kubernetes workspace (DEVZONE_WORKSPACE=kubernetes), the pod has
|
|
177
|
-
# no Docker host socket: the socket is absent (#515)
|
|
178
|
-
if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
|
|
179
|
-
docker_host=false
|
|
180
|
-
docker_host_active=false
|
|
181
|
-
else
|
|
182
|
-
if [ "$(valeur docker-hote)" = on ]; then
|
|
183
|
-
docker_host=true
|
|
184
|
-
fi
|
|
185
|
-
relay_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
|
|
186
|
-
if [ -e "$relay_source" ]; then
|
|
187
|
-
docker_host_active=true
|
|
188
|
-
fi
|
|
189
|
-
fi
|
|
190
|
-
|
|
191
|
-
services_cluster="$(cluster_lu)"
|
|
192
|
-
if [ -n "$services_cluster" ] && ! cluster_est_local "$services_cluster"; then
|
|
174
|
+
services_cluster="$(cluster_saved)"
|
|
175
|
+
if [ -n "$services_cluster" ] && ! cluster_is_local "$services_cluster"; then
|
|
193
176
|
services_remote=true
|
|
194
177
|
fi
|
|
195
178
|
clusters_services_raw="$services_cluster"
|
|
196
179
|
work_ctx="$(kubectl config current-context 2>/dev/null || true)"
|
|
197
180
|
case "$work_ctx" in
|
|
198
181
|
kind-gitlab* | kind-devzone*)
|
|
199
|
-
host_ctx="$(KUBECONFIG="${
|
|
200
|
-
if [ -n "$host_ctx" ] &&
|
|
182
|
+
host_ctx="$(KUBECONFIG="${DEVZONE_KUBE_HOST:-$HOME/.kube/hote.config}" kubectl config current-context 2>/dev/null || true)"
|
|
183
|
+
if [ -n "$host_ctx" ] && cluster_reachable "$host_ctx" 2>/dev/null; then
|
|
201
184
|
work_internal=true
|
|
202
185
|
fi
|
|
203
186
|
;;
|
|
@@ -229,26 +212,21 @@ state_json() {
|
|
|
229
212
|
credentials_raw="$RACINE/.password"
|
|
230
213
|
fi
|
|
231
214
|
|
|
232
|
-
|
|
233
|
-
if [ -f "$relay_marker" ]; then
|
|
234
|
-
msg="$(head -1 "$relay_marker" 2>/dev/null || true)"
|
|
235
|
-
append_alert relais_docker "$msg" "devzone repair"
|
|
236
|
-
fi
|
|
237
|
-
packages_marker="${DEVZONE_PAQUETS_MARQUE:-/tmp/devzone-paquets.echec}"
|
|
215
|
+
packages_marker="${DEVZONE_PACKAGES_MARKER:-/tmp/devzone-packages.failed}"
|
|
238
216
|
if [ -f "$packages_marker" ]; then
|
|
239
217
|
packages_names=""
|
|
240
218
|
while IFS= read -r n; do
|
|
241
219
|
[ -n "$n" ] || continue
|
|
242
220
|
packages_names="${packages_names:+$packages_names, }$n"
|
|
243
221
|
done < "$packages_marker"
|
|
244
|
-
append_alert
|
|
222
|
+
append_alert packages "$packages_names" "devzone packages"
|
|
245
223
|
fi
|
|
246
|
-
wt_out="$(
|
|
224
|
+
wt_out="$(missing_worktrees 2>/dev/null || true)"
|
|
247
225
|
while IFS= read -r path; do
|
|
248
226
|
[ -n "$path" ] || continue
|
|
249
227
|
append_alert worktree "$path missing here (created outside the container?)" ""
|
|
250
228
|
done <<<"$wt_out"
|
|
251
|
-
if [ -n "$services_cluster" ] && !
|
|
229
|
+
if [ -n "$services_cluster" ] && ! cluster_is_local "$services_cluster"; then
|
|
252
230
|
append_alert cluster_distant "remote cluster: $services_cluster — services on a remote cluster" ""
|
|
253
231
|
fi
|
|
254
232
|
if [ "$work_internal" = true ]; then
|
|
@@ -258,7 +236,7 @@ state_json() {
|
|
|
258
236
|
argocd_repo="$(conf_get argocd repo)"
|
|
259
237
|
|
|
260
238
|
jq -n \
|
|
261
|
-
--argjson schema
|
|
239
|
+
--argjson schema 2 \
|
|
262
240
|
--arg dv "$dv_raw" \
|
|
263
241
|
--arg dvp "$dvp_raw" \
|
|
264
242
|
--argjson id_ok "$id_ok" \
|
|
@@ -272,8 +250,6 @@ state_json() {
|
|
|
272
250
|
--arg tools_command "$tools_command" \
|
|
273
251
|
--argjson modules "$modules_json" \
|
|
274
252
|
--arg argocd_repo "$argocd_repo" \
|
|
275
|
-
--argjson docker_host "$docker_host" \
|
|
276
|
-
--argjson docker_host_active "$docker_host_active" \
|
|
277
253
|
--arg clusters_services "$clusters_services_raw" \
|
|
278
254
|
--argjson services_remote "$services_remote" \
|
|
279
255
|
--arg clusters_work "$clusters_work_raw" \
|
|
@@ -286,20 +262,18 @@ state_json() {
|
|
|
286
262
|
--argjson errors "$errors" \
|
|
287
263
|
'{
|
|
288
264
|
schema: $schema,
|
|
289
|
-
devzone: { version: (if $dv=="" then null else $dv end),
|
|
290
|
-
|
|
291
|
-
|
|
265
|
+
devzone: { version: (if $dv=="" then null else $dv end), available: (if $dvp=="" then null else $dvp end) },
|
|
266
|
+
git_identity: { ok: $id_ok, name: (if $id_name=="" then null else $id_name end), email: (if $id_email=="" then null else $id_email end), command: (if $id_command=="" then null else $id_command end) },
|
|
267
|
+
platform: { name: $platform_name, url: (if $platform_url=="" then null else $platform_url end), github: $github },
|
|
292
268
|
argocd_repo: (if $argocd_repo == "" then null else $argocd_repo end),
|
|
293
|
-
|
|
269
|
+
tools: { outdated: $tools_late, command: (if $tools_command=="" then null else $tools_command end) },
|
|
294
270
|
modules: $modules,
|
|
295
|
-
|
|
296
|
-
docker_hote_actif: $docker_host_active,
|
|
297
|
-
clusters: { services: (if $clusters_services=="" then null else $clusters_services end), services_distant: $services_remote, travail: (if $clusters_work=="" then null else $clusters_work end), travail_interne: $work_internal, commande: (if $clusters_command=="" then null else $clusters_command end) },
|
|
271
|
+
clusters: { services: (if $clusters_services=="" then null else $clusters_services end), services_remote: $services_remote, work: (if $clusters_work=="" then null else $clusters_work end), internal_work: $work_internal, command: (if $clusters_command=="" then null else $clusters_command end) },
|
|
298
272
|
ports: $ports,
|
|
299
273
|
applications: (if $applications=="" then null else $applications end),
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
274
|
+
credentials: (if $credentials=="" then null else $credentials end),
|
|
275
|
+
alerts: $alerts,
|
|
276
|
+
errors: $errors
|
|
303
277
|
}'
|
|
304
278
|
}
|
|
305
279
|
|
package/.devcontainer/state.sh
CHANGED
|
@@ -121,7 +121,7 @@ state_default() {
|
|
|
121
121
|
# cluster= line of the state expects this context, not "devzone" (services cluster)
|
|
122
122
|
host_context_of_cluster() {
|
|
123
123
|
local cluster="$1" host ctx
|
|
124
|
-
host="${
|
|
124
|
+
host="${DEVZONE_KUBE_HOST:-$HOME/.kube/hote.config}"
|
|
125
125
|
while IFS= read -r ctx; do
|
|
126
126
|
[ -n "$ctx" ] || continue
|
|
127
127
|
# The "devzone" context is set on the services cluster: we look for the
|
|
@@ -140,7 +140,7 @@ host_context_of_cluster() {
|
|
|
140
140
|
# cluster= of the devzone context); returns 1 otherwise.
|
|
141
141
|
state_rebuild() {
|
|
142
142
|
local namespaces m v stage seen=0 code=0 cluster_ctx cluster_host label
|
|
143
|
-
label="${
|
|
143
|
+
label="${CLUSTER_LABEL:-app.kubernetes.io/managed-by=devzone}"
|
|
144
144
|
command -v kubectl >/dev/null 2>&1 || return 1
|
|
145
145
|
namespaces="$(kubectl get namespaces -l "$label" -o name 2>/dev/null || true)"
|
|
146
146
|
[ -n "$namespaces" ] || return 1
|
|
@@ -58,12 +58,25 @@ init_modules() {
|
|
|
58
58
|
fi
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
# Former French names renamed to English (#733). Idempotent: the script logs one
|
|
62
|
+
# line per rename, and a pair already renamed is left alone
|
|
63
|
+
init_legacy_names() {
|
|
64
|
+
bash "$HERE/rename-legacy-files.sh" || log "legacy names: not renamed"
|
|
65
|
+
}
|
|
66
|
+
|
|
61
67
|
init_prompt() {
|
|
62
68
|
local bashrc="$HOME/.bashrc"
|
|
63
69
|
if ! touch "$bashrc" 2>/dev/null; then
|
|
64
70
|
log "prompt: cannot write $bashrc"
|
|
65
71
|
return 0
|
|
66
72
|
fi
|
|
73
|
+
# Block written before the rename invite-kube.sh -> kube-prompt.sh: the file
|
|
74
|
+
# no longer exists, every prompt would fail (migration, idempotent)
|
|
75
|
+
if grep -qE 'invite-kube\.sh|devzone_invite_kube' "$bashrc" 2>/dev/null; then
|
|
76
|
+
sed -i -e 's#/\.devcontainer/invite-kube\.sh#/.devcontainer/kube-prompt.sh#' \
|
|
77
|
+
-e 's#devzone_invite_kube#devzone_kube_prompt#' "$bashrc"
|
|
78
|
+
log "prompt block migrated to kube-prompt.sh"
|
|
79
|
+
fi
|
|
67
80
|
if grep -qF "$PROMPT_START" "$bashrc" 2>/dev/null; then
|
|
68
81
|
log "prompt block already present"
|
|
69
82
|
return 0
|
|
@@ -71,8 +84,8 @@ init_prompt() {
|
|
|
71
84
|
cat >>"$bashrc" <<'PROMPT'
|
|
72
85
|
# >>> devzone prompt >>>
|
|
73
86
|
# shellcheck source=/dev/null
|
|
74
|
-
. /usr/local/share/devzone/.devcontainer/
|
|
75
|
-
PS1='$(
|
|
87
|
+
. /usr/local/share/devzone/.devcontainer/kube-prompt.sh
|
|
88
|
+
PS1='$(devzone_kube_prompt) '"$PS1"
|
|
76
89
|
# <<< devzone prompt <<<
|
|
77
90
|
PROMPT
|
|
78
91
|
log "prompt block added to $bashrc"
|
|
@@ -81,5 +94,6 @@ PROMPT
|
|
|
81
94
|
init_safe_directory
|
|
82
95
|
init_repowarden
|
|
83
96
|
init_modules
|
|
97
|
+
init_legacy_names
|
|
84
98
|
init_prompt
|
|
85
99
|
log "done"
|
package/Makefile
CHANGED
|
@@ -32,7 +32,7 @@ stop: hors-conteneur ## Arrête le conteneur (état conservé)
|
|
|
32
32
|
|
|
33
33
|
down: hors-conteneur ## Supprime le conteneur (volumes et image conservés)
|
|
34
34
|
@ids=$$(docker ps -aq $(FILTRE)); if [ -z "$$ids" ]; then echo "aucun conteneur"; else \
|
|
35
|
-
docker inspect $$ids --format 'IMAGE={{.Config.Image}}{{range .Mounts}}{{if eq .Destination "/var/lib/docker"}} DIND={{.Name}}{{end}}{{end}}' | head -1 | tr ' ' '\n' > .devzone.
|
|
35
|
+
docker inspect $$ids --format 'IMAGE={{.Config.Image}}{{range .Mounts}}{{if eq .Destination "/var/lib/docker"}} DIND={{.Name}}{{end}}{{end}}' | head -1 | tr ' ' '\n' > .devzone.state; \
|
|
36
36
|
docker rm -f $$ids >/dev/null && echo "devzone supprimé (désinstallation complète : make desinstaller)"; fi
|
|
37
37
|
|
|
38
38
|
rebuild: hors-conteneur ## Reconstruit de zéro (après modif de .devcontainer/)
|