devzone 7.5.1 → 7.5.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.
package/bin/SHA256SUMS CHANGED
@@ -1,6 +1,6 @@
1
- a44ed44208d3045436bbae033079c1b45e41a4a9949d59d06a01462a2753ac69 devzone-linux-amd64
2
- 25aaf6eae0830c0baa48152eec6a76b33747154fd242f7ab170672ea528a9dd0 devzone-linux-arm64
3
- 58c272b0adaf0d1ccc943e79758f30647b150e8fc999aac62397c2fab835c8ae devzone-darwin-amd64
4
- bbc4f4d84cebac8883756a1aaacb4145c35aea438bedc99381a86ecf0da62908 devzone-darwin-arm64
5
- 72b505ea10261768ca224560b194b5a03a2595d06c5e85fd6a1b21f5247a2292 devzone-windows-amd64.exe
6
- 7b11b7e77fac4fd403c69ff2178f8e0a508d33ce8973a9ee2c887958be6e237a devzone-windows-arm64.exe
1
+ 3289788a2d0ab9065361c2de6179e7c201279d5ffeb71c7ac4ea4b938e65639d devzone-linux-amd64
2
+ e19ef85c224cf459a5552f666af575710aba5b8c1c0b66e7ac4595d411599b1d devzone-linux-arm64
3
+ e9326ac11614d813221740a862c9514a8567abdaf04bdd5a3e331e8b7ca3013f devzone-darwin-amd64
4
+ 1c3c524989be3b4356da86b3ab294bca1a29e48fc7ca141b05167c2edcf41e31 devzone-darwin-arm64
5
+ ae7959a3a5bbdf36fa78bd0338f873f4824b8f31dde628bd8bea61f06415e253 devzone-windows-amd64.exe
6
+ 4ef9712349ebae0806f80c73b846d6e8578a530222db77935844d06f5b7366ee devzone-windows-arm64.exe
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/manage/devzone CHANGED
@@ -108,13 +108,38 @@ go_install() {
108
108
 
109
109
  # Runs the Go binary when it applies (never returns then); otherwise returns
110
110
  go_launch() {
111
- local platform ext="" name bin want have ver base target
111
+ local platform ext="" name bin want have ver base target tmpgo
112
112
  if [ -n "${DEVZONE_NO_GO:-}" ] || [ -n "${DEVZONE_FROM_GO:-}" ]; then return 0; fi
113
113
  platform="$(go_platform)" || return 0
114
114
  case "$platform" in windows-*) ext=.exe ;; esac
115
115
  name="devzone-$platform$ext"
116
116
  bin="$PAQUET/bin/$name"
117
- [ -f "$bin" ] || return 0
117
+ if [ ! -f "$bin" ]; then
118
+ # No packaged binary (a checkout): resolve one with go when it is
119
+ # available, into the cache, and export it; stay in bash then (#884)
120
+ ver="$(version)"
121
+ base="${XDG_CACHE_HOME:-}"
122
+ if [ -z "$base" ] && [ -n "${HOME:-}" ]; then base="$HOME/.cache"; fi
123
+ target=""
124
+ if [ -n "$base" ] && [ "$ver" != inconnue ] && command -v go >/dev/null 2>&1; then
125
+ target="$base/devzone/bin/$ver/devzone$ext"
126
+ if [ ! -x "$target" ] || [ "$(cat "$target.sha256" 2>/dev/null)" != built ]; then
127
+ tmpgo="$(mktemp "${TMPDIR:-/tmp}/devzone-go.XXXXXX")" || tmpgo=""
128
+ if [ -n "$tmpgo" ] && (cd "$PAQUET" && go build -o "$tmpgo" ./cmd/devzone 2>/dev/null) \
129
+ && mkdir -p "$(dirname "$target")" && mv -f "$tmpgo" "$target" && printf 'built\n' >"$target.sha256"; then
130
+ :
131
+ else
132
+ rm -f "$tmpgo"
133
+ target=""
134
+ fi
135
+ fi
136
+ fi
137
+ if [ -n "$target" ]; then export DEVZONE_HOST_BIN="$target"; fi
138
+ return 0
139
+ fi
140
+ # The shell scripts still run call the Go program for their checks (#884):
141
+ # the launcher exports it first; the exec path below refines it to the cache
142
+ export DEVZONE_HOST_BIN="$bin"
118
143
  ver="$(version)"
119
144
  [ "$ver" != inconnue ] || return 0
120
145
  base="${XDG_CACHE_HOME:-}"
@@ -231,10 +256,7 @@ case "${1:-}" in
231
256
  echo "✖ devzone $1: pod command; run it in the pod (make shell), or choose another folder name" >&2
232
257
  exit 2
233
258
  fi
234
- # shellcheck source=SCRIPTDIR/scripts/devzone-manifest.sh
235
- . "$PAQUET/manage/scripts/devzone-manifest.sh"
236
- # shellcheck source=SCRIPTDIR/scripts/devzone-create.sh
237
- . "$PAQUET/manage/scripts/devzone-create.sh"
238
- create_workstation "$1" "${@:2}"
259
+ # Creation lives in Go (#884): the shell only names the folder and the package
260
+ DEVZONE_PAQUET="$PAQUET" "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" create-workstation "$1" "${@:2}"
239
261
  ;;
240
262
  esac
@@ -159,7 +159,7 @@ argocd_install() {
159
159
  argocd_ensure() {
160
160
  argocd_wanted || return 0
161
161
  argocd_installed && return 0
162
- if ! kube_ready_reason >/dev/null; then
162
+ if ! "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" kube-ready >/dev/null; then
163
163
  echo "⚠ Argo CD not checked: the cluster does not answer (devzone workspace services enable argocd once it does)" >&2
164
164
  return 0
165
165
  fi
@@ -53,7 +53,7 @@ default_image_tag() {
53
53
  # Installs or upgrades the workspace in the cluster; the cluster is checked first (#565): no Argo CD, helm or pod wait for a stopped one.
54
54
  start_workspace() {
55
55
  local repo tag image with_image="" args=()
56
- kube_ready_reason --hint >&2 || return 1
56
+ "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" kube-ready --hint >&2 || return 1
57
57
  repo="$IMAGE_REPO"
58
58
  tag="$(default_image_tag)"
59
59
  while [ $# -gt 0 ]; do
@@ -120,8 +120,6 @@ shell_workspace() {
120
120
  kubectl $(kubectl_flag) exec -it devzone-workspace-0 --namespace devzone-workspace -c workspace -- bash
121
121
  }
122
122
 
123
- # shellcheck source=manage/scripts/kube-ready.sh
124
- . "$HERE/scripts/kube-ready.sh"
125
123
  # shellcheck source=manage/scripts/workspace/argocd-workspace.sh
126
124
  . "$HERE/scripts/workspace/argocd-workspace.sh"
127
125
  # shellcheck source=manage/scripts/workspace/argocd-services.sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "7.5.1",
3
+ "version": "7.5.2",
4
4
  "description": "Ton poste de développement Linux, prêt en une commande, identique sur Mac, Windows et Linux.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {
@@ -1,103 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Workspace mode at creation (#497): a new devzone is a Kubernetes workspace,
3
- # so the cluster must answer. Without a cluster there is no fallback (#671):
4
- # creation stops and lists the ways to get a cluster. The Docker workstation is
5
- # retired (#735). Sourced by manage/devzone (creer): create_mode_choose runs
6
- # before any file is copied (so --kubernetes without a cluster creates
7
- # nothing), create_mode_write once the folder exists.
8
- # Sourced only: no code at file level. Compatible with bash 3.2 (macOS).
9
- # shellcheck disable=SC2034 # CREATE_MODE is read by manage/devzone (creer)
10
- # shellcheck source=manage/scripts/kube-ready.sh
11
- . "$(dirname "${BASH_SOURCE[0]}")/kube-ready.sh"
12
-
13
- # Context shown to the user: devzone if declared, otherwise the current one.
14
- kube_context() {
15
- if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
16
- echo devzone
17
- else
18
- kubectl config current-context 2>/dev/null || echo none
19
- fi
20
- }
21
-
22
- # Prints, on stderr, how to get a cluster: devzone only displays the commands,
23
- # it never runs them and no cloud credential goes through it.
24
- create_mode_no_cluster() {
25
- cat >&2 <<EOF
26
- ✖ Kubernetes not reachable: $1. Nothing created.
27
- devzone runs in a Kubernetes cluster. Pick one, then run the same command again:
28
- - a remote cluster (AWS, GCP, Azure, other): add its context to your kubeconfig, then select it
29
- aws eks update-kubeconfig --name <cluster>
30
- gcloud container clusters get-credentials <cluster>
31
- az aks get-credentials --name <cluster> --resource-group <group>
32
- kubectl config use-context <context>
33
- - a local cluster: Docker Desktop (Settings > Kubernetes > Enable Kubernetes), or minikube
34
- minikube start -p devzone
35
- EOF
36
- }
37
-
38
- # Chooses the mode from the option (kubernetes or empty) and sets CREATE_MODE
39
- # to kubernetes, with one line of notice. Returns 1, nothing set on disk, when
40
- # the cluster does not answer.
41
- create_mode_choose() {
42
- local option="$1" reason
43
- if reason="$(kube_ready_reason)"; then
44
- CREATE_MODE=kubernetes
45
- echo "✔ Kubernetes ready ($(kube_context)): workspace in the cluster"
46
- create_mode_existing
47
- return 0
48
- fi
49
- # No option, in a terminal: a menu (remote cluster, minikube) instead of a
50
- # failure (#653); the choice is accepted only if the cluster then answers.
51
- # The menu is the Go program's (#884), found through DEVZONE_HOST_BIN; without
52
- # it no menu is offered (false), and the failure below lists the ways to get a cluster
53
- if [ -z "$option" ] && "${DEVZONE_HOST_BIN:-false}" cluster-offer && reason="$(kube_ready_reason)"; then
54
- CREATE_MODE=kubernetes
55
- echo "✔ Kubernetes ready ($(kube_context)): workspace in the cluster"
56
- create_mode_existing
57
- return 0
58
- fi
59
- create_mode_no_cluster "$reason"
60
- return 1
61
- }
62
-
63
- # A workspace already installed in the cluster (helm release devzone-workspace,
64
- # or Argo CD Application devzone-workspace), from any folder: the new folder
65
- # drives it too, and creation goes on (the start is a helm upgrade, the volumes
66
- # stay). Notice only.
67
- create_mode_existing() {
68
- local ctx
69
- ctx="$(kube_context)"
70
- if helm status devzone-workspace --namespace devzone-workspace --kube-context "$ctx" >/dev/null 2>&1 ||
71
- kubectl get application.argoproj.io devzone-workspace --namespace devzone-argocd --context "$ctx" >/dev/null 2>&1; then
72
- echo "ℹ a devzone workspace already runs in this cluster: this folder drives it too"
73
- fi
74
- return 0
75
- }
76
-
77
- # Writes workspace=<mode> in <folder>/.devzone.modules: an earlier workspace=
78
- # line is replaced, the other lines are kept.
79
- create_mode_write() {
80
- local folder="$1" mode="$2" f
81
- f="$folder/.devzone.modules"
82
- {
83
- if [ -f "$f" ]; then grep -v '^workspace=' "$f" || true; fi
84
- echo "workspace=$mode"
85
- } >"$f.tmp" && mv "$f.tmp" "$f"
86
- }
87
-
88
- # Kubernetes creation: installs the workspace from the package script, run in
89
- # the new folder (as devzone workspace start does). DEVZONE_WORKSPACE_SH
90
- # replaces the script (tests); DEVZONE_NO_START only prints the command.
91
- create_mode_start() {
92
- local folder="$1" script="$2"
93
- if [ -n "${DEVZONE_NO_START:-}" ]; then
94
- echo "To start the workspace: cd $folder && devzone workspace start"
95
- return 0
96
- fi
97
- echo "▶ Starting the workspace in the cluster (a few minutes the first time)…"
98
- if ! (cd "$folder" && bash "${DEVZONE_WORKSPACE_SH:-$script}" start); then
99
- echo "✖ Workspace not started. The folder is ready: only the start remains (cd $folder && devzone workspace start)" >&2
100
- return 1
101
- fi
102
- echo "Next: cd $folder && devzone workspace shell (the pod)"
103
- }
@@ -1,110 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Creation of a devzone (devzone <folder>): asks for the GitOps repository,
3
- # copies the package, writes .argocd.conf and the manifest, then starts the
4
- # workspace in the cluster. Sourced by manage/devzone,
5
- # which defines PAQUET, PACKAGE_ITEMS and version(); devzone-manifest.sh must
6
- # be sourced first.
7
- # shellcheck disable=SC2154 # PAQUET, PACKAGE_ITEMS: set by manage/devzone
8
-
9
- # GitOps repository of Argo CD for the creation (#539): github, an existing
10
- # URL, or none. Asked in a terminal (default: github when gh is connected),
11
- # or none with a notice without one (the --gitops option names the choice).
12
- ask_gitops() {
13
- local answer default=""
14
- if gh auth status >/dev/null 2>&1; then
15
- default="github"
16
- fi
17
- printf 'GitOps repository for Argo CD? [G]itHub (created under your gh account at first start) / a URL / [n]one : ' >&2
18
- read -r answer || answer=""
19
- answer="${answer:-$default}"
20
- case "$answer" in
21
- G | g | GitHub | github | y | Y | yes) echo "github" ;;
22
- n | N | none | None) echo "none" ;;
23
- *) echo "$answer" ;;
24
- esac
25
- }
26
-
27
- create_workstation() {
28
- local target="$1" gitops="" expect="" option="" arg value login name instance
29
- shift
30
- for arg in "$@"; do
31
- if [ "$expect" = gitops ]; then gitops="$arg"; expect=""; continue; fi
32
- case "$arg" in
33
- --gitops) expect=gitops ;;
34
- --gitops=*) gitops="${arg#--gitops=}" ;;
35
- --kubernetes) option=kubernetes ;;
36
- *) echo "✖ unknown option: $arg (devzone <folder> [--gitops github|none|<url>] [--kubernetes])" >&2; exit 1 ;;
37
- esac
38
- done
39
- if [ -n "$expect" ]; then
40
- echo "✖ --gitops expects a value (github, none or a URL)" >&2
41
- exit 1
42
- fi
43
-
44
- if [ -e "$target" ] && [ -n "$(ls -A "$target" 2>/dev/null)" ]; then
45
- echo "✖ $target exists and is not empty: nothing is overwritten. Choose another folder." >&2
46
- exit 1
47
- fi
48
-
49
- # Mode before any copy: --kubernetes without a cluster creates nothing (#497)
50
- # shellcheck source=SCRIPTDIR/create-mode.sh
51
- . "$PAQUET/manage/scripts/create-mode.sh"
52
- create_mode_choose "$option" || exit 1
53
-
54
- if [ -z "$gitops" ]; then
55
- if [ -t 0 ]; then
56
- gitops="$(ask_gitops)"
57
- else
58
- echo "⚠ no GitOps repository for Argo CD: pass --gitops <github|none|https://github.com/<login>/<name>.git> to create a devzone without a terminal; using none" >&2
59
- gitops="none"
60
- fi
61
- fi
62
- mkdir -p "$target/workspace" "$target/manage"
63
- cp -R "${PACKAGE_ITEMS[@]/#/$PAQUET/}" "$target/"
64
- cp -R "$PAQUET/manage/scripts" "$target/manage/"
65
- touch "$target/workspace/.gitkeep"
66
- # npm never includes .gitignore: written here
67
- : >"$target/.gitignore"
68
- complete_gitignore "$target"
69
- chmod +x "$target/manage/scripts/uninstall.sh"
70
- create_mode_write "$target" "$CREATE_MODE"
71
- # The GitOps repository of the new devzone (#539): github, an existing URL,
72
- # or none, written in the .argocd.conf of the new devzone (conf.sh writes
73
- # the header of the file when absent)
74
- . "$PAQUET/.devcontainer/argocd/conf.sh"
75
- # shellcheck disable=SC2034 # read by conf.sh
76
- ARGOCD_CONF="$target/.argocd.conf"
77
- if [ "$gitops" = github ]; then
78
- if ! gh auth status >/dev/null 2>&1; then
79
- echo "⚠ GitHub not connected (gh auth login): no GitOps repository, the Applications are applied directly; pass --gitops none" >&2
80
- value="none"
81
- else
82
- login="$(gh api user --jq .login 2>/dev/null)" || login=""
83
- if [ -z "$login" ]; then
84
- echo "⚠ GitHub login unreadable (gh api user): no GitOps repository, the Applications are applied directly; pass --gitops none" >&2
85
- value="none"
86
- else
87
- name="${DEVZONE_GITOPS_REPO_NAME:-devzone-argocd}"
88
- instance="${DEVZONE_VOLUMES:-devzone}"
89
- if [ "$instance" != "devzone" ]; then
90
- name="$name-$instance"
91
- fi
92
- value="https://github.com/$login/$name.git"
93
- fi
94
- fi
95
- elif [ "$gitops" = none ]; then
96
- value="none"
97
- else
98
- value="$gitops"
99
- fi
100
- conf_set argocd "repo=$value"
101
- case "$value" in
102
- none) echo "✔ no GitOps repository: the Applications are applied directly (devzone workspace argocd init to change)" ;;
103
- *) echo "✔ GitOps repository: $value ($target/.argocd.conf)" ;;
104
- esac
105
- target="$(cd "$target" && pwd)"
106
- write_manifest "$target"
107
- echo "✔ devzone $(version) created in $target"
108
- # The workspace goes to the cluster (kube check done by create_mode_choose)
109
- create_mode_start "$target" "$PAQUET/manage/workspace.sh"
110
- }
@@ -1,75 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Shared check of the Kubernetes cluster (#497, #565), sourced by create-mode.sh,
3
- # create-mode.sh (creation) and workspace.sh (workspace start). Sourced only:
4
- # no code at file level. Compatible with bash 3.2 (macOS) and Linux.
5
-
6
- # Returns 0 when kubectl and helm are present and the cluster answers within 5 s
7
- # (context devzone if declared, otherwise the current context). Otherwise
8
- # prints one short line on stdout (kubectl missing, helm missing, or
9
- # cluster <context> unreachable (<server>)) and returns 1. With --hint, prints
10
- # the message for the user instead (#565, see kube_unreachable_hint).
11
- kube_ready_reason() {
12
- local context server hint=no
13
- [ "${1:-}" = --hint ] && hint=yes
14
- command -v kubectl >/dev/null 2>&1 || {
15
- kube_say "kubectl missing" "$hint"
16
- return 1
17
- }
18
- command -v helm >/dev/null 2>&1 || {
19
- kube_say "helm missing" "$hint"
20
- return 1
21
- }
22
- if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
23
- kubectl cluster-info --request-timeout=5s --context devzone >/dev/null 2>&1 && return 0
24
- context=devzone
25
- server="$(kubectl config view --minify --context devzone -o 'jsonpath={.clusters[0].cluster.server}' 2>/dev/null || true)"
26
- else
27
- kubectl cluster-info --request-timeout=5s >/dev/null 2>&1 && return 0
28
- context="$(kubectl config current-context 2>/dev/null || true)"
29
- server="$(kubectl config view --minify -o 'jsonpath={.clusters[0].cluster.server}' 2>/dev/null || true)"
30
- fi
31
- if [ "$hint" = yes ]; then
32
- kube_unreachable_hint "${context:-none}" "${server:-unknown server}"
33
- else
34
- echo "cluster ${context:-none} unreachable (${server:-unknown server})"
35
- fi
36
- return 1
37
- }
38
-
39
- # One reason line: as is, or as a ✖ line for the user (--hint).
40
- kube_say() {
41
- if [ "$2" = yes ]; then
42
- echo "✖ $1"
43
- else
44
- echo "$1"
45
- fi
46
- }
47
-
48
- # Cluster name of a context (empty when unknown).
49
- kube_context_cluster() {
50
- kubectl config view --minify --context "$1" -o 'jsonpath={.clusters[0].name}' 2>/dev/null || true
51
- }
52
-
53
- # Message of an unreachable cluster <context> at <server> (#565). The cluster of
54
- # Docker Desktop (context docker-desktop, or a local server 127.0.0.1 or
55
- # localhost of a cluster named docker-desktop) runs inside Docker Desktop: when
56
- # docker info fails, the cause is Docker Desktop stopped; when Docker answers,
57
- # Kubernetes is disabled in it. Any other context gets the generic message.
58
- kube_unreachable_hint() {
59
- local context="$1" server="$2" cluster host
60
- cluster="$(kube_context_cluster "$context")"
61
- host="${server#*://}"
62
- host="${host%%[:/]*}"
63
- if [ "$context" = docker-desktop ] ||
64
- { [ "$cluster" = docker-desktop ] && { [ "$host" = 127.0.0.1 ] || [ "$host" = localhost ]; }; }; then
65
- if ! docker info >/dev/null 2>&1; then
66
- echo "✖ Docker Desktop is stopped: the Kubernetes cluster of this machine runs inside it. Start Docker Desktop, then: devzone workspace start"
67
- echo " Tip: Settings → General → Start Docker Desktop when you sign in"
68
- else
69
- echo "✖ Kubernetes cluster $context unreachable ($server): enable Kubernetes in Docker Desktop (Settings → Kubernetes) or check kubectl config get-contexts"
70
- fi
71
- return 0
72
- fi
73
- echo "✖ Kubernetes cluster $context unreachable ($server)"
74
- echo " Check the contexts: kubectl config get-contexts"
75
- }