Merge branch 'master' into v-dimago/add_oras_cli

This commit is contained in:
Dibir Magomedsaygitov
2020-07-07 17:37:15 +03:00
104 changed files with 3550 additions and 3871 deletions

View File

@@ -44,6 +44,7 @@ chmod -R a+X ${ANDROID_SDK_ROOT}
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \
"ndk-bundle" \
"platform-tools" \
"platforms;android-30" \
"platforms;android-29" \
"platforms;android-28" \
"platforms;android-27" \
@@ -57,6 +58,7 @@ echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \
"platforms;android-17" \
"platforms;android-15" \
"platforms;android-10" \
"build-tools;30.0.0" \
"build-tools;29.0.3" \
"build-tools;29.0.2" \
"build-tools;29.0.0" \
@@ -116,6 +118,7 @@ DocumentInstalledItem "Android Support Repository 47.0.0"
DocumentInstalledItem "Android Solver for ConstraintLayout 1.0.2"
DocumentInstalledItem "Android Solver for ConstraintLayout 1.0.1"
DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Android SDK Platform 30"
DocumentInstalledItem "Android SDK Platform 29"
DocumentInstalledItem "Android SDK Platform 28"
DocumentInstalledItem "Android SDK Platform 27"
@@ -130,6 +133,7 @@ DocumentInstalledItem "Android SDK Platform 17"
DocumentInstalledItem "Android SDK Platform 15"
DocumentInstalledItem "Android SDK Platform 10"
DocumentInstalledItem "Android SDK Patch Applier v4"
DocumentInstalledItem "Android SDK Build-Tools 30.0.0"
DocumentInstalledItem "Android SDK Build-Tools 29.0.3"
DocumentInstalledItem "Android SDK Build-Tools 29.0.2"
DocumentInstalledItem "Android SDK Build-Tools 29.0.0"

View File

@@ -10,60 +10,67 @@ source $HELPER_SCRIPTS/apt.sh
set -e
# Install basic command-line utilities
apt-fast install -y --no-install-recommends \
curl \
dnsutils \
file \
ftp \
iproute2 \
iputils-ping \
jq \
libc++-dev \
libc++abi-dev \
libcurl3 \
libicu55 \
libunwind8 \
locales \
netcat \
openssh-client \
parallel \
rsync \
shellcheck \
sudo \
telnet \
time \
tzdata \
unzip \
upx \
wget \
zip \
zstd \
lib32z1
common_packages="dnsutils
iproute2
iputils-ping
libc++-dev
libc++abi-dev
libcurl3
libicu55
libunwind8
locales
openssh-client
tzdata
zstd
lib32z1
libxkbfile-dev
pkg-config
libsecret-1-dev
libxss1
libgconf-2-4
dbus
xvfb
libgbm-dev
libgtk-3-0
tk
fakeroot
dpkg
rpm
xz-utils
xorriso
zsync
gnupg2
texinfo"
# Electron / VSCode / GitHub Desktop / kubectl prereqs
apt-fast install -y --no-install-recommends \
libxkbfile-dev \
pkg-config \
libsecret-1-dev \
libxss1 \
libgconf-2-4 \
dbus \
xvfb \
libgbm-dev \
libgtk-3-0 \
tk \
fakeroot \
dpkg \
rpm \
xz-utils \
xorriso \
zsync \
gnupg2
cmd_packages="curl
file
ftp
jq
netcat
ssh
parallel
rsync
shellcheck
sudo
telnet
time
unzip
zip
wget
upx
m4
bison
flex"
# Install basic command-line utilities
for package in $common_packages $cmd_packages; do
echo "Install $package"
apt-fast install -y --no-install-recommends $package
done
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in curl file ftp jq netcat ssh parallel rsync shellcheck sudo telnet time unzip upx wget zip; do
for cmd in $cmd_packages; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
@@ -72,34 +79,7 @@ done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Basic CLI:"
DocumentInstalledItemIndent "curl"
DocumentInstalledItemIndent "dnsutils"
DocumentInstalledItemIndent "file"
DocumentInstalledItemIndent "ftp"
DocumentInstalledItemIndent "iproute2"
DocumentInstalledItemIndent "iputils-ping"
DocumentInstalledItemIndent "jq"
DocumentInstalledItemIndent "libc++-dev"
DocumentInstalledItemIndent "libc++abi-dev"
DocumentInstalledItemIndent "libcurl3"
DocumentInstalledItemIndent "libgbm-dev"
DocumentInstalledItemIndent "libicu55"
DocumentInstalledItemIndent "libunwind8"
DocumentInstalledItemIndent "locales"
DocumentInstalledItemIndent "netcat"
DocumentInstalledItemIndent "openssh-client"
DocumentInstalledItemIndent "parallel"
DocumentInstalledItemIndent "rsync"
DocumentInstalledItemIndent "shellcheck"
DocumentInstalledItemIndent "sudo"
DocumentInstalledItemIndent "telnet"
DocumentInstalledItemIndent "time"
DocumentInstalledItemIndent "tzdata"
DocumentInstalledItemIndent "unzip"
DocumentInstalledItemIndent "upx"
DocumentInstalledItemIndent "wget"
DocumentInstalledItemIndent "zip"
DocumentInstalledItemIndent "zstd"
DocumentInstalledItemIndent "gnupg2"
DocumentInstalledItemIndent "lib32z1"
DocumentInstalledItem "Basic packages:"
for package in $common_packages $cmd_packages; do
DocumentInstalledItemIndent $package
done

View File

@@ -44,6 +44,7 @@ fi
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \
"ndk-bundle" \
"platform-tools" \
"platforms;android-30" \
"platforms;android-29" \
"platforms;android-28" \
"platforms;android-27" \
@@ -55,6 +56,7 @@ echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \
"platforms;android-21" \
"platforms;android-19" \
"platforms;android-17" \
"build-tools;30.0.0" \
"build-tools;29.0.3" \
"build-tools;29.0.2" \
"build-tools;29.0.0" \
@@ -108,6 +110,7 @@ DocumentInstalledItem "Google APIs 21"
DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)"
DocumentInstalledItem "Android Support Repository 47.0.0"
DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Android SDK Platform 30"
DocumentInstalledItem "Android SDK Platform 29"
DocumentInstalledItem "Android SDK Platform 28"
DocumentInstalledItem "Android SDK Platform 27"
@@ -120,6 +123,7 @@ DocumentInstalledItem "Android SDK Platform 21"
DocumentInstalledItem "Android SDK Platform 19"
DocumentInstalledItem "Android SDK Platform 17"
DocumentInstalledItem "Android SDK Patch Applier v4"
DocumentInstalledItem "Android SDK Build-Tools 30.0.0"
DocumentInstalledItem "Android SDK Build-Tools 29.0.3"
DocumentInstalledItem "Android SDK Build-Tools 29.0.2"
DocumentInstalledItem "Android SDK Build-Tools 29.0.0"

