devzone 4.0.0 → 4.1.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/Dockerfile
CHANGED
|
@@ -25,6 +25,12 @@ ARG PYTEST_VERSION=9.1.1
|
|
|
25
25
|
ARG BUILDKIT_VERSION=0.34.2
|
|
26
26
|
ARG BUILDKIT_SHA256_AMD64=b9f18b8e37eb450e9e5df03117045237cdd12d3c4a0034ffeeaa857852a15e13
|
|
27
27
|
ARG BUILDKIT_SHA256_ARM64=a4ad483a33b2f1544c5ccce1c5956c559e1a6e84b8bf6cedd847d695885237a3
|
|
28
|
+
# Go (#754): same version as the CI (go.yml, go 1.27 resolved to its latest patch) and
|
|
29
|
+
# go.mod. Checksums of the archives of https://go.dev/dl/?mode=json&include=all
|
|
30
|
+
# (files linux-arm64 and linux-amd64). To update: change the version AND both checksums.
|
|
31
|
+
ARG GO_VERSION=1.27.4
|
|
32
|
+
ARG GO_SHA256_AMD64=7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840
|
|
33
|
+
ARG GO_SHA256_ARM64=3392582988a273a87ab5043ee1b2c9c17a2c3c00580bf9326c47a2e0aaaeac92
|
|
28
34
|
|
|
29
35
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
30
36
|
|
|
@@ -107,6 +113,33 @@ RUN set -eu; \
|
|
|
107
113
|
install -m 0755 "$tmp/bin/buildctl" /usr/local/bin/buildctl; \
|
|
108
114
|
rm -rf "$tmp"
|
|
109
115
|
|
|
116
|
+
# Go (#754): toolchain of the workspace pod, used to develop devzone and to build its
|
|
117
|
+
# binary. The official archive is checked with its SHA-256 before extraction into
|
|
118
|
+
# /usr/local/go (about 280 MB extracted). Symlinks in /usr/local/bin: the statefulset
|
|
119
|
+
# of the workspace sets its own PATH, which replaces the ENV PATH below.
|
|
120
|
+
RUN set -eu; \
|
|
121
|
+
arch="$(dpkg --print-architecture)"; \
|
|
122
|
+
case "$arch" in \
|
|
123
|
+
arm64) go_sha="${GO_SHA256_ARM64}" ;; \
|
|
124
|
+
amd64) go_sha="${GO_SHA256_AMD64}" ;; \
|
|
125
|
+
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \
|
|
126
|
+
esac; \
|
|
127
|
+
tmp="$(mktemp -d)"; \
|
|
128
|
+
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${arch}.tar.gz" -o "$tmp/go.tar.gz"; \
|
|
129
|
+
echo "$go_sha $tmp/go.tar.gz" | sha256sum -c --quiet; \
|
|
130
|
+
tar -xzf "$tmp/go.tar.gz" -C /usr/local; \
|
|
131
|
+
rm -rf "$tmp"; \
|
|
132
|
+
ln -sf /usr/local/go/bin/go /usr/local/bin/go; \
|
|
133
|
+
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt; \
|
|
134
|
+
install -d -o 1000 -g 1000 /home/vscode/.cache /home/vscode/.cache/go-build /home/vscode/go
|
|
135
|
+
|
|
136
|
+
# Go: GOTOOLCHAIN=local as in the CI (no toolchain download); build cache and module
|
|
137
|
+
# path under the home of vscode (uid/gid 1000)
|
|
138
|
+
ENV PATH="/usr/local/go/bin:${PATH}" \
|
|
139
|
+
GOTOOLCHAIN=local \
|
|
140
|
+
GOCACHE=/home/vscode/.cache/go-build \
|
|
141
|
+
GOPATH=/home/vscode/go
|
|
142
|
+
|
|
110
143
|
# kind passe par une enveloppe (#291) : avec le Docker de l'hôte, un cluster
|
|
111
144
|
# créé à la main doit être rendu joignable depuis le conteneur (kube-reachable.sh)
|
|
112
145
|
COPY kube-reachable.sh /usr/local/lib/devzone/kube-reachable.sh
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
"version": "21",
|
|
9
9
|
"jdkDistro": "tem",
|
|
10
10
|
"installMaven": true,
|
|
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
|
+
"mavenVersion": "3.9.16",
|
|
11
17
|
"installGradle": true,
|
|
12
18
|
"gradleVersion": "9.8.2"
|
|
13
19
|
},
|
|
@@ -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
|
package/README.md
CHANGED
|
@@ -162,7 +162,7 @@ To learn more: [Starting a project](https://github.com/SimBienvenueHoulBoumi/dev
|
|
|
162
162
|
|
|
163
163
|
| Area | Tools |
|
|
164
164
|
|---|---|
|
|
165
|
-
| Languages | Java 21 + Maven + Gradle, Node LTS + pnpm, Python 3.12 (apt) + uv |
|
|
165
|
+
| Languages | Java 21 + Maven + Gradle, Node LTS + pnpm, Go 1.27.4, Python 3.12 (apt) + uv |
|
|
166
166
|
| Containers, Kubernetes | Host Docker (shared socket), kubectl, helm, k9s, kind; connection to the host cluster (`kubernetes` module); Testcontainers (`TESTCONTAINERS_HOST_OVERRIDE`); mounts (`$LOCAL_WORKSPACE_FOLDER`) |
|
|
167
167
|
| GitHub (or GitLab), quality | gh, or glab connected to a GitLab instance (`devzone platform gitlab` in the container, [manage/docs/reference.md](manage/docs/reference.md#platform-github-or-gitlab)); repowarden (global git hooks), shellcheck, bats, actionlint, gitleaks, ruff, vulture, pytest |
|
|
168
168
|
| AI assistants | Claude Code, opencode (`ia` module, disabled by default) |
|
|
@@ -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
|
+
}
|
|
@@ -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
|