fix(deploy): 兼容 macOS Bash 3.2 下载平台清单
将 operator URL 与固定 SHA-256 从关联数组改为并行索引数组,避免 macOS Bash 3.2 将带连字符的文件名解析为算术变量。远端资源复制前仍逐项校验 checksum。 验证:bash -n、ShellCheck、Bash 3.2 索引遍历。
This commit is contained in:
@@ -46,20 +46,22 @@ source "$postgres_environment"
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
declare -A operator_urls=(
|
operators=(cert-manager.yaml cnpg.yaml barman.yaml)
|
||||||
[cert-manager.yaml]=https://github.com/cert-manager/cert-manager/releases/download/v1.21.0/cert-manager.yaml
|
operator_urls=(
|
||||||
[cnpg.yaml]=https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.29/releases/cnpg-1.29.1.yaml
|
https://github.com/cert-manager/cert-manager/releases/download/v1.21.0/cert-manager.yaml
|
||||||
[barman.yaml]=https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v0.13.0/manifest.yaml
|
https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.29/releases/cnpg-1.29.1.yaml
|
||||||
|
https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v0.13.0/manifest.yaml
|
||||||
)
|
)
|
||||||
declare -A operator_checksums=(
|
operator_checksums=(
|
||||||
[cert-manager.yaml]=6e499c3f1ab356abe79a7853911f80cb09c213885bfdf81092fdff142ba63c4a
|
6e499c3f1ab356abe79a7853911f80cb09c213885bfdf81092fdff142ba63c4a
|
||||||
[cnpg.yaml]=e0c5ff41bf5b01c0775bf225929b8423d543cd23e9742e4274fe7de8499cf93a
|
e0c5ff41bf5b01c0775bf225929b8423d543cd23e9742e4274fe7de8499cf93a
|
||||||
[barman.yaml]=d2e71e7b06822448f1a421f05781846cfdb9cc621e7ef32eef5e20c5133213b0
|
d2e71e7b06822448f1a421f05781846cfdb9cc621e7ef32eef5e20c5133213b0
|
||||||
)
|
)
|
||||||
for operator in cert-manager.yaml cnpg.yaml barman.yaml; do
|
for index in 0 1 2; do
|
||||||
curl -fsSL "${operator_urls[$operator]}" -o "$working_directory/$operator"
|
operator=${operators[$index]}
|
||||||
|
curl -fsSL "${operator_urls[$index]}" -o "$working_directory/$operator"
|
||||||
actual_checksum=$(shasum -a 256 "$working_directory/$operator" | awk '{print $1}')
|
actual_checksum=$(shasum -a 256 "$working_directory/$operator" | awk '{print $1}')
|
||||||
[[ $actual_checksum == "${operator_checksums[$operator]}" ]] || {
|
[[ $actual_checksum == "${operator_checksums[$index]}" ]] || {
|
||||||
echo "operator manifest checksum mismatch: $operator" >&2
|
echo "operator manifest checksum mismatch: $operator" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user