View File

@@ -49,9 +49,11 @@ fi
echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \
"ndk-bundle" \
"platform-tools" \
"platforms;android-30" \
"platforms;android-29" \
"platforms;android-28" \
"platforms;android-27" \
"build-tools;30.0.0" \
"build-tools;29.0.3" \
"build-tools;29.0.2" \
"build-tools;29.0.0" \
@@ -76,10 +78,12 @@ DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/goo
DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)"
DocumentInstalledItem "Android Support Repository 47.0.0"
DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Android SDK Platform 30"
DocumentInstalledItem "Android SDK Platform 29"
DocumentInstalledItem "Android SDK Platform 28"
DocumentInstalledItem "Android SDK Platform 27"
DocumentInstalledItem "Android SDK Patch Applier v4"
DocumentInstalledItem "Android SDK Build-Tools 30.0.0"
DocumentInstalledItem "Android SDK Build-Tools 29.0.3"
DocumentInstalledItem "Android SDK Build-Tools 29.0.2"
DocumentInstalledItem "Android SDK Build-Tools 29.0.0"

View File

@@ -1,24 +0,0 @@
#!/bin/bash
################################################################################
## File: containers.sh
## Desc: Installs container tools: podman, buildah and skopeo onto the image
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
source /etc/os-release
sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key
apt-key add - < Release.key
apt-get update -qq
apt-get -qq -y install podman buildah skopeo
mkdir -p /etc/containers
echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf
## Add version information to the metadata file
echo "Documenting container tools version"
PODMAN_VERSION='podman --version'
BUILDAH_VERSION='buildah --version'
SKOPEO_VERSION='skopeo --version'
DocumentInstalledItem "Podman ($PODMAN_VERSION)\nBuildah ($BUILDAH_VERSION)\nSkopeo ($SKOPEO_VERSION)"

View File

@@ -0,0 +1,95 @@
################################################################################
## File: Configure-Toolset.ps1
## Team: CI-Build
## Desc: Configure toolset
################################################################################
function Get-ToolsetToolFullPath
{
param
(
[Parameter(Mandatory)] [string] $ToolName,
[Parameter(Mandatory)] [string] $ToolVersion,
[Parameter(Mandatory)] [string] $ToolArchitecture
)
$toolPath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $toolName
$toolPathVersion = Join-Path -Path $toolPath -ChildPath $toolVersion
$foundVersion = Get-Item $toolPathVersion | Sort-Object -Property {[version]$_.name} -Descending | Select-Object -First 1
$installationDir = Join-Path -Path $foundVersion -ChildPath $toolArchitecture
return $installationDir
}
function Add-EnvironmentVariable
{
param
(
[Parameter(Mandatory)] [string] $Name,
[Parameter(Mandatory)] [string] $Value,
[string] $FilePath = "/etc/environment"
)
$envVar = "{0}={1}" -f $name, $value
Tee-Object -InputObject $envVar -FilePath $filePath -Append
}
$ErrorActionPreference = "Stop"
Write-Host "Configure toolset tools environment..."
$toolsEnvironment = @{
boost = @{
variableTemplate = "BOOST_ROOT_{0}_{1}_{2}"
}
go = @{
command = "ln -s {0}/bin/* /usr/bin/"
defaultVariable = "GOROOT"
variableTemplate = "GOROOT_{0}_{1}_X64"
}
}
$toolset = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw | ConvertFrom-Json
foreach ($tool in $toolset.toolcache)
{
$toolName = $tool.name
$toolArch = $tool.arch
$toolEnvironment = $toolsEnvironment[$toolName]
if (-not $toolEnvironment)
{
continue
}
foreach ($toolVersion in $tool.versions)
{
Write-Host "Set $toolName $toolVersion environment variable..."
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $toolArch
$envName = $toolEnvironment.variableTemplate -f $toolVersion.split(".")
# Add environment variable name=value
Add-EnvironmentVariable -Name $envName -Value $toolPath
}
# Invoke command and add env variable for the default tool version
$toolDefVersion = $tool.default
if (-not $toolDefVersion)
{
continue
}
$envDefName = $toolEnvironment.defaultVariable
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolDefVersion -ToolArchitecture $toolArch
if ($envDefName)
{
Write-Host "Set default $envDefName for $toolName $toolDefVersion environment variable..."
Add-EnvironmentVariable -Name $envDefName -Value $toolPath
}
if ($toolEnvironment.command)
{
$command = $toolEnvironment.command -f $toolPath
Write-Host "Invoke $command command for default $toolName $toolDefVersion..."
Invoke-Expression -Command $command
}
}

View File

