devzone 4.0.1 → 4.2.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/argocd/apps.sh +1 -1
- package/.devcontainer/argocd/services.sh +1 -1
- package/.devcontainer/devcontainer.json +5 -5
- package/.devcontainer/isolation.sh +1 -1
- package/.devcontainer/rename-legacy-files.sh +42 -5
- package/.devcontainer/services-admin.sh +1 -1
- package/manage/scripts/ci/tools-image.sh +235 -0
- package/manage/scripts/ci/versions-tools-plan.sh +105 -0
- package/manage/scripts/ci/versions.sh +32 -13
- package/manage/scripts/{argocd-services-svc.sh → workspace/argocd-services-svc.sh} +1 -1
- package/manage/scripts/{argocd-services.sh → workspace/argocd-services.sh} +4 -4
- package/manage/scripts/{ports-workspace.sh → workspace/ports-workspace.sh} +1 -1
- package/manage/workspace.sh +20 -20
- package/package.json +1 -1
- /package/manage/scripts/{argocd-workspace.sh → workspace/argocd-workspace.sh} +0 -0
- /package/manage/scripts/{ports-apps.sh → workspace/ports-apps.sh} +0 -0
- /package/manage/scripts/{services-workspace.sh → workspace/services-workspace.sh} +0 -0
- /package/manage/scripts/{workspace-aliases.sh → workspace/workspace-aliases.sh} +0 -0
- /package/manage/scripts/{workspace-clone.sh → workspace/workspace-clone.sh} +0 -0
- /package/manage/scripts/{workspace-copies.sh → workspace/workspace-copies.sh} +0 -0
- /package/manage/scripts/{workspace-egress.sh → workspace/workspace-egress.sh} +0 -0
- /package/manage/scripts/{workspace-update.sh → workspace/workspace-update.sh} +0 -0
- /package/manage/scripts/{workspace-wait.sh → workspace/workspace-wait.sh} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# argocd_app remove <N>
|
|
7
7
|
# apps_reconcile every [app N] of .argocd.conf applied, the others removed
|
|
8
8
|
# Sourced by the container (argocd.sh: kubectl --context devzone) and by the
|
|
9
|
-
# workstation (manage/scripts/argocd-services.sh), after conf.sh and
|
|
9
|
+
# workstation (manage/scripts/workspace/argocd-services.sh), after conf.sh and
|
|
10
10
|
# gitops.sh. The includer defines argocd_kubectl, APPS_GENERATOR, APPS_CMD,
|
|
11
11
|
# ARGOCD_CONF and ARGOCD_CONF_DIR (the devzone folder: token-file paths are
|
|
12
12
|
# relative to it), and may define apps_gitlab_token (root token of the
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
# services_note <svc> on|off writes the [services] section
|
|
20
20
|
# chart_require <svc> chart charts/devzone-<svc> named devzone-<svc>, or code 2
|
|
21
21
|
# Sourced after conf.sh and gitops.sh by the workstation
|
|
22
|
-
# (manage/scripts/argocd-services.sh) and by the container (argocd.sh). The
|
|
22
|
+
# (manage/scripts/workspace/argocd-services.sh) and by the container (argocd.sh). The
|
|
23
23
|
# includer defines argocd_kubectl, APPS_GENERATOR, ARGOCD_CONF and
|
|
24
24
|
# ARGOCD_CONF_DIR (the devzone folder: relative paths there), DEVZONE_REPO_URL
|
|
25
25
|
# and argocd_revision, the secret hook of each service
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"version": "21",
|
|
9
9
|
"jdkDistro": "tem",
|
|
10
10
|
"installMaven": true,
|
|
11
|
-
// Pinned
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// new version's archive (unzip -t on the
|
|
15
|
-
// and linuxarm64), then bump this value.
|
|
11
|
+
// Pinned for a reproducible build. It does not prevent the intermittent
|
|
12
|
+
// "archive was corrupt" failure of the SDKMAN download, which also hit this
|
|
13
|
+
// pinned version (#758): the retry of the image jobs (image-workspace.yml)
|
|
14
|
+
// is the remedy. Update: check the new version's archive (unzip -t on the
|
|
15
|
+
// SDKMAN download mirror, linuxx64 and linuxarm64), then bump this value.
|
|
16
16
|
"mavenVersion": "3.9.16",
|
|
17
17
|
"installGradle": true,
|
|
18
18
|
"gradleVersion": "9.8.2"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Network isolation and access authorization between devzone namespaces.
|
|
3
3
|
# File <= 250 lines: functions namespace_isolate, allow, forbid.
|
|
4
4
|
# These functions modify NetworkPolicies in the Kubernetes cluster.
|
|
5
|
-
#
|
|
5
|
+
# Loaded by argocd.sh, catalog.sh, mysql.sh, gitlab.sh and postgres.sh; shipped with the package.
|
|
6
6
|
|
|
7
7
|
# Sets an isolating NetworkPolicy in a namespace.
|
|
8
8
|
# Only the pods of the same namespace can reach the services.
|
|
@@ -5,24 +5,61 @@
|
|
|
5
5
|
# platform= (lot 4). Called by the pod startup, by the workspace init, and on the
|
|
6
6
|
# workstation by devzone update and workspace update.
|
|
7
7
|
# Idempotent: a name is renamed only when the old one exists and the new one
|
|
8
|
-
# does not, so a second run does nothing.
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# does not, so a second run does nothing. Two folders with both names are
|
|
9
|
+
# merged, the old one emptied and removed. An existing file is never
|
|
10
|
+
# overwritten. One line per rename or merge on stdout, exit 0. No alias of the
|
|
11
|
+
# old names is kept after this migration. bash 3.2 (macOS).
|
|
11
12
|
# DEVZONE_ROOT devzone folder (default: the parent of this .devcontainer)
|
|
12
13
|
# DEVZONE_TMP_DIR temporary folder (default: /tmp), set by the tests
|
|
13
14
|
|
|
14
15
|
ROOT="${DEVZONE_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
15
16
|
TMP_DIR="${DEVZONE_TMP_DIR:-/tmp}"
|
|
16
17
|
|
|
18
|
+
# is_real_dir PATH: true for a folder that is not a symbolic link
|
|
19
|
+
is_real_dir() {
|
|
20
|
+
[ -d "$1" ] && [ ! -L "$1" ]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# merge_legacy OLD NEW: both are folders. Each entry of OLD that NEW does not
|
|
24
|
+
# have is moved into NEW; an entry present on both sides is never overwritten,
|
|
25
|
+
# it stays in OLD and a message on stderr names it. OLD is removed (rmdir) only
|
|
26
|
+
# when it is left empty, and then the merge is announced on stdout. Hidden
|
|
27
|
+
# entries are merged too. The shell options live in a subshell, so they do not
|
|
28
|
+
# reach the other migrations.
|
|
29
|
+
merge_legacy() {
|
|
30
|
+
local old="$1" new="$2"
|
|
31
|
+
(
|
|
32
|
+
shopt -s dotglob nullglob
|
|
33
|
+
local entry target
|
|
34
|
+
for entry in "$old"/*; do
|
|
35
|
+
target="$new/${entry##*/}"
|
|
36
|
+
if [ -e "$target" ] || [ -L "$target" ]; then
|
|
37
|
+
echo "devzone : $entry kept: $target already exists" >&2
|
|
38
|
+
elif ! mv -- "$entry" "$target"; then
|
|
39
|
+
echo "devzone : $entry not merged into $target" >&2
|
|
40
|
+
fi
|
|
41
|
+
done
|
|
42
|
+
if rmdir -- "$old" 2>/dev/null; then
|
|
43
|
+
echo "devzone : $old merged into $new"
|
|
44
|
+
fi
|
|
45
|
+
)
|
|
46
|
+
return 0
|
|
47
|
+
}
|
|
48
|
+
|
|
17
49
|
# rename_legacy OLD NEW: moves OLD to NEW when OLD exists and NEW does not.
|
|
18
|
-
#
|
|
50
|
+
# When both are folders, they are merged (see merge_legacy). Any other conflict
|
|
51
|
+
# is reported on stderr and both names are left as they are.
|
|
19
52
|
rename_legacy() {
|
|
20
53
|
local old="$1" new="$2"
|
|
21
54
|
if [ ! -e "$old" ] && [ ! -L "$old" ]; then
|
|
22
55
|
return 0
|
|
23
56
|
fi
|
|
24
57
|
if [ -e "$new" ] || [ -L "$new" ]; then
|
|
25
|
-
|
|
58
|
+
if is_real_dir "$old" && is_real_dir "$new"; then
|
|
59
|
+
merge_legacy "$old" "$new"
|
|
60
|
+
else
|
|
61
|
+
echo "devzone : $old kept, $new already exists" >&2
|
|
62
|
+
fi
|
|
26
63
|
return 0
|
|
27
64
|
fi
|
|
28
65
|
if mv -- "$old" "$new"; then
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# the Kubernetes workspace pod, with a temporary administrator token (#528).
|
|
4
4
|
# services-admin.sh enable|disable <service> [options of devzone enable]
|
|
5
5
|
# services-admin.sh seed gitlab data of gitlab seeded again, in the pod (#538)
|
|
6
|
-
# Run by the workstation (manage/scripts/services-workspace.sh) through
|
|
6
|
+
# Run by the workstation (manage/scripts/workspace/services-workspace.sh) through
|
|
7
7
|
# kubectl exec -i: the token comes on stdin, is never printed and lives only
|
|
8
8
|
# in a temporary kubeconfig removed at the end.
|
|
9
9
|
# Why: the pod has no kubeconfig and its service account is limited (#430),
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# shellcheck shell=bash
|
|
2
|
+
# Tools of the workspace image (Dockerfile): Go, k9s, actionlint, gitleaks and
|
|
3
|
+
# kind. Sourced by versions.sh, which defines DOCKERFILE and newer(); not meant
|
|
4
|
+
# to run on its own. Compatible with bash 3.2 (macOS).
|
|
5
|
+
# bash manage/scripts/ci/versions.sh --tools
|
|
6
|
+
# one "tool pinned upstream" line per tool behind its upstream release,
|
|
7
|
+
# with " majeure" added when the major version differs; nothing otherwise
|
|
8
|
+
# bash manage/scripts/ci/versions.sh --apply <tool> <version> [--major]
|
|
9
|
+
# replaces the version and both sha256 fingerprints of the tool in the
|
|
10
|
+
# Dockerfile, nothing else
|
|
11
|
+
# shellcheck disable=SC2154 # DOCKERFILE and newer() are defined by versions.sh
|
|
12
|
+
|
|
13
|
+
IMAGE_TOOLS="go k9s actionlint gitleaks kind"
|
|
14
|
+
|
|
15
|
+
# Prints an error on stderr and exits 1
|
|
16
|
+
fail() {
|
|
17
|
+
echo "versions: $*" >&2
|
|
18
|
+
exit 1
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# True if $1 is a tool of the image
|
|
22
|
+
tool_known() {
|
|
23
|
+
case " $IMAGE_TOOLS " in
|
|
24
|
+
*" $1 "*) return 0 ;;
|
|
25
|
+
*) return 1 ;;
|
|
26
|
+
esac
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Dockerfile variable holding the version of tool $1
|
|
30
|
+
tool_version_var() {
|
|
31
|
+
case "$1" in
|
|
32
|
+
go) echo GO_VERSION ;;
|
|
33
|
+
k9s) echo K9S_VERSION ;;
|
|
34
|
+
actionlint) echo ACTIONLINT_VERSION ;;
|
|
35
|
+
gitleaks) echo GITLEAKS_VERSION ;;
|
|
36
|
+
kind) echo KIND_VERSION ;;
|
|
37
|
+
esac
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Dockerfile variable holding the sha256 of tool $1 for architecture $2 (arm64
|
|
41
|
+
# or amd64). k9s, actionlint, gitleaks and kind use one name for both
|
|
42
|
+
# architectures: see tool_sha_occurrence
|
|
43
|
+
tool_sha_var() {
|
|
44
|
+
case "$1:$2" in
|
|
45
|
+
go:arm64) echo GO_SHA256_ARM64 ;;
|
|
46
|
+
go:amd64) echo GO_SHA256_AMD64 ;;
|
|
47
|
+
k9s:*) echo k9s_sha ;;
|
|
48
|
+
actionlint:*) echo al_sha ;;
|
|
49
|
+
gitleaks:*) echo gl_sha ;;
|
|
50
|
+
kind:*) echo kind_sha ;;
|
|
51
|
+
esac
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# Which line naming the sha256 variable of tool $1 for architecture $2 is
|
|
55
|
+
# meant: arm64 comes first in the Dockerfile, amd64 second when both share a name
|
|
56
|
+
tool_sha_occurrence() {
|
|
57
|
+
if [ "$2" = amd64 ] && [ "$(tool_sha_var "$1" arm64)" = "$(tool_sha_var "$1" amd64)" ]; then
|
|
58
|
+
echo 2
|
|
59
|
+
else
|
|
60
|
+
echo 1
|
|
61
|
+
fi
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# GitHub repository releasing tool $1 (Go is published on go.dev instead)
|
|
65
|
+
tool_repo() {
|
|
66
|
+
case "$1" in
|
|
67
|
+
k9s) echo derailed/k9s ;;
|
|
68
|
+
actionlint) echo rhysd/actionlint ;;
|
|
69
|
+
gitleaks) echo gitleaks/gitleaks ;;
|
|
70
|
+
kind) echo kubernetes-sigs/kind ;;
|
|
71
|
+
esac
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# URL of the archive of tool $1, version $2, architecture $3 (arm64 or amd64,
|
|
75
|
+
# as dpkg names them). kind is published as a bare binary, not an archive
|
|
76
|
+
tool_archive_url() {
|
|
77
|
+
local tool="$1" version="$2" arch="$3" gl_arch
|
|
78
|
+
case "$tool" in
|
|
79
|
+
go) echo "https://go.dev/dl/go${version}.linux-${arch}.tar.gz" ;;
|
|
80
|
+
k9s) echo "https://github.com/derailed/k9s/releases/download/v${version}/k9s_Linux_${arch}.tar.gz" ;;
|
|
81
|
+
actionlint) echo "https://github.com/rhysd/actionlint/releases/download/v${version}/actionlint_${version}_linux_${arch}.tar.gz" ;;
|
|
82
|
+
gitleaks)
|
|
83
|
+
gl_arch="$arch"
|
|
84
|
+
[ "$arch" != amd64 ] || gl_arch=x64
|
|
85
|
+
echo "https://github.com/gitleaks/gitleaks/releases/download/v${version}/gitleaks_${version}_linux_${gl_arch}.tar.gz"
|
|
86
|
+
;;
|
|
87
|
+
kind) echo "https://github.com/kubernetes-sigs/kind/releases/download/v${version}/kind-linux-${arch}" ;;
|
|
88
|
+
esac
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# Major version (first numeric component) of version $1
|
|
92
|
+
major_of() {
|
|
93
|
+
local version="${1#v}"
|
|
94
|
+
echo "${version%%.*}"
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Version pinned in the Dockerfile for tool $1 (empty if absent)
|
|
98
|
+
tool_pinned() {
|
|
99
|
+
sed -nE "s/^ARG $(tool_version_var "$1")=([^[:space:]]+)\$/\1/p" "$DOCKERFILE"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# Highest version among the lines read on stdin (empty if none)
|
|
103
|
+
highest() {
|
|
104
|
+
local best="" version
|
|
105
|
+
while read -r version; do
|
|
106
|
+
[ -n "$version" ] || continue
|
|
107
|
+
if [ -z "$best" ] || newer "$version" "$best"; then
|
|
108
|
+
best="$version"
|
|
109
|
+
fi
|
|
110
|
+
done
|
|
111
|
+
printf '%s\n' "$best"
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Latest stable version of tool $1 upstream: the go.dev index for Go, the
|
|
115
|
+
# latest GitHub release otherwise (empty if the source does not answer)
|
|
116
|
+
tool_latest() {
|
|
117
|
+
if [ "$1" = go ]; then
|
|
118
|
+
curl -fsSL "https://go.dev/dl/?mode=json&include=all" 2>/dev/null |
|
|
119
|
+
jq -r '.[] | select(.stable == true) | .version' | sed 's/^go//' | highest
|
|
120
|
+
else
|
|
121
|
+
curl -fsSL "https://api.github.com/repos/$(tool_repo "$1")/releases/latest" 2>/dev/null |
|
|
122
|
+
jq -r '.tag_name // empty' | sed 's/^v//'
|
|
123
|
+
fi
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# One "tool pinned upstream" line per tool whose upstream version is newer than
|
|
127
|
+
# the pinned one, with " majeure" when the major differs; nothing otherwise
|
|
128
|
+
tools_outdated() {
|
|
129
|
+
local tool pinned upstream
|
|
130
|
+
for tool in $IMAGE_TOOLS; do
|
|
131
|
+
pinned="$(tool_pinned "$tool")"
|
|
132
|
+
upstream="$(tool_latest "$tool")" || upstream=""
|
|
133
|
+
[ -n "$upstream" ] || fail "cannot read upstream version for $tool"
|
|
134
|
+
if newer "$upstream" "$pinned"; then
|
|
135
|
+
if [ "$(major_of "$upstream")" = "$(major_of "$pinned")" ]; then
|
|
136
|
+
echo "$tool $pinned $upstream"
|
|
137
|
+
else
|
|
138
|
+
echo "$tool $pinned $upstream majeure"
|
|
139
|
+
fi
|
|
140
|
+
fi
|
|
141
|
+
done
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
# sha256 of file $1, with sha256sum (Linux) or shasum (macOS)
|
|
145
|
+
sha256_of() {
|
|
146
|
+
if command -v sha256sum >/dev/null 2>&1; then
|
|
147
|
+
sha256sum "$1" | awk '{ print $1 }'
|
|
148
|
+
else
|
|
149
|
+
shasum -a 256 "$1" | awk '{ print $1 }'
|
|
150
|
+
fi
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
# sha256 of the Go archive of version $1 for architecture $2, as listed by
|
|
154
|
+
# go.dev (empty if the index does not list it)
|
|
155
|
+
go_official_sha() {
|
|
156
|
+
curl -fsSL "https://go.dev/dl/?mode=json&include=all" 2>/dev/null |
|
|
157
|
+
jq -r --arg file "go$1.linux-$2.tar.gz" \
|
|
158
|
+
'[.[] | .files[]? | select(.filename == $file) | .sha256][0] // empty'
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
# Downloads the archive of tool $1, version $2, architecture $3 into directory
|
|
162
|
+
# $4, checks it against the official sha256 when go.dev publishes one, and
|
|
163
|
+
# prints its sha256
|
|
164
|
+
archive_sha() {
|
|
165
|
+
local tool="$1" version="$2" arch="$3" dir="$4" url file sha official
|
|
166
|
+
url="$(tool_archive_url "$tool" "$version" "$arch")"
|
|
167
|
+
file="$dir/$arch.archive"
|
|
168
|
+
curl -fsSL "$url" -o "$file" 2>/dev/null || fail "archive not found: $url"
|
|
169
|
+
sha="$(sha256_of "$file")"
|
|
170
|
+
if [ "$tool" = go ]; then
|
|
171
|
+
official="$(go_official_sha "$version" "$arch")" || official=""
|
|
172
|
+
[ -n "$official" ] || fail "no official sha256 for $url on go.dev"
|
|
173
|
+
[ "$official" = "$sha" ] ||
|
|
174
|
+
fail "sha256 of $url ($sha) differs from the official one ($official)"
|
|
175
|
+
fi
|
|
176
|
+
printf '%s\n' "$sha"
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
# Sets the value of the single "ARG <var>=" line of file $1 to $3 (variable $2)
|
|
180
|
+
set_arg() {
|
|
181
|
+
local file="$1" var="$2" value="$3" count
|
|
182
|
+
count="$(grep -c "^ARG $var=" "$file" || true)"
|
|
183
|
+
[ "$count" = 1 ] || fail "$var: expected one ARG line in the Dockerfile, found $count"
|
|
184
|
+
awk -v prefix="ARG $var=" -v value="$value" '
|
|
185
|
+
index($0, prefix) == 1 { print prefix value; next }
|
|
186
|
+
{ print }
|
|
187
|
+
' "$file" >"$file.next" && mv "$file.next" "$file"
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
# Sets the sha256 of variable $2 in file $1, on the line of its occurrence $3
|
|
191
|
+
# (counted from 1), to $4
|
|
192
|
+
set_sha() {
|
|
193
|
+
local file="$1" var="$2" occurrence="$3" hex="$4" line
|
|
194
|
+
line="$(grep -nE "(^|[^A-Za-z0-9_])${var}=[0-9a-f]{64}([^0-9a-f]|\$)" "$file" |
|
|
195
|
+
sed -n "${occurrence}p" | cut -d: -f1)" || line=""
|
|
196
|
+
[ -n "$line" ] || fail "$var: sha256 line not found in the Dockerfile"
|
|
197
|
+
awk -v n="$line" -v var="$var" -v hex="$hex" '
|
|
198
|
+
NR == n { sub(var "=[0-9a-f]+", var "=" hex) }
|
|
199
|
+
{ print }
|
|
200
|
+
' "$file" >"$file.next" && mv "$file.next" "$file"
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
# Replaces the version and both sha256 fingerprints of tool $1 with version $2
|
|
204
|
+
# in the Dockerfile, nothing else. Refused: an archive that cannot be fetched,
|
|
205
|
+
# a go.dev checksum that differs, a major version other than the pinned one
|
|
206
|
+
# unless $3 is --major
|
|
207
|
+
apply_tool() {
|
|
208
|
+
local tool="$1" version="${2:-}" option="${3:-}" pinned sha_amd64 sha_arm64
|
|
209
|
+
case "$version" in
|
|
210
|
+
"" | *[!0-9A-Za-z.+-]*) fail "invalid version: ${version:-(none)}" ;;
|
|
211
|
+
esac
|
|
212
|
+
case "$option" in
|
|
213
|
+
"" | --major) ;;
|
|
214
|
+
*)
|
|
215
|
+
echo "usage: bash manage/scripts/ci/versions.sh --apply <tool> <version> [--major]" >&2
|
|
216
|
+
exit 2
|
|
217
|
+
;;
|
|
218
|
+
esac
|
|
219
|
+
pinned="$(tool_pinned "$tool")"
|
|
220
|
+
[ -n "$pinned" ] || fail "no pinned version of $tool in the Dockerfile"
|
|
221
|
+
if [ "$(major_of "$version")" != "$(major_of "$pinned")" ] && [ "$option" != --major ]; then
|
|
222
|
+
fail "$tool $version is a major version (pinned $pinned): refused without --major"
|
|
223
|
+
fi
|
|
224
|
+
# Global on purpose: the EXIT trap runs after this function has returned
|
|
225
|
+
TOOLS_WORK="$(mktemp -d)"
|
|
226
|
+
trap 'rm -rf "$TOOLS_WORK"' EXIT
|
|
227
|
+
sha_amd64="$(archive_sha "$tool" "$version" amd64 "$TOOLS_WORK")" || exit 1
|
|
228
|
+
sha_arm64="$(archive_sha "$tool" "$version" arm64 "$TOOLS_WORK")" || exit 1
|
|
229
|
+
cp "$DOCKERFILE" "$TOOLS_WORK/new"
|
|
230
|
+
set_arg "$TOOLS_WORK/new" "$(tool_version_var "$tool")" "$version"
|
|
231
|
+
set_sha "$TOOLS_WORK/new" "$(tool_sha_var "$tool" arm64)" 1 "$sha_arm64"
|
|
232
|
+
set_sha "$TOOLS_WORK/new" "$(tool_sha_var "$tool" amd64)" "$(tool_sha_occurrence "$tool" amd64)" "$sha_amd64"
|
|
233
|
+
# Written back into the existing file: its permissions are kept
|
|
234
|
+
cat "$TOOLS_WORK/new" >"$DOCKERFILE"
|
|
235
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Plan of the image tools to bump, for the versions workflow. Reads the
|
|
3
|
+
# "tool pinned upstream [majeure]" lines of "versions.sh --tools" on stdin and
|
|
4
|
+
# prints one TAB-separated line per tool to act on, with the fields:
|
|
5
|
+
# kind tool pinned upstream title notes ticket
|
|
6
|
+
# plan a new ticket, the design, the bump and the push; at most MAX
|
|
7
|
+
# (3 by default) per run, the others wait for the next run
|
|
8
|
+
# existant the App has an open ticket for this tool with another title:
|
|
9
|
+
# the workflow only updates it (no branch); ticket is its number
|
|
10
|
+
# majeure a next major version: listed in the job summary, never applied
|
|
11
|
+
# A tool whose open ticket of the author has the same title is not listed.
|
|
12
|
+
# Usage: versions.sh --tools | bash versions-tools-plan.sh <author> [max]
|
|
13
|
+
# Compatible with bash 3.2 (macOS).
|
|
14
|
+
set -euo pipefail
|
|
15
|
+
|
|
16
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
AUTHOR="${1:-}"
|
|
18
|
+
MAX="${2:-3}"
|
|
19
|
+
|
|
20
|
+
if [ -z "$AUTHOR" ]; then
|
|
21
|
+
echo "usage: versions.sh --tools | bash versions-tools-plan.sh <author> [max]" >&2
|
|
22
|
+
exit 2
|
|
23
|
+
fi
|
|
24
|
+
case "$MAX" in
|
|
25
|
+
'' | *[!0-9]*)
|
|
26
|
+
echo "versions-tools-plan: invalid max: $MAX" >&2
|
|
27
|
+
exit 2
|
|
28
|
+
;;
|
|
29
|
+
esac
|
|
30
|
+
|
|
31
|
+
# Release notes of tool $1 at version $2 (Go publishes its notes on go.dev)
|
|
32
|
+
notes_of() {
|
|
33
|
+
case "$1" in
|
|
34
|
+
go) echo "https://go.dev/doc/devel/release#go$2" ;;
|
|
35
|
+
k9s) echo "https://github.com/derailed/k9s/releases/tag/v$2" ;;
|
|
36
|
+
actionlint) echo "https://github.com/rhysd/actionlint/releases/tag/v$2" ;;
|
|
37
|
+
gitleaks) echo "https://github.com/gitleaks/gitleaks/releases/tag/v$2" ;;
|
|
38
|
+
kind) echo "https://github.com/kubernetes-sigs/kind/releases/tag/v$2" ;;
|
|
39
|
+
*)
|
|
40
|
+
echo "versions-tools-plan: unknown tool: $1" >&2
|
|
41
|
+
exit 1
|
|
42
|
+
;;
|
|
43
|
+
esac
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Title of the ticket and of the commit for the bump of tool $1 from $2 to $3
|
|
47
|
+
title_of() {
|
|
48
|
+
echo "$1 $2 → $3 dans l'image"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# "number<TAB>title" of the open ticket of AUTHOR for tool $1, nothing otherwise
|
|
52
|
+
open_ticket_of() {
|
|
53
|
+
bash "$HERE/versions.sh" --existing-ticket "$1" "$AUTHOR" </dev/null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Prints one plan line: kind, tool, pinned, upstream, title, notes, ticket
|
|
57
|
+
emit() {
|
|
58
|
+
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$4" "$5" "$6" "${7:--}"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
count=0
|
|
62
|
+
deferred=""
|
|
63
|
+
while read -r tool pinned upstream rest; do
|
|
64
|
+
[ -n "${tool:-}" ] || continue
|
|
65
|
+
if [ -z "${upstream:-}" ]; then
|
|
66
|
+
echo "versions-tools-plan: invalid line: $tool $pinned" >&2
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
case "$rest" in
|
|
70
|
+
'') kind=plan ;;
|
|
71
|
+
majeure) kind=majeure ;;
|
|
72
|
+
*)
|
|
73
|
+
echo "versions-tools-plan: invalid line: $tool $pinned $upstream $rest" >&2
|
|
74
|
+
exit 1
|
|
75
|
+
;;
|
|
76
|
+
esac
|
|
77
|
+
title="$(title_of "$tool" "$pinned" "$upstream")"
|
|
78
|
+
notes="$(notes_of "$tool" "$upstream")"
|
|
79
|
+
|
|
80
|
+
if [ "$kind" = majeure ]; then
|
|
81
|
+
emit majeure "$tool" "$pinned" "$upstream" "$title" "$notes"
|
|
82
|
+
continue
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
existing="$(open_ticket_of "$tool")"
|
|
86
|
+
if [ -n "$existing" ]; then
|
|
87
|
+
number="${existing%%$'\t'*}"
|
|
88
|
+
existing_title="${existing#*$'\t'}"
|
|
89
|
+
if [ "$existing_title" != "$title" ]; then
|
|
90
|
+
emit existant "$tool" "$pinned" "$upstream" "$title" "$notes" "$number"
|
|
91
|
+
fi
|
|
92
|
+
continue
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
if [ "$count" -ge "$MAX" ]; then
|
|
96
|
+
deferred="$deferred $tool"
|
|
97
|
+
continue
|
|
98
|
+
fi
|
|
99
|
+
count=$((count + 1))
|
|
100
|
+
emit plan "$tool" "$pinned" "$upstream" "$title" "$notes"
|
|
101
|
+
done
|
|
102
|
+
|
|
103
|
+
if [ -n "$deferred" ]; then
|
|
104
|
+
echo "versions-tools-plan: deferred to the next run (at most $MAX per run):$deferred" >&2
|
|
105
|
+
fi
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Pinned
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# Pinned versions: compares repowarden (versions.env) and AI assistants
|
|
3
|
+
# (IA_… lines, devzone) to the latest npm version, or applies an upgrade; and
|
|
4
|
+
# the tools of the workspace image (Dockerfile, see tools-image.sh).
|
|
5
5
|
# bash manage/scripts/ci/versions.sh
|
|
6
6
|
# one "package old new" line per outdated package, nothing otherwise
|
|
7
7
|
# bash manage/scripts/ci/versions.sh --installed
|
|
8
8
|
# one "package pinned installed" line per installed tool behind its pin
|
|
9
9
|
# bash manage/scripts/ci/versions.sh --apply <package> <version>
|
|
10
10
|
# replaces that pinned version in its file, nothing else
|
|
11
|
+
# bash manage/scripts/ci/versions.sh --tools
|
|
12
|
+
# one "tool pinned upstream" line per image tool (Go, k9s, actionlint,
|
|
13
|
+
# gitleaks, kind) behind its upstream release, " majeure" added when the
|
|
14
|
+
# major differs; nothing otherwise
|
|
15
|
+
# bash manage/scripts/ci/versions.sh --apply <tool> <version> [--major]
|
|
16
|
+
# replaces the version and both sha256 fingerprints of that tool in the
|
|
17
|
+
# Dockerfile, nothing else; another major version needs --major
|
|
11
18
|
# bash manage/scripts/ci/versions.sh --existing-ticket <package> <author>
|
|
12
19
|
# "number<TAB>title" of the open ticket by <author>, nothing otherwise
|
|
13
20
|
# Compatible with bash 3.2 (macOS).
|
|
@@ -16,6 +23,8 @@ set -euo pipefail
|
|
|
16
23
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
|
17
24
|
VERSIONS_ENV="$HERE/.devcontainer/versions.env"
|
|
18
25
|
DEVZONE="$HERE/.devcontainer/devzone"
|
|
26
|
+
# shellcheck disable=SC2034 # read by tools-image.sh (sourced)
|
|
27
|
+
DOCKERFILE="$HERE/.devcontainer/Dockerfile"
|
|
19
28
|
|
|
20
29
|
# List "package version" of pinned versions in both files; in devzone, one
|
|
21
30
|
# IA_<NAME>=<package>@<version> line per AI assistant
|
|
@@ -148,22 +157,32 @@ apply() {
|
|
|
148
157
|
rm -f "$tmp"
|
|
149
158
|
}
|
|
150
159
|
|
|
160
|
+
usage() {
|
|
161
|
+
echo "usage: bash manage/scripts/ci/versions.sh [--installed | --tools | --apply <package|tool> <version> [--major] | --existing-ticket <package> <author>]" >&2
|
|
162
|
+
exit 2
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# Tools of the image (--tools, --apply <tool>)
|
|
166
|
+
# shellcheck source=SCRIPTDIR/tools-image.sh
|
|
167
|
+
. "$(dirname "${BASH_SOURCE[0]}")/tools-image.sh"
|
|
168
|
+
|
|
151
169
|
case "${1:-}" in
|
|
152
170
|
"") list_outdated ;;
|
|
153
171
|
--installed | --installees) compare_installed ;;
|
|
172
|
+
--tools) tools_outdated ;;
|
|
154
173
|
--apply | --appliquer)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
174
|
+
if tool_known "${2:-}"; then
|
|
175
|
+
[ "$#" -le 4 ] || usage
|
|
176
|
+
apply_tool "$2" "${3:-}" "${4:-}"
|
|
177
|
+
else
|
|
178
|
+
[ "$#" -eq 3 ] || usage
|
|
179
|
+
apply "$2" "$3"
|
|
180
|
+
fi
|
|
158
181
|
;;
|
|
159
182
|
--existing-ticket | --ticket-existant)
|
|
160
|
-
[ "$#" -eq 3 ] ||
|
|
161
|
-
{ echo "usage: bash manage/scripts/ci/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2; exit 2; }
|
|
183
|
+
[ "$#" -eq 3 ] || usage
|
|
162
184
|
existing_ticket "$2" "$3"
|
|
163
185
|
;;
|
|
164
|
-
-h | --help) sed -n '2
|
|
165
|
-
*)
|
|
166
|
-
echo "usage: bash manage/scripts/ci/versions.sh [--installed | --apply <package> <version> | --existing-ticket <package> <author>]" >&2
|
|
167
|
-
exit 2
|
|
168
|
-
;;
|
|
186
|
+
-h | --help) sed -n '2,/^# Compatible/p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//' ;;
|
|
187
|
+
*) usage ;;
|
|
169
188
|
esac
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# apart (postgres-admin, mysql-admin, mirrored and never printed), Helm
|
|
4
4
|
# parameters of the mysql chart (existing volume claim), and the
|
|
5
5
|
# devzone workspace services enable|disable switch when Argo CD holds the
|
|
6
|
-
# charts. Sourced by manage/scripts/argocd-services.sh. bash 3.2 (macOS).
|
|
6
|
+
# charts. Sourced by manage/scripts/workspace/argocd-services.sh. bash 3.2 (macOS).
|
|
7
7
|
|
|
8
8
|
# Namespace of the service: labelled, isolated like the other devzone-*
|
|
9
9
|
# (services.sh: services_namespace_prepare)
|
|
@@ -46,16 +46,16 @@ GITOPS_CMD="devzone workspace argocd init"
|
|
|
46
46
|
ARGOCD_CONF_DIR="$PWD"
|
|
47
47
|
# shellcheck disable=SC2034
|
|
48
48
|
ARGOCD_CONF="$PWD/.argocd.conf"
|
|
49
|
-
# shellcheck source
|
|
49
|
+
# shellcheck source=../../../.devcontainer/argocd/conf.sh
|
|
50
50
|
# shellcheck disable=SC1091
|
|
51
51
|
. "$RACINE/.devcontainer/argocd/conf.sh"
|
|
52
|
-
# shellcheck source
|
|
52
|
+
# shellcheck source=../../../.devcontainer/argocd/gitops.sh
|
|
53
53
|
# shellcheck disable=SC1091
|
|
54
54
|
. "$RACINE/.devcontainer/argocd/gitops.sh"
|
|
55
|
-
# shellcheck source
|
|
55
|
+
# shellcheck source=../../../.devcontainer/argocd/apps.sh
|
|
56
56
|
# shellcheck disable=SC1091
|
|
57
57
|
. "$RACINE/.devcontainer/argocd/apps.sh"
|
|
58
|
-
# shellcheck source
|
|
58
|
+
# shellcheck source=../../../.devcontainer/argocd/services.sh
|
|
59
59
|
# shellcheck disable=SC1091
|
|
60
60
|
. "$RACINE/.devcontainer/argocd/services.sh"
|
|
61
61
|
argocd_kubectl() { ak "$@"; }
|
|
@@ -14,7 +14,7 @@ PW_INTERNAL=" 2475 1234 "
|
|
|
14
14
|
# pgAdmin service port: read from the service, without it nothing is relayed.
|
|
15
15
|
PW_JSONPATH='jsonpath={.spec.ports[0].port}'
|
|
16
16
|
# Cluster Services relayed as applications (#611).
|
|
17
|
-
# shellcheck source=manage/scripts/ports-apps.sh
|
|
17
|
+
# shellcheck source=manage/scripts/workspace/ports-apps.sh
|
|
18
18
|
. "$(dirname "${BASH_SOURCE[0]}")/ports-apps.sh"
|
|
19
19
|
|
|
20
20
|
# Watcher state folder: lock, pid, relays, reported ports, log.
|
package/manage/workspace.sh
CHANGED
|
@@ -165,28 +165,28 @@ copy_from() {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
# French names of the command and compatibility aliases (lot 3, #508)
|
|
168
|
-
# shellcheck source=manage/scripts/workspace-aliases.sh
|
|
169
|
-
. "$HERE/scripts/workspace-aliases.sh"
|
|
168
|
+
# shellcheck source=manage/scripts/workspace/workspace-aliases.sh
|
|
169
|
+
. "$HERE/scripts/workspace/workspace-aliases.sh"
|
|
170
170
|
# shellcheck source=manage/scripts/kube-ready.sh
|
|
171
171
|
. "$HERE/scripts/kube-ready.sh"
|
|
172
|
-
# shellcheck source=manage/scripts/workspace-wait.sh
|
|
173
|
-
. "$HERE/scripts/workspace-wait.sh"
|
|
174
|
-
# shellcheck source=manage/scripts/workspace-clone.sh
|
|
175
|
-
. "$HERE/scripts/workspace-clone.sh"
|
|
176
|
-
# shellcheck source=manage/scripts/workspace-copies.sh
|
|
177
|
-
. "$HERE/scripts/workspace-copies.sh"
|
|
178
|
-
# shellcheck source=manage/scripts/ports-workspace.sh
|
|
179
|
-
. "$HERE/scripts/ports-workspace.sh"
|
|
180
|
-
# shellcheck source=manage/scripts/services-workspace.sh
|
|
181
|
-
. "$HERE/scripts/services-workspace.sh"
|
|
182
|
-
# shellcheck source=manage/scripts/argocd-workspace.sh
|
|
183
|
-
. "$HERE/scripts/argocd-workspace.sh"
|
|
184
|
-
# shellcheck source=manage/scripts/argocd-services.sh
|
|
185
|
-
. "$HERE/scripts/argocd-services.sh"
|
|
186
|
-
# shellcheck source=manage/scripts/workspace-update.sh
|
|
187
|
-
. "$HERE/scripts/workspace-update.sh"
|
|
188
|
-
# shellcheck source=manage/scripts/workspace-egress.sh
|
|
189
|
-
. "$HERE/scripts/workspace-egress.sh"
|
|
172
|
+
# shellcheck source=manage/scripts/workspace/workspace-wait.sh
|
|
173
|
+
. "$HERE/scripts/workspace/workspace-wait.sh"
|
|
174
|
+
# shellcheck source=manage/scripts/workspace/workspace-clone.sh
|
|
175
|
+
. "$HERE/scripts/workspace/workspace-clone.sh"
|
|
176
|
+
# shellcheck source=manage/scripts/workspace/workspace-copies.sh
|
|
177
|
+
. "$HERE/scripts/workspace/workspace-copies.sh"
|
|
178
|
+
# shellcheck source=manage/scripts/workspace/ports-workspace.sh
|
|
179
|
+
. "$HERE/scripts/workspace/ports-workspace.sh"
|
|
180
|
+
# shellcheck source=manage/scripts/workspace/services-workspace.sh
|
|
181
|
+
. "$HERE/scripts/workspace/services-workspace.sh"
|
|
182
|
+
# shellcheck source=manage/scripts/workspace/argocd-workspace.sh
|
|
183
|
+
. "$HERE/scripts/workspace/argocd-workspace.sh"
|
|
184
|
+
# shellcheck source=manage/scripts/workspace/argocd-services.sh
|
|
185
|
+
. "$HERE/scripts/workspace/argocd-services.sh"
|
|
186
|
+
# shellcheck source=manage/scripts/workspace/workspace-update.sh
|
|
187
|
+
. "$HERE/scripts/workspace/workspace-update.sh"
|
|
188
|
+
# shellcheck source=manage/scripts/workspace/workspace-egress.sh
|
|
189
|
+
. "$HERE/scripts/workspace/workspace-egress.sh"
|
|
190
190
|
|
|
191
191
|
# Renamed names (#695): an old French name is refused before anything runs, with
|
|
192
192
|
# its English name (« devzone workspace start »). A copied devzone may miss the
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|