Merge branch 'master' into v-mimina/docker-moby-version-fix

This commit is contained in:
Mihran Minasyan
2020-02-27 16:43:10 +04:00
33 changed files with 489 additions and 222 deletions

View File

@@ -31,11 +31,12 @@ apt-fast install -y --no-install-recommends \
sudo \
telnet \
time \
tzdata \
unzip \
upx \
wget \
zip \
tzdata
zstd
# Electron / VSCode / GitHub Desktop prereqs
apt-fast install -y --no-install-recommends \
@@ -86,8 +87,9 @@ DocumentInstalledItemIndent "shellcheck"
DocumentInstalledItemIndent "sudo"
DocumentInstalledItemIndent "telnet"
DocumentInstalledItemIndent "time"
DocumentInstalledItemIndent "tzdata"
DocumentInstalledItemIndent "unzip"
DocumentInstalledItemIndent "upx"
DocumentInstalledItemIndent "wget"
DocumentInstalledItemIndent "zip"
DocumentInstalledItemIndent "tzdata"
DocumentInstalledItemIndent "zstd"

View File

@@ -1,91 +0,0 @@
#!/bin/bash
################################################################################
## File: dotnetcore-sdk.sh
## Desc: Installs .NET Core SDK
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.0" "dotnet-sdk-3.1")
LSB_RELEASE=$(lsb_release -rs)
mksamples()
{
sdk=$1
sample=$2
mkdir "$sdk"
cd "$sdk" || exit
set -e
dotnet help
dotnet new globaljson --sdk-version "$sdk"
dotnet new "$sample"
dotnet restore
dotnet build
set +e
cd .. || exit
rm -rf "$sdk"
}
set -e
for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do
echo "Determing if .NET Core ($latest_package) is installed"
if ! IsInstalled $latest_package; then
echo "Could not find .NET Core ($latest_package), installing..."
apt-get install $latest_package -y
else
echo ".NET Core ($latest_package) is already installed"
fi
done
# Get list of all released SDKs from channels which are not end-of-life or preview
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")
sdks=()
for release_url in ${release_urls[@]}; do
echo "${release_url}"
releases=$(curl "${release_url}")
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdk.version'))
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version'))
done
sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r)
for sdk in $sortedSdks; do
url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz"
echo "$url" >> urls
echo "Adding $url to list to download later"
done
# Download additional SDKs
echo "Downloading release tarballs..."
cat urls | xargs -n 1 -P 16 wget -q
for tarball in *.tar.gz; do
dest="./tmp-$(basename -s .tar.gz $tarball)"
echo "Extracting $tarball to $dest"
mkdir "$dest" && tar -C "$dest" -xzf "$tarball"
rsync -qav "$dest/shared/" /usr/share/dotnet/shared/
rsync -qav "$dest/host/" /usr/share/dotnet/host/
rsync -qav "$dest/sdk/" /usr/share/dotnet/sdk/
rm -rf "$dest"
rm "$tarball"
done
rm urls
DocumentInstalledItem ".NET Core SDK:"
# Smoke test each SDK
for sdk in $sortedSdks; do
mksamples "$sdk" "console"
mksamples "$sdk" "mstest"
mksamples "$sdk" "xunit"
mksamples "$sdk" "web"
mksamples "$sdk" "mvc"
mksamples "$sdk" "webapi"
DocumentInstalledItemIndent "$sdk"
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
echo 'export PATH="$PATH:$HOME/.dotnet/tools"' | tee -a /etc/skel/.bashrc

View File

@@ -7,8 +7,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
# Install Powershell
apt-get install -y powershell

View File

@@ -1,60 +0,0 @@
#!/bin/bash
################################################################################
## File: azpowershell.sh
## Desc: Installed Azure PowerShell
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.0.0 -RequiredVersion 1.0.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.6.0 -RequiredVersion 1.6.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.3.2 -RequiredVersion 2.3.2 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.6.0 -RequiredVersion 2.6.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.8.0 -RequiredVersion 2.8.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_3.1.0 -RequiredVersion 3.1.0 -Force'
# 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 ! pwsh -Command '$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.0.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.6.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.3.2:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.6.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.8.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_3.1.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath'; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Az Module (1.0.0)"
DocumentInstalledItem "Az Module (1.6.0)"
DocumentInstalledItem "Az Module (2.3.2)"
DocumentInstalledItem "Az Module (2.6.0)"
DocumentInstalledItem "Az Module (2.8.0)"
DocumentInstalledItem "Az Module (3.1.0)"

View File

@@ -58,6 +58,9 @@ 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
@@ -70,8 +73,8 @@ apt-get install -y --no-install-recommends wget
echo "Install zip"
apt-get install -y --no-install-recommends zip
echo "Install tzdata"
apt-get install -y --no-install-recommends tzdata
echo "Install zstd"
apt-get install -y --no-install-recommends zstd
echo "Install libxkbfile"
apt-get install -y --no-install-recommends libxkbfile-dev
@@ -155,8 +158,9 @@ DocumentInstalledItemIndent "shellcheck"
DocumentInstalledItemIndent "sudo"
DocumentInstalledItemIndent "telnet"
DocumentInstalledItemIndent "time"
DocumentInstalledItemIndent "tzdata"
DocumentInstalledItemIndent "unzip"
DocumentInstalledItemIndent "upx"
DocumentInstalledItemIndent "wget"
DocumentInstalledItemIndent "zip"
DocumentInstalledItemIndent "tzdata"
DocumentInstalledItemIndent "zstd"

