Skip to content

Commit dcf9c69

Browse files
[ubuntu] Update Ruby install (#13058)
1 parent 3ca6d13 commit dcf9c69

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

images/ubuntu/scripts/build/install-ruby.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ fi
2323
apt-get install libz-dev openssl libssl-dev
2424

2525
echo "Install Ruby from toolset..."
26-
package_tar_names=$(curl -fsSL "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
2726
toolset_versions=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]')
2827
platform_version=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .platform_version')
28+
arch=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .arch')
2929
ruby_path="$AGENT_TOOLSDIRECTORY/Ruby"
3030

3131
echo "Check if Ruby hostedtoolcache folder exist..."
@@ -34,15 +34,15 @@ if [[ ! -d $ruby_path ]]; then
3434
fi
3535

3636
for toolset_version in ${toolset_versions[@]}; do
37-
package_tar_name=$(echo "$package_tar_names" | grep "^ruby-${toolset_version}-ubuntu-${platform_version}.tar.gz$" | sort -V | tail -1)
37+
download_url=$(resolve_github_release_asset_url "ruby/ruby-builder" "test(\"ruby-${toolset_version}-ubuntu-${platform_version}-${arch}.tar.gz\")" "${toolset_version}" "false" "true")
38+
package_tar_name="${download_url##*/}"
3839
ruby_version=$(echo "$package_tar_name" | cut -d'-' -f 2)
3940
ruby_version_path="$ruby_path/$ruby_version"
4041

4142
echo "Create Ruby $ruby_version directory..."
4243
mkdir -p $ruby_version_path
4344

4445
echo "Downloading tar archive $package_tar_name"
45-
download_url="https://github.com/ruby/ruby-builder/releases/download/toolcache/${package_tar_name}"
4646
package_archive_path=$(download_with_retry "$download_url")
4747

4848
echo "Expand '$package_tar_name' to the '$ruby_version_path' folder"

0 commit comments

Comments
 (0)