[Ubuntu] Rewrite function download_with_retry (#8912)

* [Ubuntu] Rewrite function download_with_retry

* Fix loop exit condition
This commit is contained in:
Vasilii Polikarpov
2023-11-29 20:25:29 +01:00
committed by GitHub
parent 7dba8776df
commit abb81511d4
37 changed files with 203 additions and 222 deletions

View File

@@ -1,20 +1,22 @@
#!/bin/bash -e
################################################################################
## File: install-yq.sh
## Desc: Install YQ
## Supply chain security: YQ - checksum validation
## Desc: Install yq - a command-line YAML, JSON and XML processor
## Supply chain security: yq - checksum validation
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh
# Download YQ
# Download yq
base_url="https://github.com/mikefarah/yq/releases/latest/download"
download_with_retries "${base_url}/yq_linux_amd64" "/tmp" "yq"
# Supply chain security - YQ
binary_path=$(download_with_retry "${base_url}/yq_linux_amd64")
# Supply chain security - yq
external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "yq_linux_amd64 " "" " " "19")
use_checksum_comparison "/tmp/yq" "${external_hash}"
# Install YQ
sudo install /tmp/yq /usr/bin/yq
use_checksum_comparison "$binary_path" "$external_hash"
# Install yq
sudo install "$binary_path" /usr/bin/yq
invoke_tests "Tools" "yq"