atlas-iac/services/hermes/scripts/install_agent_tools.sh

77 lines
2.2 KiB
Bash
Raw Normal View History

2026-08-10 17:05:14 -03:00
#!/bin/sh
# Install the pinned ARM64 operator toolchain on the persistent owner volume.
set -eu
tools=${HERMES_AGENT_TOOLS_DIR:-/opt/data/tools}
bin=${tools}/bin
stamp=${tools}/.operator-cli-versions-2.7.0-3.18.6-5.7.1-1.8.1-4.47.1-2.78.0
mkdir -p "${bin}"
if [ -f "${stamp}" ]; then
exit 0
fi
work=$(mktemp -d "${tools}/.operator-tools.XXXXXX")
trap 'rm -rf "${work}"' 0 HUP INT TERM
fetch() {
url=$1
checksum=$2
destination=$3
curl -fsSL -o "${destination}" "${url}"
printf '%s %s\n' "${checksum}" "${destination}" | sha256sum -c -
}
publish() {
source=$1
name=$2
chmod 0755 "${source}"
mv "${source}" "${bin}/${name}"
}
fetch \
https://github.com/fluxcd/flux2/releases/download/v2.7.0/flux_2.7.0_linux_arm64.tar.gz \
758703b8cd96be98f1ea23b7bd3ff2ae13d90a23467d8aba8b83adbe335c6854 \
"${work}/flux.tar.gz"
mkdir "${work}/flux"
tar -xzf "${work}/flux.tar.gz" -C "${work}/flux"
publish "${work}/flux/flux" flux
fetch \
https://get.helm.sh/helm-v3.18.6-linux-arm64.tar.gz \
5b8e00b6709caab466cbbb0bc29ee09059b8dc9417991dd04b497530e49b1737 \
"${work}/helm.tar.gz"
mkdir "${work}/helm"
tar -xzf "${work}/helm.tar.gz" -C "${work}/helm"
publish "${work}/helm/linux-arm64/helm" helm
fetch \
https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.7.1/kustomize_v5.7.1_linux_arm64.tar.gz \
4261a040217df3bd6896597c3986d1465925726e4f22a945304b5233a4dcdbda \
"${work}/kustomize.tar.gz"
mkdir "${work}/kustomize"
tar -xzf "${work}/kustomize.tar.gz" -C "${work}/kustomize"
publish "${work}/kustomize/kustomize" kustomize
fetch \
https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-linux-arm64 \
6bc62f25981328edd3cfcfe6fe51b073f2d7e7710d7ef7fcdac28d4e384fc3d4 \
"${work}/jq"
publish "${work}/jq" jq
fetch \
https://github.com/mikefarah/yq/releases/download/v4.47.1/yq_linux_arm64 \
b7f7c991abe262b0c6f96bbcb362f8b35429cefd59c8b4c2daa4811f1e9df599 \
"${work}/yq"
publish "${work}/yq" yq
fetch \
https://github.com/cli/cli/releases/download/v2.78.0/gh_2.78.0_linux_arm64.tar.gz \
9e3ca75b227a5503f6ef92c4b8b6dbf94e34bfdd8069ac0f16b8739856ebba7b \
"${work}/gh.tar.gz"
mkdir "${work}/gh"
tar -xzf "${work}/gh.tar.gz" -C "${work}/gh"
publish "${work}/gh/gh_2.78.0_linux_arm64/bin/gh" gh
touch "${stamp}"