mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[ubuntu] Cleanup bash scripts (#9076)
* [ubuntu] Cleanup bash scripts * Fix ms-repos lsb_release * Fix install-bicep url * Fix install-nvm
This commit is contained in:
committed by
GitHub
parent
e16b5524ff
commit
1658c2e905
@@ -4,15 +4,16 @@
|
||||
## Desc: Install Ruby requirements and ruby gems
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/os.sh
|
||||
source $HELPER_SCRIPTS/install.sh
|
||||
|
||||
apt-get install ruby-full
|
||||
|
||||
# Install ruby gems from toolset
|
||||
gemsToInstall=$(get_toolset_value ".rubygems[] .name")
|
||||
if [ -n "$gemsToInstall" ]; then
|
||||
for gem in $gemsToInstall; do
|
||||
gems_to_install=$(get_toolset_value ".rubygems[] .name")
|
||||
if [[ -n "$gems_to_install" ]]; then
|
||||
for gem in $gems_to_install; do
|
||||
echo "Installing gem $gem"
|
||||
gem install $gem
|
||||
done
|
||||
@@ -22,35 +23,35 @@ fi
|
||||
apt-get install -y libz-dev openssl libssl-dev
|
||||
|
||||
echo "Install Ruby from toolset..."
|
||||
PACKAGE_TAR_NAMES=$(curl -fsSL "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
|
||||
TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]')
|
||||
PLATFORM_VERSION=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .platform_version')
|
||||
RUBY_PATH="$AGENT_TOOLSDIRECTORY/Ruby"
|
||||
package_tar_names=$(curl -fsSL "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
|
||||
toolset_versions=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]')
|
||||
platform_version=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .platform_version')
|
||||
ruby_path="$AGENT_TOOLSDIRECTORY/Ruby"
|
||||
|
||||
echo "Check if Ruby hostedtoolcache folder exist..."
|
||||
if [ ! -d $RUBY_PATH ]; then
|
||||
mkdir -p $RUBY_PATH
|
||||
if [[ ! -d $ruby_path ]]; then
|
||||
mkdir -p $ruby_path
|
||||
fi
|
||||
|
||||
for TOOLSET_VERSION in ${TOOLSET_VERSIONS[@]}; do
|
||||
PACKAGE_TAR_NAME=$(echo "$PACKAGE_TAR_NAMES" | grep "^ruby-${TOOLSET_VERSION}-ubuntu-${PLATFORM_VERSION}.tar.gz$" | sort -V | tail -1)
|
||||
RUBY_VERSION=$(echo "$PACKAGE_TAR_NAME" | cut -d'-' -f 2)
|
||||
RUBY_VERSION_PATH="$RUBY_PATH/$RUBY_VERSION"
|
||||
for toolset_version in ${toolset_versions[@]}; do
|
||||
package_tar_name=$(echo "$package_tar_names" | grep "^ruby-${toolset_version}-ubuntu-${platform_version}.tar.gz$" | sort -V | tail -1)
|
||||
ruby_version=$(echo "$package_tar_name" | cut -d'-' -f 2)
|
||||
ruby_version_path="$ruby_path/$ruby_version"
|
||||
|
||||
echo "Create Ruby $RUBY_VERSION directory..."
|
||||
mkdir -p $RUBY_VERSION_PATH
|
||||
echo "Create Ruby $ruby_version directory..."
|
||||
mkdir -p $ruby_version_path
|
||||
|
||||
echo "Downloading tar archive $PACKAGE_TAR_NAME"
|
||||
DOWNLOAD_URL="https://github.com/ruby/ruby-builder/releases/download/toolcache/${PACKAGE_TAR_NAME}"
|
||||
PACKAGE_ARCHIVE_PATH=$(download_with_retry "$DOWNLOAD_URL")
|
||||
echo "Downloading tar archive $package_tar_name"
|
||||
download_url="https://github.com/ruby/ruby-builder/releases/download/toolcache/${package_tar_name}"
|
||||
package_archive_path=$(download_with_retry "$download_url")
|
||||
|
||||
echo "Expand '$PACKAGE_TAR_NAME' to the '$RUBY_VERSION_PATH' folder"
|
||||
tar xf "$PACKAGE_ARCHIVE_PATH" -C $RUBY_VERSION_PATH
|
||||
echo "Expand '$package_tar_name' to the '$ruby_version_path' folder"
|
||||
tar xf "$package_archive_path" -C $ruby_version_path
|
||||
|
||||
COMPLETE_FILE_PATH="$RUBY_VERSION_PATH/x64.complete"
|
||||
if [ ! -f $COMPLETE_FILE_PATH ]; then
|
||||
complete_file_path="$ruby_version_path/x64.complete"
|
||||
if [[ ! -f $complete_file_path ]]; then
|
||||
echo "Create complete file"
|
||||
touch $COMPLETE_FILE_PATH
|
||||
touch $complete_file_path
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user