devzone 7.5.2 → 7.5.4
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/devzone +4 -5
- package/.devcontainer/versions.env +1 -1
- package/.devcontainer/workspace-init.sh +5 -0
- package/bin/SHA256SUMS +6 -6
- package/bin/devzone-darwin-amd64 +0 -0
- package/bin/devzone-darwin-arm64 +0 -0
- package/bin/devzone-linux-amd64 +0 -0
- package/bin/devzone-linux-arm64 +0 -0
- package/bin/devzone-windows-amd64.exe +0 -0
- package/bin/devzone-windows-arm64.exe +0 -0
- package/package.json +1 -1
- package/.devcontainer/devzone-status.sh +0 -144
- package/.devcontainer/services-admin.sh +0 -115
package/.devcontainer/devzone
CHANGED
|
@@ -100,13 +100,12 @@ GITLAB_URL_MODULE=http://gitlab.localhost:8929
|
|
|
100
100
|
# shellcheck source=SCRIPTDIR/devzone-platform.sh
|
|
101
101
|
# shellcheck disable=SC1091
|
|
102
102
|
. "$ICI/devzone-platform.sh"
|
|
103
|
-
# shellcheck source=SCRIPTDIR/devzone-status.sh
|
|
104
|
-
# shellcheck disable=SC1091
|
|
105
|
-
. "$ICI/devzone-status.sh"
|
|
106
|
-
|
|
107
103
|
|
|
108
104
|
case "${1:-}" in
|
|
109
|
-
"" | status | modules)
|
|
105
|
+
"" | status | modules)
|
|
106
|
+
echo "devzone status: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
107
|
+
exit 1
|
|
108
|
+
;;
|
|
110
109
|
state)
|
|
111
110
|
export DEVZONE_STATE="$ETAT"
|
|
112
111
|
case "${2:-}" in
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Single source for the repowarden version used by workspace-init.sh and manage/scripts/ci/versions.sh.
|
|
2
|
-
REPOWARDEN_VERSION=4.18.
|
|
2
|
+
REPOWARDEN_VERSION=4.18.2
|
|
3
3
|
|
|
4
4
|
# Pinned metrics-server release installed on the local clusters by devzone.
|
|
5
5
|
METRICS_SERVER_VERSION=v0.9.0
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
# step. No Docker socket is used and no kubeconfig is fabricated.
|
|
5
5
|
set -uo pipefail
|
|
6
6
|
|
|
7
|
+
# A crash must not leave a multi-gigabyte core file in a worktree (#961).
|
|
8
|
+
ulimit -c 0 2>/dev/null || true
|
|
9
|
+
|
|
7
10
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
11
|
VERSIONS_ENV="$HERE/versions.env"
|
|
9
12
|
PROMPT_START="# >>> devzone prompt >>>"
|
|
@@ -77,6 +80,8 @@ init_prompt() {
|
|
|
77
80
|
fi
|
|
78
81
|
cat >>"$bashrc" <<'PROMPT'
|
|
79
82
|
# >>> devzone prompt >>>
|
|
83
|
+
# Interactive shells in the pod must not write core files either (#961).
|
|
84
|
+
ulimit -c 0 2>/dev/null || true
|
|
80
85
|
PS1='$(devzone kube prompt) '"$PS1"
|
|
81
86
|
# <<< devzone prompt <<<
|
|
82
87
|
PROMPT
|
package/bin/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
2f2d92e6ded735eaeca2c18ba02be3e60f502356b4898b310891efd87673bdd6 devzone-linux-amd64
|
|
2
|
+
6dac6f391103c55a56a96da06fb59c2f4b57da1c457f9b43689d700bcf718f6c devzone-linux-arm64
|
|
3
|
+
65958c3379d10b12960b743bc3767b1b08c57c0b2efd0e15be9ec8ef567e68b3 devzone-darwin-amd64
|
|
4
|
+
332cf5308ee99075db106260a2f2899697f3dc525be2a173417ce0fb4092631f devzone-darwin-arm64
|
|
5
|
+
ae67a9cbda1e533ba0508341008019b602ce688628bda17a3d85395868d29f31 devzone-windows-amd64.exe
|
|
6
|
+
f4766767516b38f2b26d8eec97c339608ab1f38d237908fa4d3e5331d20ea17e devzone-windows-arm64.exe
|
package/bin/devzone-darwin-amd64
CHANGED
|
Binary file
|
package/bin/devzone-darwin-arm64
CHANGED
|
Binary file
|
package/bin/devzone-linux-amd64
CHANGED
|
Binary file
|
package/bin/devzone-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# devzone, status summary of the modules.
|
|
4
|
-
# Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
|
|
5
|
-
# functions only, shared variables are defined in devzone.
|
|
6
|
-
|
|
7
|
-
# Full state: ✔ ready, ✖ required, ○ optional, ⚠ to fix; each point to do with
|
|
8
|
-
# its command (shown at each startup)
|
|
9
|
-
show_state() {
|
|
10
|
-
local name email status m late path ports_state ctx_work ctx_host packages_mark packages_names argocd_repo
|
|
11
|
-
echo "devzone: state (devzone to show it again)"
|
|
12
|
-
"${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" version-available-line
|
|
13
|
-
name="$(git config --get user.name || true)"
|
|
14
|
-
email="$(git config --get user.email || true)"
|
|
15
|
-
if [ -n "$name" ] && [ -n "$email" ]; then
|
|
16
|
-
echo " ✔ git identity $name <$email>"
|
|
17
|
-
else
|
|
18
|
-
echo " ✖ git identity needed to commit: gh auth login -s workflow (automatic),"
|
|
19
|
-
echo " or git config --file ~/.config/git/config user.name \"<name>\" and user.email \"<email>\""
|
|
20
|
-
fi
|
|
21
|
-
if [ "$(platform_read)" = gitlab ]; then
|
|
22
|
-
# gitlab platform: the instance and glab, then the lines specific to
|
|
23
|
-
# GitHub (gh checks) reported as not applicable here, pending the GitLab
|
|
24
|
-
# support of repowarden (#531)
|
|
25
|
-
platform_line
|
|
26
|
-
url="$(gitlab_url_read)"
|
|
27
|
-
if git config --global --get "credential.$url.helper" 2>/dev/null | grep -q 'glab auth git-credential'; then
|
|
28
|
-
echo " ✔ git via glab"
|
|
29
|
-
else
|
|
30
|
-
echo " ⚠ git via glab to set: devzone platform gitlab"
|
|
31
|
-
fi
|
|
32
|
-
echo " ○ GitHub not needed here (gitlab platform chosen)"
|
|
33
|
-
echo " ⚠ repowarden stays on GitHub (bots and tickets): GitLab support coming (simdevWarden/repowarden#531)"
|
|
34
|
-
else
|
|
35
|
-
platform_line
|
|
36
|
-
if ! status="$(gh auth status 2>&1)"; then
|
|
37
|
-
echo " ○ GitHub optional (push and PR, repowarden tickets) : gh auth login -s workflow"
|
|
38
|
-
elif grep -q "Token scopes:" <<<"$status" && ! grep -q "'workflow'" <<<"$status"; then
|
|
39
|
-
echo " ⚠ GitHub connected, without workflow permission (push of .github/workflows/ refused): gh auth refresh -h github.com -s workflow"
|
|
40
|
-
else
|
|
41
|
-
echo " ✔ GitHub connected"
|
|
42
|
-
fi
|
|
43
|
-
fi
|
|
44
|
-
if late="$("${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" state outdated-tools 2>/dev/null)"; then
|
|
45
|
-
if [ -z "$late" ]; then
|
|
46
|
-
echo " ✔ tools pinned versions"
|
|
47
|
-
else
|
|
48
|
-
while read -r package pinned installed; do
|
|
49
|
-
[ -n "$package" ] || continue
|
|
50
|
-
echo " ⚠ tools $package $installed installed, $pinned pinned: devzone apply"
|
|
51
|
-
done <<<"$late"
|
|
52
|
-
fi
|
|
53
|
-
fi
|
|
54
|
-
while IFS= read -r path; do
|
|
55
|
-
[ -n "$path" ] || continue
|
|
56
|
-
echo " ⚠ worktree $path absent here (created outside the container?): manage it on that side, never git worktree prune here (manage/docs/reference.md, Git worktrees)"
|
|
57
|
-
done < <("${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" state missing-worktrees)
|
|
58
|
-
for m in "${MODULES[@]}"; do
|
|
59
|
-
if in_pod && service_module "$m"; then
|
|
60
|
-
# Kubernetes workspace pod (#528): presence by the cluster DNS
|
|
61
|
-
service_pod_line "$m"
|
|
62
|
-
elif [ "$(value_of "$m")" = on ] && [ -f "$(failure_marker_file "$m")" ]; then
|
|
63
|
-
printf ' ✖ module %-10s failed: incomplete install (%s): devzone apply\n' "$m" "$(cat "$(failure_marker_file "$m")")"
|
|
64
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = gitlab ]; then
|
|
65
|
-
# gitlab active: its real state (ready, runner, failed)
|
|
66
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" gitlab status)"
|
|
67
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = postgres ]; then
|
|
68
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" postgres status)"
|
|
69
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = argocd ]; then
|
|
70
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" argocd status)"
|
|
71
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = mysql ]; then
|
|
72
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" mysql status)"
|
|
73
|
-
elif [ "$(value_of "$m")" = on ]; then
|
|
74
|
-
printf ' ✔ module %-10s active: %s\n' "$m" "$(description "$m")"
|
|
75
|
-
else
|
|
76
|
-
printf ' ○ module %-10s optional, %s: devzone enable %s\n' "$m" "$(description "$m")" "$m"
|
|
77
|
-
fi
|
|
78
|
-
# Service held by an Argo CD Application (#916): the line is printed by devzone state held
|
|
79
|
-
held="$(DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state held "$m" 2>/dev/null || true)"
|
|
80
|
-
[ -z "$held" ] || printf ' %s\n' "$held"
|
|
81
|
-
done
|
|
82
|
-
# GitOps repository of the instance (#539): the designation of .argocd.conf
|
|
83
|
-
argocd_repo="$(conf_get argocd repo)"
|
|
84
|
-
if [ -n "$argocd_repo" ] && [ "$argocd_repo" != none ]; then
|
|
85
|
-
printf ' ○ argocd GitOps repository: %s\n' "$argocd_repo"
|
|
86
|
-
elif in_pod; then
|
|
87
|
-
DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state gitops-line
|
|
88
|
-
else
|
|
89
|
-
printf ' ○ argocd no GitOps repository: devzone argocd init\n'
|
|
90
|
-
fi
|
|
91
|
-
# Catalog applications (#414)
|
|
92
|
-
if [ -d "$ICI/catalog" ]; then
|
|
93
|
-
DEVZONE_STATE="$ETAT" "$ICI/devzone" catalog resume
|
|
94
|
-
fi
|
|
95
|
-
# GitLab Rails secret (#347): warning if the secrets were lost
|
|
96
|
-
if [ "$(value_of gitlab)" = on ] && [ ! -f "$RACINE/workspace/.gitlab/rails-secret.yaml" ]; then
|
|
97
|
-
echo " ⚠ gitlab GitLab reinstalled: if the browser shows 422, delete the site data of gitlab.localhost"
|
|
98
|
-
fi
|
|
99
|
-
# Remote devzone cluster: warning in the summary
|
|
100
|
-
current_cluster="$("$ICI/devzone" kube saved)"
|
|
101
|
-
if [ -n "$current_cluster" ] && ! "$ICI/devzone" kube local "$current_cluster"; then
|
|
102
|
-
printf ' ⚠ cluster remote: %s — services on a remote cluster\n' "$current_cluster"
|
|
103
|
-
fi
|
|
104
|
-
"$ICI/devzone" cluster clean --quiet || true
|
|
105
|
-
# Old kind-gitlab cluster still present: invite to migrate (#396)
|
|
106
|
-
if kind get clusters 2>/dev/null | grep -qx "gitlab${INSTANCE_SUFFIX}"; then
|
|
107
|
-
printf ' ⚠ old kind-gitlab cluster%s: devzone gitlab migrate\n' "$INSTANCE_SUFFIX"
|
|
108
|
-
fi
|
|
109
|
-
# Internal working cluster (kind): warning in the summary
|
|
110
|
-
ctx_work="$(kubectl config current-context 2>/dev/null || true)"
|
|
111
|
-
case "$ctx_work" in
|
|
112
|
-
kind-gitlab* | kind-devzone*)
|
|
113
|
-
ctx_host="$(KUBECONFIG="${DEVZONE_KUBE_HOST:-$HOME/.kube/hote.config}" kubectl config current-context 2>/dev/null || true)"
|
|
114
|
-
if [ -n "$ctx_host" ] && "$ICI/devzone" kube reachable "$ctx_host"; then
|
|
115
|
-
printf ' ⚠ working cluster: %s (devzone internal cluster); go back: devzone use %s\n' "$ctx_work" "$ctx_host"
|
|
116
|
-
fi
|
|
117
|
-
;;
|
|
118
|
-
esac
|
|
119
|
-
# RBAC check: access check to the PostgreSQL secrets
|
|
120
|
-
ctx_rbac="$(kubectl auth can-i --as=system:serviceaccount:default:default get secrets -n devzone-postgres 2>/dev/null || true)"
|
|
121
|
-
if [ "$ctx_rbac" = "yes" ]; then
|
|
122
|
-
printf ' ⚠ rbac : access to devzone-postgres secrets not restricted\n'
|
|
123
|
-
fi
|
|
124
|
-
ports_state="$(DEVZONE_STATE="$ETAT" devzone port resume 2>/dev/null || echo none)"
|
|
125
|
-
case "$ports_state" in
|
|
126
|
-
none*) printf ' ○ ports to the workstation %s\n' "$ports_state" ;;
|
|
127
|
-
*) printf ' ✔ ports to the workstation %s\n' "$ports_state" ;;
|
|
128
|
-
esac
|
|
129
|
-
# Grouped credentials (#332): the path only, never the content
|
|
130
|
-
if [ -f "$RACINE/.password" ]; then
|
|
131
|
-
printf ' ○ credentials: %s\n' "$RACINE/.password"
|
|
132
|
-
fi
|
|
133
|
-
# Mark set by packages.sh at the failed reapplication (351): names of the packages not installed
|
|
134
|
-
packages_mark="${DEVZONE_PACKAGES_MARKER:-/tmp/devzone-packages.failed}"
|
|
135
|
-
if [ -f "$packages_mark" ]; then
|
|
136
|
-
packages_names=""
|
|
137
|
-
while IFS= read -r n; do
|
|
138
|
-
if [ -n "$n" ]; then
|
|
139
|
-
packages_names="${packages_names:+$packages_names, }$n"
|
|
140
|
-
fi
|
|
141
|
-
done < "$packages_mark"
|
|
142
|
-
echo " ⚠ packages $packages_names: devzone packages"
|
|
143
|
-
fi
|
|
144
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Installs or removes a devzone service (gitlab, postgres, argocd) from inside
|
|
3
|
-
# the Kubernetes workspace pod, with a temporary administrator token (#528).
|
|
4
|
-
# services-admin.sh enable|disable <service> [options of devzone enable]
|
|
5
|
-
# services-admin.sh seed gitlab data of gitlab seeded again, in the pod (#538)
|
|
6
|
-
# Run by the workstation (devzone workspace services, Go) through
|
|
7
|
-
# kubectl exec -i: the token comes on stdin, is never printed and lives only
|
|
8
|
-
# in a temporary kubeconfig removed at the end.
|
|
9
|
-
# Why: the pod has no kubeconfig and its service account is limited (#430),
|
|
10
|
-
# while the installers need an administrator. The temporary kubeconfig holds
|
|
11
|
-
# two contexts on the cluster of the pod (API server kubernetes.default.svc,
|
|
12
|
-
# CA of the pod): devzone-admin, the administrator the installers use through
|
|
13
|
-
# the line cluster=devzone-admin of the state, and devzone, the context the
|
|
14
|
-
# module scripts use (account_token may replace it by the limited account).
|
|
15
|
-
# The cluster line of the state is put back afterwards, and the relays
|
|
16
|
-
# started by the installer are stopped: in the pod the services are reached
|
|
17
|
-
# by the cluster DNS, and a relay would keep the token in use.
|
|
18
|
-
set -euo pipefail
|
|
19
|
-
|
|
20
|
-
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
-
# The devzone command beside this script, not the one of the PATH: the copy
|
|
22
|
-
# that runs the installers is the one of this folder (#591)
|
|
23
|
-
DEVZONE_CMD="$HERE/devzone"
|
|
24
|
-
RACINE="${DEVZONE_ROOT:-$(dirname "$HERE")}"
|
|
25
|
-
ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
26
|
-
SA_DIR="${DEVZONE_SA_DIR:-/var/run/secrets/kubernetes.io/serviceaccount}"
|
|
27
|
-
API_SERVER="${DEVZONE_API_SERVER:-https://kubernetes.default.svc}"
|
|
28
|
-
ADMIN_CONTEXT=devzone-admin
|
|
29
|
-
ADMIN_USER=devzone-services-admin
|
|
30
|
-
ADMIN_CLUSTER=devzone-pod
|
|
31
|
-
|
|
32
|
-
refuse() {
|
|
33
|
-
echo "devzone services: $*" >&2
|
|
34
|
-
exit 2
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
action="${1:-}"
|
|
39
|
-
service="${2:-}"
|
|
40
|
-
case "$action" in
|
|
41
|
-
enable) action=enable ;;
|
|
42
|
-
disable) action=disable ;;
|
|
43
|
-
seed) ;;
|
|
44
|
-
*) refuse "usage: services-admin.sh enable|disable|seed gitlab|postgres|argocd [options]" ;;
|
|
45
|
-
esac
|
|
46
|
-
case "$service" in
|
|
47
|
-
gitlab | postgres | argocd) ;;
|
|
48
|
-
*) refuse "unknown service: ${service:-(none)} (gitlab, postgres, argocd)" ;;
|
|
49
|
-
esac
|
|
50
|
-
# The seed of the data (group, demo project, dev user, runner) is gitlab's (#538)
|
|
51
|
-
if [ "$action" = seed ] && [ "$service" != gitlab ]; then
|
|
52
|
-
refuse "seed: only gitlab"
|
|
53
|
-
fi
|
|
54
|
-
[ "${DEVZONE_WORKSPACE:-}" = kubernetes ] || refuse "only in the Kubernetes workspace pod"
|
|
55
|
-
[ -f "$SA_DIR/ca.crt" ] || refuse "cluster CA not found: $SA_DIR/ca.crt"
|
|
56
|
-
if [ -t 0 ]; then
|
|
57
|
-
refuse "the token is read on stdin (run by devzone workspace services)"
|
|
58
|
-
fi
|
|
59
|
-
token="$(cat)"
|
|
60
|
-
token="${token//[$'\r\n']/}"
|
|
61
|
-
[ -n "$token" ] || refuse "empty token on stdin"
|
|
62
|
-
|
|
63
|
-
kubeconfig="$(mktemp "${TMPDIR:-/tmp}/devzone-services-admin.XXXXXX")"
|
|
64
|
-
chmod 600 "$kubeconfig"
|
|
65
|
-
cluster_before="$(grep -E '^cluster=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true)"
|
|
66
|
-
|
|
67
|
-
# Always at the end, even on failure: kubeconfig removed, relays stopped,
|
|
68
|
-
# cluster line of the state as before
|
|
69
|
-
cleanup() {
|
|
70
|
-
rm -f "$kubeconfig"
|
|
71
|
-
"$DEVZONE_CMD" "$service" relay-stop >/dev/null 2>&1 || true
|
|
72
|
-
if [ -n "$cluster_before" ]; then
|
|
73
|
-
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write cluster "$cluster_before" || true
|
|
74
|
-
else
|
|
75
|
-
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state remove cluster || true
|
|
76
|
-
fi
|
|
77
|
-
}
|
|
78
|
-
trap cleanup EXIT
|
|
79
|
-
|
|
80
|
-
ca_data="$(base64 <"$SA_DIR/ca.crt" | tr -d '\n')"
|
|
81
|
-
cat >"$kubeconfig" <<EOF
|
|
82
|
-
apiVersion: v1
|
|
83
|
-
kind: Config
|
|
84
|
-
clusters:
|
|
85
|
-
- name: $ADMIN_CLUSTER
|
|
86
|
-
cluster:
|
|
87
|
-
server: $API_SERVER
|
|
88
|
-
certificate-authority-data: $ca_data
|
|
89
|
-
users:
|
|
90
|
-
- name: $ADMIN_USER
|
|
91
|
-
user:
|
|
92
|
-
token: $token
|
|
93
|
-
contexts:
|
|
94
|
-
- name: $ADMIN_CONTEXT
|
|
95
|
-
context:
|
|
96
|
-
cluster: $ADMIN_CLUSTER
|
|
97
|
-
user: $ADMIN_USER
|
|
98
|
-
- name: devzone
|
|
99
|
-
context:
|
|
100
|
-
cluster: $ADMIN_CLUSTER
|
|
101
|
-
user: $ADMIN_USER
|
|
102
|
-
current-context: $ADMIN_CONTEXT
|
|
103
|
-
EOF
|
|
104
|
-
unset token ca_data
|
|
105
|
-
|
|
106
|
-
export KUBECONFIG="$kubeconfig"
|
|
107
|
-
export DEVZONE_KUBE_CONFIG="$kubeconfig"
|
|
108
|
-
export DEVZONE_SERVICES_ADMIN=1
|
|
109
|
-
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write cluster "$ADMIN_CONTEXT" || refuse "cannot write the state: $ETAT"
|
|
110
|
-
echo "devzone services: $action $service in the cluster of the pod (temporary administrator)"
|
|
111
|
-
case "$action" in
|
|
112
|
-
# The seed is a module command: devzone gitlab seed (#538)
|
|
113
|
-
seed) "$DEVZONE_CMD" gitlab seed "${@:3}" ;;
|
|
114
|
-
*) "$DEVZONE_CMD" "$action" "$service" "${@:3}" ;;
|
|
115
|
-
esac
|