@@ -28,8 +28,9 @@ $ErrorActionPreference = "Stop"
# Get toolset content
$toolsetJson = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw
$toolsToInstall = @("Python", "Node")
$tools = ConvertFrom-Json -InputObject $toolsetJson | Select-Object -ExpandProperty toolcache | Where {$ToolsToInstall -contains $_.Name}
$toolsToInstall = @("Python", "Node", "Boost", "Go")
$tools = ConvertFrom-Json -InputObject $toolsetJson | Select-Object -ExpandProperty toolcache | Where-Object {$ToolsToInstall -contains $_.Name}
foreach ($tool in $tools) {
# Get versions manifest for current tool
@@ -43,10 +44,9 @@ foreach ($tool in $tools) {
| Select-Object -First 1
Write-Host "Installing $($tool.name) $toolVersion $($tool.arch)..."
if ($asset -ne $null) {
if ($null -ne $asset) {
Install-Asset -ReleaseAsset $asset
}
else {
} else {
Write-Host "Asset was not found in versions manifest"
exit 1
}
@@ -54,4 +54,5 @@ foreach ($tool in $tools) {
}
chown -R "$($env:SUDO_USER):$($env:SUDO_USER)" /opt/hostedtoolcache/Python
chown -R "$($env:SUDO_USER):$($env:SUDO_USER)" /opt/hostedtoolcache/node
chown -R "$($env:SUDO_USER):$($env:SUDO_USER)" /opt/hostedtoolcache/node
chown -R "$($env:SUDO_USER):$($env:SUDO_USER)" /opt/hostedtoolcache/go

View File

@@ -9,13 +9,13 @@ function Run-ExecutableTests {
[Parameter(Mandatory)] [string[]] $Executables,
[Parameter(Mandatory)] [string] $ToolPath
)
$versionCommand = $Executables["command"]
foreach ($executable in $Executables) {
foreach ($executable in $Executables["tools"]) {
$executablePath = Join-Path $ToolPath $executable
Write-Host "Check $executable..."
if (Test-Path $executablePath) {
Write-Host "$executable is successfully installed: $(& $executablePath --version)"
Write-Host "$executable is successfully installed: $(& $executablePath $versionCommand)"
} else {
Write-Host "$executablePath is not installed!"
exit 1
@@ -27,9 +27,22 @@ $ErrorActionPreference = "Stop"
# Define executables for cached tools
$toolsExecutables = @{
Python = @("python", "bin/pip")
node = @("bin/node", "bin/npm")
PyPy = @("bin/python", "bin/pip")
Python = @{
tools = @("python", "bin/pip")
command = "--version"
}
node = @{
tools = @("bin/node", "bin/npm")
command = "--version"
}
PyPy = @{
tools = @("bin/python", "bin/pip")
command = "--version"
}
go = @{
tools = @("bin/go")
command = "version"
}
}
# Get toolset content
@@ -45,8 +58,8 @@ foreach($tool in $tools) {
foreach ($version in $tool.versions) {
# Add wildcard if missing
if (-not $version.Contains('*')) {
$version += '.*'
if ($version.Split(".").Length -lt 3) {
$version += ".*"
}
# Check if version folder exists
@@ -62,9 +75,10 @@ foreach($tool in $tools) {
| Select-Object -First 1
$foundVersionPath = Join-Path $foundVersion $tool.arch
Write-Host "Run validation test for $($tool.name)($($tool.arch)) $($foundVersion.name) executables..."
Run-ExecutableTests -Executables $toolExecs -ToolPath $foundVersionPath
if ($toolExecs) {
Write-Host "Run validation test for $($tool.name)($($tool.arch)) $($foundVersion.name) executables..."
Run-ExecutableTests -Executables $toolExecs -ToolPath $foundVersionPath
}
$foundVersionName = $foundVersion.name
if ($tool.name -eq 'PyPy')
{

View File

@@ -2,15 +2,26 @@
################################################################################
## File: aws-sam-cli.sh
## Desc: Installs AWS SAM CLI
## Must be run as non-root user after homebrew and clang
## Requires Python >=3.6, must be run as non-root user after toolset installation
################################################################################
# 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
# Download latest aws sam cli sources
TarballUrl=$(curl -s https://api.github.com/repos/awslabs/aws-sam-cli/releases/latest | jq -r '.tarball_url')
TarballPath="/tmp/aws-sam-cli.tar.gz"
wget $TarballUrl -O $TarballPath
tar -xzvf $TarballPath -C /tmp
cd /tmp/awslabs-aws-sam-cli*
# Use python 3.7 from toolcache to install aws sam, setuptools package required for the installation
Python3Dir=$(echo /opt/hostedtoolcache/Python/3.7*/x64)
Python3BinDir="${Python3Dir}/bin"
export PATH="$Python3Dir:$Python3BinDir:$PATH"
python3 -m pip install setuptools
python3 setup.py install
sudo ln -sf ${Python3BinDir}/sam /usr/local/bin/sam
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"

View File

@@ -6,13 +6,24 @@
# Source the helpers
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# Install the AWS CLI
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
rm awscli-bundle.zip
rm -rf awscli-bundle
# Install the AWS CLI v1 on Ubuntu16 and Ubuntu18, and AWS CLI v2 on Ubuntu20
if isUbuntu20 ; then
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install -i /usr/local/aws-cli -b /usr/local/bin
rm awscliv2.zip
rm -rf aws
fi
if isUbuntu16 || isUbuntu18 ; then
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
rm awscli-bundle.zip
rm -rf awscli-bundle
fi
# Validate the installation
echo "Validate the installation"

View File

@@ -1,43 +1,44 @@
#!/bin/bash
################################################################################
## File: azpowershell.sh
## Desc: Installed Azure PowerShell
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# List of versions
if isUbuntu20 ; then
versions=$(pwsh -Command '(Find-Module -Name Az).Version')
else
versions=(1.0.0 1.6.0 2.3.2 2.6.0 2.8.0 3.1.0 3.5.0 3.8.0)
fi
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
for version in ${versions[@]}; do
pwsh -Command "Save-Module -Name Az -LiteralPath /usr/share/az_$version -RequiredVersion $version -Force"
done
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for version in ${versions[@]}; do
modulePath="/usr/share/az_$version"
pwsh -Command "
\$env:PSModulePath = '${modulePath}:' + \$env:PSModulePath;
if ( -not (Get-Module -ListAvailable -Name Az.Accounts)) {
Write-Host 'Az Module was not installed'
exit 1
}"
if [ $? -ne 0 ]; then
echo "Az version $version is not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
for version in ${versions[@]}; do
DocumentInstalledItem "Az Module ($version)"
done
#!/bin/bash
################################################################################
## File: azpowershell.sh
## Desc: Installed Azure PowerShell
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# List of versions
if isUbuntu20 ; then
versions=$(pwsh -Command '(Find-Module -Name Az).Version')
else
toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"
versions=$(cat $toolsetJson | jq -r '.azureModules[] | select(.name | contains("az")) | .versions[]')
fi
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
for version in ${versions[@]}; do
pwsh -Command "Save-Module -Name Az -LiteralPath /usr/share/az_$version -RequiredVersion $version -Force"
done
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for version in ${versions[@]}; do
modulePath="/usr/share/az_$version"
pwsh -Command "
\$env:PSModulePath = '${modulePath}:' + \$env:PSModulePath;
if ( -not (Get-Module -ListAvailable -Name Az.Accounts)) {
Write-Host 'Az Module was not installed'
exit 1
}"
if [ $? -ne 0 ]; then
echo "Az version $version is not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
for version in ${versions[@]}; do
DocumentInstalledItem "Az Module ($version)"
done

View File

@@ -6,16 +6,9 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Temporary downgrade to 2.5.1 installation until version 2.7.0 with the fix for the issue is not released https://github.com/actions/virtual-environments/issues/948
# There is no 2.5.1 version for Ubuntu20
if isUbuntu16 || isUbuntu18 ; then
label=$(getOSVersionLabel)
apt-get install -y --allow-downgrades azure-cli=2.5.1-1~$label
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"

View File

@@ -11,29 +11,59 @@ source $HELPER_SCRIPTS/os.sh
set -e
common_packages="dnsutils
iproute2
iputils-ping
libunwind8
locales
openssh-client
tzdata
upx
zstd
libxkbfile-dev
pkg-config
libsecret-1-dev
libxss1
libgconf-2-4
dbus
xvfb
libgbm-dev
libgtk-3-0
tk
fakeroot
dpkg
rpm
xz-utils
xorriso
zsync
gnupg2
lib32z1
texinfo"
cmd_packages="curl
file
ftp
jq
netcat
ssh
parallel
rsync
shellcheck
sudo
telnet
time
unzip
zip
wget
m4
bison
flex"
if isUbuntu20 ; then
echo "Install python2"
apt-get install -y --no-install-recommends python-is-python2
fi
echo "Install dnsutils"
apt-get install -y --no-install-recommends dnsutils
echo "Install file"
apt-get install -y --no-install-recommends file
echo "Install ftp"
apt-get install -y --no-install-recommends ftp
echo "Install iproute2"
apt-get install -y --no-install-recommends iproute2
echo "Install iputils-ping"
apt-get install -y --no-install-recommends iputils-ping
echo "Install jq"
apt-get install -y --no-install-recommends jq
echo "Install libcurl"
if isUbuntu18 ; then
libcurelVer="libcurl3"
@@ -45,114 +75,15 @@ fi
apt-get install -y --no-install-recommends $libcurelVer
echo "Install libunwind8"
apt-get install -y --no-install-recommends libunwind8
for package in $common_packages $cmd_packages; do
echo "Install $package"
apt-get install -y --no-install-recommends $package
done
echo "Install locales"
apt-get install -y --no-install-recommends locales
echo "Install netcat"
apt-get install -y --no-install-recommends netcat
echo "Install openssh-client"
apt-get install -y --no-install-recommends openssh-client
echo "Install rsync"
apt-get install -y --no-install-recommends rsync
echo "Install shellcheck"
apt-get install -y --no-install-recommends shellcheck
echo "Install sudo"
apt-get install -y --no-install-recommends sudo
echo "Install telnet"
apt-get install -y --no-install-recommends telnet
echo "Install time"
apt-get install -y --no-install-recommends time
echo "Install tzdata"
apt-get install -y --no-install-recommends tzdata
echo "Install unzip"
apt-get install -y --no-install-recommends unzip
echo "Install upx"
apt-get install -y --no-install-recommends upx
echo "Install wget"
apt-get install -y --no-install-recommends wget
echo "Install zip"
apt-get install -y --no-install-recommends zip
echo "Install zstd"
apt-get install -y --no-install-recommends zstd
echo "Install libxkbfile"
apt-get install -y --no-install-recommends libxkbfile-dev
echo "Install pkg-config"
apt-get install -y --no-install-recommends pkg-config
echo "Install libsecret-1-dev"
apt-get install -y --no-install-recommends libsecret-1-dev
echo "Install libxss1"
apt-get install -y --no-install-recommends libxss1
echo "Install libgconf-2-4"
apt-get install -y --no-install-recommends libgconf-2-4
echo "Install dbus"
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
echo "Install tk"
apt install -y tk
echo "Install fakeroot"
apt-get install -y --no-install-recommends fakeroot
echo "Install dpkg"
apt-get install -y --no-install-recommends dpkg
echo "Install rpm"
apt-get install -y --no-install-recommends rpm
echo "Install xz-utils"
apt-get install -y --no-install-recommends xz-utils
echo "Install xorriso"
apt-get install -y --no-install-recommends xorriso
echo "Install zsync"
apt-get install -y --no-install-recommends zsync
echo "Install curl"
apt-get install -y --no-install-recommends curl
echo "Install parallel"
apt-get install -y --no-install-recommends parallel
echo "Install gnupg2"
apt-get install -y --no-install-recommends gnupg2
echo "Install lib32z1"
apt-get install -y --no-install-recommends lib32z1
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in curl file ftp jq netcat ssh parallel rsync shellcheck sudo telnet time unzip wget zip; do
for cmd in $cmd_packages; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
@@ -161,32 +92,9 @@ done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Basic CLI:"
DocumentInstalledItemIndent "curl"
DocumentInstalledItemIndent "dnsutils"
DocumentInstalledItemIndent "file"
DocumentInstalledItemIndent "ftp"
DocumentInstalledItemIndent "iproute2"
DocumentInstalledItemIndent "iputils-ping"
DocumentInstalledItemIndent "jq"
DocumentInstalledItem "Basic packages:"
for package in $common_packages $cmd_packages; do
DocumentInstalledItemIndent $package
done
DocumentInstalledItemIndent "$libcurelVer"
DocumentInstalledItemIndent "libgbm-dev"
DocumentInstalledItemIndent "libicu55"
DocumentInstalledItemIndent "libunwind8"
DocumentInstalledItemIndent "locales"
DocumentInstalledItemIndent "netcat"
DocumentInstalledItemIndent "openssh-client"
DocumentInstalledItemIndent "parallel"
DocumentInstalledItemIndent "rsync"
DocumentInstalledItemIndent "shellcheck"
DocumentInstalledItemIndent "sudo"
DocumentInstalledItemIndent "telnet"
DocumentInstalledItemIndent "time"
DocumentInstalledItemIndent "tzdata"
DocumentInstalledItemIndent "unzip"
DocumentInstalledItemIndent "upx"
DocumentInstalledItemIndent "wget"
DocumentInstalledItemIndent "zip"
DocumentInstalledItemIndent "zstd"
DocumentInstalledItemIndent "gnupg2"
DocumentInstalledItemIndent "lib32z1"

View File

@@ -1,22 +0,0 @@
#!/bin/bash
################################################################################
## File: boost.sh
## Desc: Installs Boost C++ Libraries
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
TOOLSET_PATH="$INSTALLER_SCRIPT_FOLDER/toolcache.json"
BOOST_LIB=/usr/local/share/boost
BOOST_VERSIONS=$(cat $TOOLSET_PATH | jq -r 'to_entries[] | select(.key | match("boost")) | .value[] +".0"')
# Install Boost
for BOOST_VERSION in ${BOOST_VERSIONS}
do
BOOST_SYMLINK_VER=$(echo "${BOOST_VERSION//[.]/_}")
BOOST_ROOT_VERSION="BOOST_ROOT_$BOOST_SYMLINK_VER"
echo "$BOOST_ROOT_VERSION=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment
DocumentInstalledItem "Boost C++ Libraries $BOOST_VERSION"
done

View File

@@ -5,3 +5,17 @@ echo ImageOS=$IMAGE_OS | tee -a /etc/environment
# This directory is supposed to be created in $HOME and owned by user(https://github.com/actions/virtual-environments/issues/491)
mkdir -p /etc/skel/.config/configstore
echo 'export XDG_CONFIG_HOME=$HOME/.config' | tee -a /etc/skel/.bashrc
# Change waagent entries to use /mnt for swapfile
sed -i 's/ResourceDisk.Format=n/ResourceDisk.Format=y/g' /etc/waagent.conf
sed -i 's/ResourceDisk.EnableSwap=n/ResourceDisk.EnableSwap=y/g' /etc/waagent.conf
sed -i 's/ResourceDisk.SwapSizeMB=0/ResourceDisk.SwapSizeMB=4096/g' /etc/waagent.conf
# Add localhost alias to ::1 IPv6
sed -i 's/::1 ip6-localhost ip6-loopback/::1 localhost ip6-localhost ip6-loopback/g' /etc/hosts
# Prepare directory and env variable for toolcache
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
mkdir $AGENT_TOOLSDIRECTORY
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment
chmod -R 777 $AGENT_TOOLSDIRECTORY

View File

@@ -6,9 +6,15 @@
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
docker_package=moby
# There is no stable docker-moby for Ubuntu 20 at the moment
if isUbuntu20 ; then
add-apt-repository "deb [arch=amd64,armhf,arm64] https://packages.microsoft.com/ubuntu/20.04/prod testing main"
fi
## Check to see if docker is already installed
echo "Determing if Docker ($docker_package) is installed"
if ! IsInstalled $docker_package; then
@@ -21,6 +27,10 @@ else
echo "Docker ($docker_package) is already installed"
fi
# Enable docker.service
systemctl is-active --quiet docker.service || systemctl start docker.service
systemctl is-enabled --quiet docker.service || systemctl enable docker.service
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
echo "Checking the docker-moby and moby-buildx"

View File

@@ -16,7 +16,7 @@ fi
if isUbuntu16 || isUbuntu18 ; then
LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.0" "dotnet-sdk-3.1")
release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.0/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json")
release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.0/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json")
fi
mksamples()

View File

@@ -1,29 +0,0 @@
#!/bin/bash
################################################################################
## File: dotnetcore.sh
## Desc: Installs .NET Core onto the image for running the provisioner
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
DOTNET_PACKAGE=dotnet-dev-1.0.4
echo "Determing if .NET Core ($DOTNET_PACKAGE) is installed"
if ! IsInstalled $DOTNET_PACKAGE; then
echo "Could not find .NET Core ($DOTNET_PACKAGE), installing..."
echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
apt-get update
apt-get install $DOTNET_PACKAGE -y
else
echo ".NET Core ($DOTNET_PACKAGE) is already installed"
fi
echo "Testing .NET Core ($DOTNET_PACKAGE)"
echo "Pulling down initial dependencies"
dotnet help
echo "Documenting .NET Core ($DOTNET_PACKAGE)"
DOTNET_VERSION=`dotnet --version`
DocumentInstalledItem ".NET Core $DOTNET_VERSION"

View File

@@ -1,58 +0,0 @@
#!/bin/bash
################################################################################
## File: go.sh
## Desc: Installs go, configures GOROOT, and adds go to the path
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
golangTags="/tmp/golang_tags.json"
# This function installs Go using the specified arguments:
# $1=MajorVersion (1.11)
# $2=IsDefaultVersion (true or false)
function InstallGo () {
version=$( getFullGoVersion $1 )
downloadVersion="go$version.linux-amd64.tar.gz"
goFolder="$AGENT_TOOLSDIRECTORY/go/$version/x64"
echo "Install Go $version"
curl -sL https://dl.google.com/go/${downloadVersion} -o ${downloadVersion}
mkdir -p $goFolder
tar -C $goFolder -xzf $downloadVersion --strip-components=1 go
rm $downloadVersion
echo "GOROOT_${1//./_}_X64=$goFolder" | tee -a /etc/environment
DocumentInstalledItem "Go $version ($($goFolder/bin/go version))"
# Create symlink in old location /usr/local/go<version> to new location
ln -s $goFolder /usr/local/go$version
# If this version of Go is to be the default version,
# symlink it into the path and point GOROOT to it.
if [ $2 = true ]
then
ln -s $goFolder/bin/* /usr/bin/
echo "GOROOT=$goFolder" | tee -a /etc/environment
fi
}
function getFullGoVersion () {
local pattern="refs/tags/go$1([.0-9]{0,3})$"
local query='[.[] | select( .ref | test($pattern))] | .[-1] | .ref'
refValue=$(jq --arg pattern "$pattern" "$query" $golangTags)
version=$(echo "$refValue" | cut -d '/' -f 3 | awk -F 'go' '{print $2}')
version=$(echo "${version//\"}") # 1.12.17
echo $version
}
# load golang_tags.json file
curl -s 'https://api.github.com/repos/golang/go/git/refs/tags' > $golangTags
# Install Go versions
for go in ${GO_VERSIONS}; do
echo "Installing Go ${go}"
if [[ $go == $GO_DEFAULT ]]; then
InstallGo $go true
else
InstallGo $go false
fi
done

View File

@@ -8,7 +8,7 @@
echo "Validate the Homebrew can run after reboot"
if ! command -v brew; then
echo "brew cat not run after reboot"
echo "brew executable not found after reboot"
exit 1
fi

View File

@@ -2,6 +2,7 @@
################################################################################
## File: homebrew.sh
## Desc: Installs the Homebrew on Linux
## Caveat: Brew MUST NOT be used to install any tool during the image build to avoid dependencies, which may come along with the tool
################################################################################
# Source the helpers
@@ -20,7 +21,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/')
appendEtcEnvironmentPath "$brew_path"
prependEtcEnvironmentPath "$brew_path"
# Validate the installation ad hoc
echo "Validate the installation reloading /etc/environment"

View File

@@ -12,11 +12,6 @@ set -e
TOOLCACHE_REGISTRY="npm.pkg.github.com"
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
mkdir $AGENT_TOOLSDIRECTORY
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment
chmod -R 777 $AGENT_TOOLSDIRECTORY
echo "Configure npm to use github package registry for '@actions' scope"
npm config set @actions:registry "https://${TOOLCACHE_REGISTRY}"

View File

@@ -10,14 +10,18 @@ source $HELPER_SCRIPTS/os.sh
set -e
# Install the Azul Systems Zulu JDKs
# See https://www.azul.com/downloads/azure-only/zulu/
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
apt-add-repository "deb http://repos.azul.com/azure-only/zulu/apt stable main"
apt-get -q update
# Install GPG Key for Adopt Open JDK. See https://adoptopenjdk.net/installation.html
wget -qO - "https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public" | apt-key add -
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
if isUbuntu16 || isUbuntu18 ; then
# Install GPG Key for Azul Open JDK. See https://www.azul.com/downloads/azure-only/zulu/
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
apt-add-repository "deb http://repos.azul.com/azure-only/zulu/apt stable main"
apt-get update
apt-get -y install zulu-7-azure-jdk=\*
# Open JDP Adopt does not exist for Ubuntu 20
apt-get -y install adoptopenjdk-12-hotspot=\*
echo "JAVA_HOME_7_X64=/usr/lib/jvm/zulu-7-azure-amd64" | tee -a /etc/environment
DEFAULT_JDK_VERSION=8
defaultLabel8="(default)"
@@ -26,17 +30,22 @@ fi
if isUbuntu20 ; then
DEFAULT_JDK_VERSION=11
defaultLabel11="(default)"
apt-get update
fi
apt-get -y install zulu-8-azure-jdk=\*
apt-get -y install zulu-11-azure-jdk=\*
apt-get -y install zulu-12-azure-jdk=\*
update-java-alternatives -s /usr/lib/jvm/zulu-8-azure-amd64
# Install only LTS versions.
apt-get -y install adoptopenjdk-8-hotspot=\*
apt-get -y install adoptopenjdk-11-hotspot=\*
echo "JAVA_HOME_8_X64=/usr/lib/jvm/zulu-8-azure-amd64" | tee -a /etc/environment
echo "JAVA_HOME_11_X64=/usr/lib/jvm/zulu-11-azure-amd64" | tee -a /etc/environment
echo "JAVA_HOME_12_X64=/usr/lib/jvm/zulu-12-azure-amd64" | tee -a /etc/environment
echo "JAVA_HOME=/usr/lib/jvm/zulu-${DEFAULT_JDK_VERSION}-azure-amd64" | tee -a /etc/environment
# Set Default Java version.
update-java-alternatives -s /usr/lib/jvm/adoptopenjdk-${DEFAULT_JDK_VERSION}-hotspot-amd64
echo "JAVA_HOME_8_X64=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64" | tee -a /etc/environment
echo "JAVA_HOME_11_X64=/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64" | tee -a /etc/environment
if isUbuntu16 || isUbuntu18 ; then
echo "JAVA_HOME_12_X64=/usr/lib/jvm/adoptopenjdk-12-hotspot-amd64" | tee -a /etc/environment
fi
echo "JAVA_HOME=/usr/lib/jvm/adoptopenjdk-${DEFAULT_JDK_VERSION}-hotspot-amd64" | tee -a /etc/environment
echo "JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8" | tee -a /etc/environment
# Install Ant
@@ -79,13 +88,16 @@ done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Azul Zulu OpenJDK:"
if isUbuntu16 || isUbuntu18 ; then
DocumentInstalledItem "Azul Zulu OpenJDK:"
DocumentInstalledItemIndent "7 ($(/usr/lib/jvm/zulu-7-azure-amd64/bin/java -showversion |& head -n 1))"
fi
DocumentInstalledItemIndent "8 ($(/usr/lib/jvm/zulu-8-azure-amd64/bin/java -showversion |& head -n 1)) $defaultLabel8"
DocumentInstalledItemIndent "11 ($(/usr/lib/jvm/zulu-11-azure-amd64/bin/java -showversion |& head -n 1)) $defaultLabel11"
DocumentInstalledItemIndent "12 ($(/usr/lib/jvm/zulu-12-azure-amd64/bin/java -showversion |& head -n 1))"
DocumentInstalledItem "Adopt OpenJDK:"
DocumentInstalledItemIndent "8 ($(/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java -showversion |& head -n 1)) $defaultLabel8"
DocumentInstalledItemIndent "11 ($(/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/bin/java -showversion |& head -n 1)) $defaultLabel11"
if isUbuntu16 || isUbuntu18 ; then
DocumentInstalledItemIndent "12 ($(/usr/lib/jvm/adoptopenjdk-12-hotspot-amd64/bin/java -showversion |& head -n 1))"
fi
DocumentInstalledItem "Ant ($(ant -version))"
DocumentInstalledItem "Gradle ${gradleVersion}"
DocumentInstalledItem "Maven ($(mvn -version | head -n 1))"

View File

@@ -9,19 +9,31 @@ source $HELPER_SCRIPTS/document.sh
export ACCEPT_EULA=Y
# Install MySQL Client
apt-get install mysql-client -y
if isUbuntu16 || isUbuntu18 ; then
apt-get install mysql-client -y
fi
# InstallMySQL database development files
apt-get install libmysqlclient-dev -y
if isUbuntu20 ; then
# Install mysql 8 for Ubuntu 20.
# Install MySQL Server
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-server select mysql-8.0'
package_version=$(curl https://dev.mysql.com/downloads/repo/apt/ 2> /dev/null | grep "\.deb" | awk -F "[()]" '{print $2}')
wget https://dev.mysql.com/get/$package_version
dpkg -i $package_version
apt update
fi
# Mysql setting up root password
MYSQL_ROOT_PASSWORD=root
echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
# Install MySQL Server
apt-get install -y mysql-server
#Install MySQL Dev tools
apt install libmysqlclient-dev -y
# Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017)
apt-get install -y mssql-tools unixodbc-dev
apt-get -f install

View File

@@ -10,7 +10,7 @@ source $HELPER_SCRIPTS/document.sh
# Install LTS Node.js and related build tools
curl -sL https://raw.githubusercontent.com/mklement0/n-install/stable/bin/n-install | bash -s -- -ny -
~/n/bin/n lts
npm install -g grunt gulp n parcel-bundler typescript
npm install -g grunt gulp n parcel-bundler typescript newman
npm install -g --save-dev webpack webpack-cli
npm install -g npm
rm -rf ~/n
@@ -25,7 +25,7 @@ apt-get install -y --no-install-recommends yarn
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in node grunt gulp webpack parcel yarn; do
for cmd in node grunt gulp webpack parcel yarn newman; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
@@ -43,3 +43,4 @@ DocumentInstalledItem "TypeScript ($(tsc --version))"
DocumentInstalledItem "Webpack ($(webpack --version))"
DocumentInstalledItem "Webpack CLI ($(webpack-cli --version))"
DocumentInstalledItem "Yarn ($(yarn --version))"
DocumentInstalledItem "Newman ($(newman --version))"

View File

@@ -19,4 +19,7 @@ if ! command -v nvm; then
exit 1
fi
# set system node.js as default one
nvm alias default system
DocumentInstalledItem "nvm ($(nvm --version))"

View File

@@ -1,137 +1,138 @@
#!/bin/bash
################################################################################
## File: php.sh
## Desc: Installs php
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh
set -e
# add repository
apt-add-repository ppa:ondrej/php -y
apt-get update
# Install PHP
if isUbuntu16 ; then
php_versions="5.6 7.0 7.1 7.2 7.3 7.4"
fi
if isUbuntu18 ; then
php_versions="7.1 7.2 7.3 7.4"
fi
if isUbuntu20 ; then
php_versions="7.4"
fi
for version in $php_versions; do
echo "Installing PHP $version"
apt-fast install -y --no-install-recommends \
php$version \
php$version-bcmath \
php$version-bz2 \
php$version-cgi \
php$version-cli \
php$version-common \
php$version-curl \
php$version-dba \
php$version-dev \
php$version-enchant \
php$version-fpm \
php$version-gd \
php$version-gmp \
php$version-imap \
php$version-interbase \
php$version-intl \
php$version-json \
php$version-ldap \
php$version-mbstring \
php$version-mysql \
php$version-odbc \
php$version-opcache \
php$version-pgsql \
php$version-phpdbg \
php$version-pspell \
php$version-readline \
php$version-snmp \
php$version-soap \
php$version-sqlite3 \
php$version-sybase \
php$version-tidy \
php$version-xml \
php$version-xmlrpc \
php$version-xsl \
php$version-zip
if [[ $version == "5.6" || $version == "7.0" || $version == "7.1" ]]; then
apt-fast install -y --no-install-recommends php$version-mcrypt php$version-recode
apt-get remove --purge -yq php$version-dev
fi
if [[ $version == "7.2" || $version == "7.3" ]]; then
apt-fast install -y --no-install-recommends php$version-recode
fi
done
apt-fast install -y --no-install-recommends \
php-amqp \
php-apcu \
php-igbinary \
php-memcache \
php-memcached \
php-mongodb \
php-redis \
php-xdebug \
php-yaml \
php-zmq
apt-get remove --purge -yq php7.2-dev
apt-fast install -y --no-install-recommends snmp
# Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
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
#Create composer folder for user to preserve folder permissions
mkdir -p /etc/skel/.composer
# Install phpunit (for PHP)
wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar
chmod +x phpunit
mv phpunit /usr/local/bin/phpunit
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in php $php_versions composer phpunit; do
if [[ $cmd =~ ^[0-9] ]]; then
cmd="php$cmd"
fi
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
for version in $php_versions; do
DocumentInstalledItem "PHP $version ($(php$version --version | head -n 1))"
done;
DocumentInstalledItem "Composer ($(composer --version))"
DocumentInstalledItem "PHPUnit ($(phpunit --version))"
#!/bin/bash
################################################################################
## File: php.sh
## Desc: Installs php
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
set -e
# add repository
apt-add-repository ppa:ondrej/php -y
apt-get update
# Install PHP
if isUbuntu16 ; then
php_versions="5.6 7.0 7.1 7.2 7.3 7.4"
fi
if isUbuntu18 ; then
php_versions="7.1 7.2 7.3 7.4"
fi
if isUbuntu20 ; then
php_versions="7.4"
fi
for version in $php_versions; do
echo "Installing PHP $version"
apt-fast install -y --no-install-recommends \
php$version \
php$version-bcmath \
php$version-bz2 \
php$version-cgi \
php$version-cli \
php$version-common \
php$version-curl \
php$version-dba \
php$version-dev \
php$version-enchant \
php$version-fpm \
php$version-gd \
php$version-gmp \
php$version-imap \
php$version-interbase \
php$version-intl \
php$version-json \
php$version-ldap \
php$version-mbstring \
php$version-mysql \
php$version-odbc \
php$version-opcache \
php$version-pgsql \
php$version-phpdbg \
php$version-pspell \
php$version-readline \
php$version-snmp \
php$version-soap \
php$version-sqlite3 \
php$version-sybase \
php$version-tidy \
php$version-xml \
php$version-xmlrpc \
php$version-xsl \
php$version-zip
if [[ $version == "5.6" || $version == "7.0" || $version == "7.1" ]]; then
apt-fast install -y --no-install-recommends php$version-mcrypt php$version-recode
apt-get remove --purge -yq php$version-dev
fi
if [[ $version == "7.2" || $version == "7.3" ]]; then
apt-fast install -y --no-install-recommends php$version-recode
fi
done
apt-fast install -y --no-install-recommends \
php-amqp \
php-apcu \
php-igbinary \
php-memcache \
php-memcached \
php-mongodb \
php-redis \
php-xdebug \
php-yaml \
php-zmq
apt-get remove --purge -yq php7.2-dev
apt-fast install -y --no-install-recommends snmp
# Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
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
#Create composer folder for user to preserve folder permissions
mkdir -p /etc/skel/.composer
# Install phpunit (for PHP)
wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar
chmod +x phpunit
mv phpunit /usr/local/bin/phpunit
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in php $php_versions composer phpunit; do
if [[ $cmd =~ ^[0-9] ]]; then
cmd="php$cmd"
fi
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
for version in $php_versions; do
DocumentInstalledItem "PHP $version ($(php$version --version | head -n 1))"
done
DocumentInstalledItem "Composer ($(composer --version))"
DocumentInstalledItem "PHPUnit ($(phpunit --version))"

View File

@@ -1,95 +1,95 @@
#!/bin/bash
################################################################################
## File: pypy.sh
## Desc: Installs PyPy
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
# This function installs PyPy using the specified arguments:
# $1=PACKAGE_URL
function InstallPyPy
{
PACKAGE_URL=$1
PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}')
echo "Downloading tar archive '$PACKAGE_TAR_NAME' - '$PACKAGE_URL'"
PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME"
download_with_retries $PACKAGE_URL "/tmp" $PACKAGE_TAR_NAME
echo "Expand '$PACKAGE_TAR_NAME' to the /tmp folder"
tar xf $PACKAGE_TAR_TEMP_PATH -C /tmp
# Get Python version
PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/}
MAJOR_VERSION=$(echo ${PACKAGE_NAME/pypy/} | cut -d. -f1)
PYTHON_MAJOR="python$MAJOR_VERSION"
if [ $MAJOR_VERSION != 2 ]; then
PYPY_MAJOR="pypy$MAJOR_VERSION"
else
PYPY_MAJOR="pypy"
fi
PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME"
PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
# PyPy folder structure
PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy
PYPY_TOOLCACHE_VERSION_PATH=$PYPY_TOOLCACHE_PATH/$PYTHON_FULL_VERSION
PYPY_TOOLCACHE_VERSION_ARCH_PATH=$PYPY_TOOLCACHE_VERSION_PATH/x64
echo "Check if PyPy hostedtoolcache folder exist..."
if [ ! -d $PYPY_TOOLCACHE_PATH ]; then
mkdir -p $PYPY_TOOLCACHE_PATH
fi
echo "Create PyPy '$PYPY_TOOLCACHE_VERSION_PATH' folder"
mkdir $PYPY_TOOLCACHE_VERSION_PATH
echo "Move PyPy '$PACKAGE_TEMP_FOLDER' binaries to '$PYPY_TOOLCACHE_VERSION_ARCH_PATH' folder"
mv $PACKAGE_TEMP_FOLDER $PYPY_TOOLCACHE_VERSION_ARCH_PATH
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin
ln -s $PYPY_MAJOR $PYTHON_MAJOR
ln -s $PYTHON_MAJOR python
chmod +x ./python ./$PYTHON_MAJOR
echo "Install latest Pip"
./python -m ensurepip
./python -m pip install --ignore-installed pip
echo "Create complete file"
touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete
echo "Remove '$PACKAGE_TAR_TEMP_PATH'"
rm -f $PACKAGE_TAR_TEMP_PATH
}
# Installation PyPy
uri="https://downloads.python.org/pypy/"
download_with_retries $uri "/tmp" "pypyUrls.html"
pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')"
toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"
toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
# Fail out if any setups fail
set -e
for toolsetVersion in $toolsetVersions; do
latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1)
if [[ -z "$latestMajorPyPyVersion" ]]; then
echo "Failed to get PyPy version '$toolsetVersion'"
exit 1
fi
InstallPyPy $latestMajorPyPyVersion
done
#!/bin/bash
################################################################################
## File: pypy.sh
## Desc: Installs PyPy
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
# This function installs PyPy using the specified arguments:
# $1=PACKAGE_URL
function InstallPyPy
{
PACKAGE_URL=$1
PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}')
echo "Downloading tar archive '$PACKAGE_TAR_NAME' - '$PACKAGE_URL'"
PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME"
download_with_retries $PACKAGE_URL "/tmp" $PACKAGE_TAR_NAME
echo "Expand '$PACKAGE_TAR_NAME' to the /tmp folder"
tar xf $PACKAGE_TAR_TEMP_PATH -C /tmp
# Get Python version
PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/}
MAJOR_VERSION=$(echo ${PACKAGE_NAME/pypy/} | cut -d. -f1)
PYTHON_MAJOR="python$MAJOR_VERSION"
if [ $MAJOR_VERSION != 2 ]; then
PYPY_MAJOR="pypy$MAJOR_VERSION"
else
PYPY_MAJOR="pypy"
fi
PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME"
PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
# PyPy folder structure
PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy
PYPY_TOOLCACHE_VERSION_PATH=$PYPY_TOOLCACHE_PATH/$PYTHON_FULL_VERSION
PYPY_TOOLCACHE_VERSION_ARCH_PATH=$PYPY_TOOLCACHE_VERSION_PATH/x64
echo "Check if PyPy hostedtoolcache folder exist..."
if [ ! -d $PYPY_TOOLCACHE_PATH ]; then
mkdir -p $PYPY_TOOLCACHE_PATH
fi
echo "Create PyPy '$PYPY_TOOLCACHE_VERSION_PATH' folder"
mkdir $PYPY_TOOLCACHE_VERSION_PATH
echo "Move PyPy '$PACKAGE_TEMP_FOLDER' binaries to '$PYPY_TOOLCACHE_VERSION_ARCH_PATH' folder"
mv $PACKAGE_TEMP_FOLDER $PYPY_TOOLCACHE_VERSION_ARCH_PATH
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin
ln -s $PYPY_MAJOR $PYTHON_MAJOR
ln -s $PYTHON_MAJOR python
chmod +x ./python ./$PYTHON_MAJOR
echo "Install latest Pip"
./python -m ensurepip
./python -m pip install --ignore-installed pip
echo "Create complete file"
touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete
echo "Remove '$PACKAGE_TAR_TEMP_PATH'"
rm -f $PACKAGE_TAR_TEMP_PATH
}
# Installation PyPy
uri="https://downloads.python.org/pypy/"
download_with_retries $uri "/tmp" "pypyUrls.html" compressed
pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')"
toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"
toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
# Fail out if any setups fail
set -e
for toolsetVersion in $toolsetVersions; do
latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1)
if [[ -z "$latestMajorPyPyVersion" ]]; then
echo "Failed to get PyPy version '$toolsetVersion'"
exit 1
fi
InstallPyPy $latestMajorPyPyVersion
done
chown -R "$SUDO_USER:$SUDO_USER" "$AGENT_TOOLSDIRECTORY/PyPy"

View File

@@ -1,31 +1,31 @@
#!/bin/bash
################################################################################
## File: zeit-now.sh
## Desc: Installs the Zeit Now CLI
## File: vercel.sh
## Desc: Installs the Vercel CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install the Zeit Vercel CLI
# Install the Vercel CLI
npm i -g vercel
# Validate the installation
echo "Validate the installation"
if ! command -v vercel; then
echo "Zeit Vercel CLI was not installed"
echo "Vercel CLI was not installed"
exit 1
fi
echo "Creating the symlink now to vercel"
echo "Creating the symlink for [now] command to vercel CLI"
ln -s /usr/local/bin/vercel /usr/local/bin/now
echo "Validate the link"
if ! command -v now; then
echo "Now link to Zeit Vercel CLI was not created"
echo "[Now] symlink to Vercel CLI was not created"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "Zeit Vercel CLI ($(vercel --version))"
DocumentInstalledItem "Vercel CLI ($(vercel --version))"