View File

@@ -7,14 +7,14 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
# libicu64, which comes with php-intl module, has powershell breaking issue https://github.com/PowerShell/PowerShell/issues/9746
# Fix - install additional libicu65 where the issue is fixed
echo "install libicu65"
apt get install libicu65
# Install Powershell
apt-get install -y powershell
# Temp fix based on: https://github.com/PowerShell/PowerShell/issues/9746
sudo apt remove libicu64
# 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 pwsh; then

View File

@@ -14,6 +14,7 @@ sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.3.2 -Requi
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.6.0 -RequiredVersion 2.6.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.8.0 -RequiredVersion 2.8.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_3.1.0 -RequiredVersion 3.1.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_3.5.0 -RequiredVersion 3.5.0 -Force'
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
@@ -46,6 +47,11 @@ if ! pwsh -Command '$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_3.5.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath'; then
exit 1
fi
@@ -58,3 +64,4 @@ DocumentInstalledItem "Az Module (2.3.2)"
DocumentInstalledItem "Az Module (2.6.0)"
DocumentInstalledItem "Az Module (2.8.0)"
DocumentInstalledItem "Az Module (3.1.0)"
DocumentInstalledItem "Az Module (3.5.0)"

View File

@@ -7,13 +7,8 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_CODENAME=$(lsb_release -cs)
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $LSB_CODENAME main" | tee /etc/apt/sources.list.d/azure-cli.list
apt-key adv --keyserver packages.microsoft.com --recv-keys B02C46DF417A0893
apt-get update
apt-get install -y --no-install-recommends apt-transport-https azure-cli
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# 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

@@ -7,6 +7,11 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# AZURE_EXTENSION_DIR shell variable defines where modules are installed
# https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
export AZURE_EXTENSION_DIR=/opt/az/azcliextensions
echo "AZURE_EXTENSION_DIR=$AZURE_EXTENSION_DIR" | tee -a /etc/environment
# install azure devops Cli extension
az extension add -n azure-devops

View File

@@ -15,10 +15,6 @@ if ! IsInstalled $docker_package; then
echo "Docker ($docker_package) was not found. Installing..."
apt-get remove -y moby-engine moby-cli
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/microsoft-prod.list
apt-get update
apt-get install -y moby-engine moby-cli
else
echo "Docker ($docker_package) is already installed"

View File

@@ -3,7 +3,6 @@
## File: dotnetcore-sdk.sh
## Desc: Installs .NET Core SDK
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
@@ -37,12 +36,12 @@ for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do
echo "Determing if .NET Core ($latest_package) is installed"
if ! IsInstalled $latest_package; then
echo "Could not find .NET Core ($latest_package), installing..."
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'
apt-get install apt-transport-https
apt-get update
apt-get install $latest_package -y
#temporary avoid 3.1.102 installation due to https://github.com/dotnet/aspnetcore/issues/19133
if [ $latest_package != "dotnet-sdk-3.1" ]; then
apt-get install $latest_package -y
else
apt-get install dotnet-sdk-3.1=3.1.101-1 -y
fi
else
echo ".NET Core ($latest_package) is already installed"
fi
@@ -58,7 +57,8 @@ for release_url in ${release_urls[@]}; do
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version'))
done
sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r)
#temporary avoid 3.1.102 installation due to https://github.com/dotnet/aspnetcore/issues/19133
sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v 3.1.102 | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r)
for sdk in $sortedSdks; do
url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz"

View File

@@ -0,0 +1,62 @@
#!/bin/bash
################################################################################
## File: julia.sh
## Desc: Installs Julia, and adds Julia to the path
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# This function fetches the latest Julia release from the GitHub API
# Based on https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
function GetLatestJuliaRelease () {
curl --silent "https://api.github.com/repos/julialang/julia/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/' |
sed 's/v//' # remove v prefix
}
# This function installs Julia using the specified arguments:
# $1=MajorAndMinorVersion (1.3.1)
# $2=IsDefaultVersion (true or false)
function InstallJulia () {
# Extract Major and Minor version from full version string
juliaMajorAndMinorVersion="$(sed 's/\.[^.]*$//' <<< $1)"
curl -sL "https://julialang-s3.julialang.org/bin/linux/x64/$juliaMajorAndMinorVersion/julia-$1-linux-x86_64.tar.gz" -o "julia-$1-linux-x86_64.tar.gz"
mkdir -p "/usr/local/julia$juliaMajorAndMinorVersion"
tar -C "/usr/local/julia$juliaMajorAndMinorVersion" -xzf "julia-$1-linux-x86_64.tar.gz" --strip-components=1 julia
rm "julia-$1-linux-x86_64.tar.gz"
# If this version of Julia is to be the default version,
# symlink it into the path
if [ "$2" = true ]; then
ln -s "/usr/local/julia$juliaMajorAndMinorVersion/bin/julia" /usr/bin/julia
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 this version of Julia is to be the default version,
# check that it has been added to PATH
if [ "$2" = true ]; then
if ! command -v julia; then
echo "Julia was not installed or found on PATH"
exit 1
fi
fi
# Verify output of julia --version
if [ ! "$(/usr/local/julia"$juliaMajorAndMinorVersion"/bin/julia --version)" = "julia version $1" ]; then
echo "Julia was not installed correctly"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Julia ($(julia --version))"
}
InstallJulia "$(GetLatestJuliaRelease)" true