mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
Merge branch 'master' into 690_Moby_buildx
This commit is contained in:
@@ -8,42 +8,57 @@
|
||||
# values containg slashes (i.e. directory path)
|
||||
# The values containing '%' will break the functions
|
||||
|
||||
function getEtcEnvironmentVar {
|
||||
var_name="$1"
|
||||
# remove `var_name=` and possible quotes from the line
|
||||
grep "^${var_name}=" /etc/environment |sed -E "s%^${var_name}=\"?([^\"]+)\"?.*$%\1%"
|
||||
function getEtcEnvironmentVariable {
|
||||
variable_name="$1"
|
||||
# remove `variable_name=` and possible quotes from the line
|
||||
grep "^${variable_name}=" /etc/environment |sed -E "s%^${variable_name}=\"?([^\"]+)\"?.*$%\1%"
|
||||
}
|
||||
|
||||
function addEtcEnvironmentVar {
|
||||
var_name="$1"
|
||||
var_value="$2"
|
||||
function addEtcEnvironmentVariable {
|
||||
variable_name="$1"
|
||||
variable_value="$2"
|
||||
|
||||
echo "$var_name=\"$var_value\"" | sudo tee -a /etc/environment
|
||||
echo "$variable_name=\"$variable_value\"" | sudo tee -a /etc/environment
|
||||
}
|
||||
|
||||
function replaceEtcEnvironmentVar {
|
||||
var_name="$1"
|
||||
var_value="$2"
|
||||
function replaceEtcEnvironmentVariable {
|
||||
variable_name="$1"
|
||||
variable_value="$2"
|
||||
|
||||
# modify /etc/environemnt in place by replacing a string that begins with var_name
|
||||
sudo sed -ie "s%^${var_name}=.*$%${var_name}=\"${var_value}\"%" /etc/environment
|
||||
# modify /etc/environemnt in place by replacing a string that begins with variable_name
|
||||
sudo sed -ie "s%^${variable_name}=.*$%${variable_name}=\"${variable_value}\"%" /etc/environment
|
||||
}
|
||||
|
||||
function setEtcEnvironmentVar {
|
||||
var_name="$1"
|
||||
var_value="$2"
|
||||
function setEtcEnvironmentVariable {
|
||||
variable_name="$1"
|
||||
variable_value="$2"
|
||||
|
||||
if grep "$var_name" /etc/environment > /dev/null; then
|
||||
replaceEtcEnvironmentVar $var_name $var_value
|
||||
if grep "$variable_name" /etc/environment > /dev/null; then
|
||||
replaceEtcEnvironmentVariable $variable_name $variable_value
|
||||
else
|
||||
addEtcEnvironmentVar $var_name $var_value
|
||||
addEtcEnvironmentVariable $variable_name $variable_value
|
||||
fi
|
||||
}
|
||||
|
||||
function addEtcEnvironmentPathElement {
|
||||
function prependEtcEnvironmentVariable {
|
||||
variable_name="$1"
|
||||
element="$2"
|
||||
# TODO: handle the case if the variable does not exist
|
||||
existing_value=$(getEtcEnvironmentVariable "${variable_name}")
|
||||
setEtcEnvironmentVariable "${variable_name}" "${element}:${existing_value}"
|
||||
}
|
||||
|
||||
function appendEtcEnvironmentVariable {
|
||||
variable_name="$1"
|
||||
element="$2"
|
||||
# TODO: handle the case if the variable does not exist
|
||||
existing_value=$(getEtcEnvironmentVariable "${variable_name}")
|
||||
setEtcEnvironmentVariable "${variable_name}" "${existing_value}:${element}"
|
||||
}
|
||||
|
||||
function prependEtcEnvironmentPath {
|
||||
element="$1"
|
||||
etc_path=$(getEtcEnvironmentVar PATH)
|
||||
setEtcEnvironmentVar PATH "${element}:${etc_path}"
|
||||
prependEtcEnvironmentVariable PATH "${element}"
|
||||
}
|
||||
|
||||
# Process /etc/environment as if it were shell script with `export VAR=...` expressions
|
||||
@@ -59,7 +74,7 @@ function reloadEtcEnvironment {
|
||||
# add `export ` to every variable of /etc/environemnt except PATH and eval the result shell script
|
||||
eval $(grep -v '^PATH=' /etc/environment | sed -e 's%^%export %')
|
||||
# handle PATH specially
|
||||
etc_path=$(getEtcEnvironmentVar PATH)
|
||||
etc_path=$(getEtcEnvironmentVariable PATH)
|
||||
export PATH="$PATH:$etc_path"
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ fi
|
||||
# Install the following SDKs and build tools, passing in "y" to accept licenses.
|
||||
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \
|
||||
"ndk-bundle" \
|
||||
"ndk;20.0.5594570" \
|
||||
"platform-tools" \
|
||||
"platforms;android-29" \
|
||||
"platforms;android-28" \
|
||||
@@ -160,5 +161,6 @@ DocumentInstalledItem "Android SDK Build-Tools 20.0.0"
|
||||
DocumentInstalledItem "Android SDK Build-Tools 19.1.0"
|
||||
DocumentInstalledItem "Android SDK Build-Tools 17.0.0"
|
||||
DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)"
|
||||
DocumentInstalledItem "Android NDK 20.0.5594570"
|
||||
DocumentInstalledItem "Android ConstraintLayout 1.0.2"
|
||||
DocumentInstalledItem "Android ConstraintLayout 1.0.1"
|
||||
|
||||
@@ -49,6 +49,7 @@ apt-fast install -y --no-install-recommends \
|
||||
libgconf-2-4 \
|
||||
dbus \
|
||||
xvfb \
|
||||
libgbm-dev \
|
||||
libgtk-3-0 \
|
||||
tk \
|
||||
fakeroot \
|
||||
@@ -80,6 +81,7 @@ DocumentInstalledItemIndent "jq"
|
||||
DocumentInstalledItemIndent "libc++-dev"
|
||||
DocumentInstalledItemIndent "libc++abi-dev"
|
||||
DocumentInstalledItemIndent "libcurl3"
|
||||
DocumentInstalledItemIndent "libgbm-dev"
|
||||
DocumentInstalledItemIndent "libicu55"
|
||||
DocumentInstalledItemIndent "libunwind8"
|
||||
DocumentInstalledItemIndent "locales"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/etc-environment.sh
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
LSB_RELEASE=$(lsb_release -rs)
|
||||
@@ -276,6 +277,9 @@ php composer-setup.php
|
||||
sudo mv composer.phar /usr/bin/composer
|
||||
php -r "unlink('composer-setup.php');"
|
||||
|
||||
# Update /etc/environment
|
||||
prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin
|
||||
|
||||
# Add composer bin folder to path
|
||||
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc
|
||||
|
||||
@@ -293,6 +297,7 @@ for cmd in php php5.6 php7.0 php7.1 php7.2 php7.3 php7.4 composer phpunit; do
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Document what was added to the image
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
DocumentInstalledItem "PHP 5.6 ($(php5.6 --version | head -n 1))"
|
||||
|
||||
@@ -40,6 +40,7 @@ fi
|
||||
# Install the following SDKs and build tools, passing in "y" to accept licenses.
|
||||
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \
|
||||
"ndk-bundle" \
|
||||
"ndk;20.0.5594570" \
|
||||
"platform-tools" \
|
||||
"platforms;android-29" \
|
||||
"platforms;android-28" \
|
||||
@@ -149,3 +150,4 @@ DocumentInstalledItem "Android SDK Build-Tools 20.0.0"
|
||||
DocumentInstalledItem "Android SDK Build-Tools 19.1.0"
|
||||
DocumentInstalledItem "Android SDK Build-Tools 17.0.0"
|
||||
DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)"
|
||||
DocumentInstalledItem "Android NDK 20.0.5594570"
|
||||
|
||||
@@ -97,6 +97,9 @@ apt-get install -y --no-install-recommends dbus
|
||||
echo "Install xvfb"
|
||||
apt-get install -y --no-install-recommends xvfb
|
||||
|
||||
echo "Install libgbm-dev"
|
||||
apt-get install -y --no-install-recommends libgbm-dev
|
||||
|
||||
echo "Install libgtk"
|
||||
apt-get install -y --no-install-recommends libgtk-3-0
|
||||
|
||||
@@ -147,6 +150,7 @@ DocumentInstalledItemIndent "iproute2"
|
||||
DocumentInstalledItemIndent "iputils-ping"
|
||||
DocumentInstalledItemIndent "jq"
|
||||
DocumentInstalledItemIndent "libcurl3"
|
||||
DocumentInstalledItemIndent "libgbm-dev"
|
||||
DocumentInstalledItemIndent "libicu55"
|
||||
DocumentInstalledItemIndent "libunwind8"
|
||||
DocumentInstalledItemIndent "locales"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/etc-environment.sh
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
LSB_RELEASE=$(lsb_release -rs)
|
||||
@@ -193,6 +194,9 @@ php composer-setup.php
|
||||
sudo mv composer.phar /usr/bin/composer
|
||||
php -r "unlink('composer-setup.php');"
|
||||
|
||||
# Update /etc/environment
|
||||
prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin
|
||||
|
||||
# Add composer bin folder to path
|
||||
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc
|
||||
|
||||
|
||||
27
images/linux/scripts/installers/aliyun-cli.sh
Normal file
27
images/linux/scripts/installers/aliyun-cli.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: aliyun-cli.sh
|
||||
## Desc: Installs Alibaba Cloud CLI
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
source $HELPER_SCRIPTS/apt.sh
|
||||
|
||||
# Install Alibaba Cloud CLI
|
||||
URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))')
|
||||
wget -P /tmp $URL
|
||||
tar xzvf /tmp/aliyun-cli-linux-*-amd64.tgz
|
||||
mv aliyun /usr/local/bin
|
||||
|
||||
# Run tests to determine that the software installed as expected
|
||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||
if ! command -v aliyun ; then
|
||||
echo "aliyun was not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Document what was added to the image
|
||||
aliyun_version="$(aliyun --version | grep "Alibaba Cloud Command Line Interface Version" | cut -d " " -f 7)"
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
DocumentInstalledItem "Alibaba Cloud CLI ($aliyun_version)"
|
||||
24
images/linux/scripts/installers/aws-sam-cli.sh
Normal file
24
images/linux/scripts/installers/aws-sam-cli.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: aws-sam-cli.sh
|
||||
## Desc: Installs AWS SAM CLI
|
||||
## Must be run as non-root user after homebrew and clang
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
# Install aws sam cli
|
||||
brew tap aws/tap
|
||||
brew install aws-sam-cli
|
||||
|
||||
# Run tests to determine that the software installed as expected
|
||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||
if ! sam --version; then
|
||||
echo "AWS SAM CLI was not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Document what was added to the image
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
DocumentInstalledItem "AWS $(sam --version)"
|
||||
@@ -45,6 +45,7 @@ docker pull alpine:3.7
|
||||
docker pull alpine:3.8
|
||||
docker pull alpine:3.9
|
||||
docker pull alpine:3.10
|
||||
docker pull ubuntu:14.04
|
||||
|
||||
## Add version information to the metadata file
|
||||
echo "Documenting Docker version"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
## File: dotnetcore-sdk.sh
|
||||
## Desc: Installs .NET Core SDK
|
||||
################################################################################
|
||||
source $HELPER_SCRIPTS/etc-environment.sh
|
||||
source $HELPER_SCRIPTS/apt.sh
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
@@ -95,5 +96,6 @@ done
|
||||
|
||||
# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test
|
||||
# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine
|
||||
echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" | tee -a /etc/environment
|
||||
setEtcEnvironmentVariable DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
|
||||
prependEtcEnvironmentPath /home/runner/.dotnet/tools
|
||||
echo 'export PATH="$PATH:$HOME/.dotnet/tools"' | tee -a /etc/skel/.bashrc
|
||||
|
||||
@@ -20,7 +20,7 @@ sudo chmod -R o+w $HOMEBREW_PREFIX
|
||||
brew shellenv|grep 'export HOMEBREW'|sed -E 's/^export (.*);$/\1/' | sudo tee -a /etc/environment
|
||||
# add brew executables locations to PATH
|
||||
brew_path=$(brew shellenv|grep '^export PATH' |sed -E 's/^export PATH="([^$]+)\$.*/\1/')
|
||||
addEtcEnvironmentPathElement "$brew_path"
|
||||
prependEtcEnvironmentPath "$brew_path"
|
||||
|
||||
# Validate the installation ad hoc
|
||||
echo "Validate the installation reloading /etc/environment"
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/etc-environment.sh
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
set -e
|
||||
|
||||
export RUSTUP_HOME=/usr/share/rust/.rustup
|
||||
export CARGO_HOME=/usr/share/rust/.cargo
|
||||
|
||||
@@ -33,6 +32,9 @@ for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Update /etc/environemnt
|
||||
prependEtcEnvironmentPath "${CARGO_HOME}/bin"
|
||||
|
||||
# Rust Symlinks are added to a default profile /etc/skel
|
||||
pushd /etc/skel
|
||||
ln -sf $RUSTUP_HOME .rustup
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
CARGO_HOME=/usr/share/rust/.cargo
|
||||
DOTNET_TOOLS_HOME=/home/runner/.dotnet/tools
|
||||
PHP_COMPOSER_HOME=/home/runner/.config/composer/vendor/bin
|
||||
BREW_PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin
|
||||
echo "PATH=${BREW_PATH}:${CARGO_HOME}/bin:${PATH}:${DOTNET_TOOLS_HOME}:${PHP_COMPOSER_HOME}" | tee -a /etc/environment
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
source $HELPER_SCRIPTS/os.sh
|
||||
|
||||
# Set env variable for vcpkg
|
||||
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
|
||||
@@ -13,11 +14,22 @@ echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a /etc/environm
|
||||
|
||||
# Install vcpkg
|
||||
git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT
|
||||
|
||||
# vcpkg requires g++ version 7+, yet Ubuntu 16 default is 5.4. Set version 7 as default temporarily
|
||||
if isUbuntu16; then
|
||||
ln -sf g++-7 /usr/bin/g++
|
||||
fi
|
||||
|
||||
$VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh
|
||||
$VCPKG_INSTALLATION_ROOT/vcpkg integrate install
|
||||
chmod 0777 -R $VCPKG_INSTALLATION_ROOT
|
||||
ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin
|
||||
|
||||
# Set back g++ 5.4 as default
|
||||
if isUbuntu16; then
|
||||
ln -sf g++-5 /usr/bin/g++
|
||||
fi
|
||||
|
||||
# Run tests to determine that the software installed as expected
|
||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||
if ! command -v vcpkg; then
|
||||
|
||||
Reference in New Issue
Block a user