[ubuntu] Refactor functions for GitHub assets and hashes (#9040)

This commit is contained in:
Shamil Mubarakshin
2023-12-25 19:47:58 +01:00
committed by GitHub
parent 08d10be70d
commit 694536d87f
15 changed files with 149 additions and 114 deletions

View File

@@ -10,11 +10,11 @@
source $HELPER_SCRIPTS/install.sh
# Download GitHub CLI
gh_cli_url=$(resolve_github_release_asset_url "cli/cli" "contains(\"linux\") and contains(\"amd64\") and contains(\".deb\")" "latest")
gh_cli_url=$(resolve_github_release_asset_url "cli/cli" "contains(\"linux\") and contains(\"amd64\") and endswith(\".deb\")" "latest")
gh_cli_deb_path=$(download_with_retry "$gh_cli_url")
# Supply chain security - GitHub CLI
hash_url=$(resolve_github_release_asset_url "cli/cli" "contains(\"checksums.txt\")" "latest")
external_hash=$(get_hash_from_remote_file "$hash_url" "linux_amd64.deb")
hash_url=$(resolve_github_release_asset_url "cli/cli" "endswith(\"checksums.txt\")" "latest")
external_hash=$(get_checksum_from_url "$hash_url" "linux_amd64.deb" "SHA256")
use_checksum_comparison "$gh_cli_deb_path" "$external_hash"
# Install GitHub CLI
apt install "$gh_cli_deb_path"