Merge branch 'master' of https://github.com/nikita-bykov/virtual-environments into rework-chrome-installation

This commit is contained in:
Nikita Bykov
2020-10-27 09:39:53 +03:00
62 changed files with 255 additions and 196 deletions

View File

@@ -52,7 +52,8 @@ jobs:
inputs: inputs:
targetType: 'filePath' targetType: 'filePath'
filePath: ./images.CI/macos/select-datastore.ps1 filePath: ./images.CI/macos/select-datastore.ps1
arguments: -VIServer "$(vcenter-server-v2)" ` arguments: -VMName "$(VirtualMachineName)" `
-VIServer "$(vcenter-server-v2)" `
-VIUserName "$(vcenter-username-v2)" ` -VIUserName "$(vcenter-username-v2)" `
-VIPassword "$(vcenter-password-v2)" -VIPassword "$(vcenter-password-v2)"
@@ -121,8 +122,8 @@ jobs:
condition: always() condition: always()
- task: PowerShell@2 - task: PowerShell@2
displayName: 'Move vm to cold storage' displayName: 'Move vm to cold storage and clear datastore tag'
condition: succeededOrFailed() condition: always()
inputs: inputs:
targetType: 'filePath' targetType: 'filePath'
filePath: ./images.CI/macos/move-vm.ps1 filePath: ./images.CI/macos/move-vm.ps1

View File

@@ -48,12 +48,30 @@ Import-Module $PSScriptRoot\helpers.psm1 -DisableNameChecking
# Connection to a vCenter Server system # Connection to a vCenter Server system
Connect-VCServer Connect-VCServer
try # Clear previously assigned tag with VM Name
{ try {
Get-VM $VMName | Move-VM -Datastore $TargetDataStore -ErrorAction Stop Remove-Tag $VMName -Confirm:$false
Write-Host "VM has been moved successfully to target datastore '$TargetDataStore'" } catch {
Write-Host "Tag with $VMName doesn't exist"
} }
catch
{ $vm = Get-VM $VMName
if ($env:AGENT_JOBSTATUS -eq 'Failed') {
try {
if($vm.PowerState -ne "PoweredOff") {
Stop-VM -VM $vm -Confirm:$false -ErrorAction Stop
}
Set-VM -VM $vm -Name "${VMName}_failed" -Confirm:$false -ErrorAction Stop
Write-Host "VM has been successfully powered off and renamed to [${VMName}_failed]"
} catch {
Write-Host "##vso[task.LogIssue type=error;]Failed to power off and rename VM '$VMName'"
}
}
try {
Move-VM -Vm $vm -Datastore $TargetDataStore -ErrorAction Stop
Write-Host "VM has been moved successfully to target datastore '$TargetDataStore'"
} catch {
Write-Host "##vso[task.LogIssue type=error;]Failed to move VM '$VMName' to target datastore '$TargetDataStore'" Write-Host "##vso[task.LogIssue type=error;]Failed to move VM '$VMName' to target datastore '$TargetDataStore'"
} }

View File

@@ -20,6 +20,10 @@ vCenter password (Example "12345678")
[CmdletBinding()] [CmdletBinding()]
param( param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$VMName,
[Parameter(Mandatory)] [Parameter(Mandatory)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$VIServer, [string]$VIServer,
@@ -30,35 +34,72 @@ param(
[Parameter(Mandatory)] [Parameter(Mandatory)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$VIPassword [string]$VIPassword,
[string]$TagCategory = "Busy"
) )
# Import helpers module # Import helpers module
Import-Module $PSScriptRoot\helpers.psm1 -DisableNameChecking Import-Module $PSScriptRoot\helpers.psm1 -DisableNameChecking
function Select-DataStore {
param (
[string]$VMName,
[string]$TagCategory,
[string]$TemplateDatastore = "ds-local-Datastore-*",
[int]$ThresholdInGb = 400,
[int]$VMCount = 2,
[int]$Retries = 5
)
# 1. Name starts with ds-local-Datastore
# 2. FreespaceGB > 400 Gb
# 3. VM count on a datastore < 2
Write-Host "Start Datastore selection process..."
$allDatastores = Get-Datastore -Name $templateDatastore | Where-Object { $_.State -eq "Available" }
$buildDatastore = $allDatastores | Where-Object { $_.FreeSpaceGB -ge $thresholdInGb } | Where-Object {
$vmOnDatastore = @((Get-ChildItem -Path $_.DatastoreBrowserPath).Name -notmatch "^\.").Count
$vmOnDatastore -lt $vmCount
} | Select-Object -ExpandProperty Name -First 1
$tag = Get-Tag -Category $TagCategory -Name $VMName -ErrorAction Ignore
if (-not $tag)
{
$tag = New-Tag -Name $VMName -Category $TagCategory
}
New-TagAssignment -Tag $tag -Entity $buildDatastore | Out-Null
# Wait for 60 seconds to check if any other tags are assigned to the same datastore
Start-Sleep -Seconds 60
# Take only first 2 tags, all the others will go to the next round
$tagAssignments = (Get-TagAssignment -Entity $buildDatastore).Tag.Name | Select-Object -First 2
$isAllow = $tagAssignments -contains $VMName
if ($isAllow)
{
Write-Host "Datastore selected successfully"
Write-Host "##vso[task.setvariable variable=buildDatastore;issecret=true]$buildDatastore"
return
}
# Remove the tag if datastore wasn't selected
Remove-Tag $tag -Confirm:$false
$retries--
if ($retries -le 0)
{
Write-Host "##vso[task.LogIssue type=error;]No datastores found for the condition"
exit 1
}
Write-Host "Datastore select failed, $retries left"
Select-DataStore -VMName $VMName -TagCategory $TagCategory -Retries $retries
}
# Connection to a vCenter Server system # Connection to a vCenter Server system
Connect-VCServer Connect-VCServer
# Get a target datastore for current deployment # Get a target datastore for current deployment
# 1. Name starts with ds-local-Datastore Select-DataStore -VMName $VMName -TagCategory $TagCategory
# 2. FreespaceGB > 400 Gb
# 3. VM count on a datastore < 2
$templateDatastore = "ds-local-Datastore-*"
$thresholdInGb = 400
$vmCount = 2
$allDatastores = Get-Datastore -Name $templateDatastore | Where-Object { $_.State -eq "Available" }
$buildDatastore = $allDatastores | Where-Object { $_.FreeSpaceGB -ge $thresholdInGb } | Where-Object {
$vmOnDatastore = @((Get-ChildItem -Path $_.DatastoreBrowserPath).Name -notmatch "^\.").Count
$vmOnDatastore -lt $vmCount
} | Select-Object -ExpandProperty Name -First 1
if ($buildDatastore)
{
Write-Host "Datastore selected successfully"
Write-Host "##vso[task.setvariable variable=buildDatastore;issecret=true]$buildDatastore"
}
else
{
Write-Host "##vso[task.LogIssue type=error;]No datastores found for the condition"
exit 1
}

View File

@@ -12,9 +12,6 @@ source $HELPER_SCRIPTS/etc-environment.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
# Make brew files and directories writable by any user
sudo chmod -R o+w $HOMEBREW_PREFIX
# Update /etc/environemnt # Update /etc/environemnt
## Put HOMEBREW_* variables ## Put HOMEBREW_* variables
brew shellenv|grep 'export HOMEBREW'|sed -E 's/^export (.*);$/\1/' | sudo tee -a /etc/environment brew shellenv|grep 'export HOMEBREW'|sed -E 's/^export (.*);$/\1/' | sudo tee -a /etc/environment

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/add-network-interface-detection.sh # This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/add-network-interface-detection.sh
# Distributed by MIT license, license can be found at the bottom of this script # Distributed by MIT license, license can be found at the bottom of this script

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/autologin.sh # This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/autologin.sh
# Distributed by MIT license, license can be found at the bottom of this script # Distributed by MIT license, license can be found at the bottom of this script

View File

@@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash -e -o pipefail
# Add script for changing hostname to run on startup to prevent duplicate hostnames across the environment. Hostname and Computername should contain .local in name to avoid name resolution issues # Add script for changing hostname to run on startup to prevent duplicate hostnames across the environment. Hostname and Computername should contain .local in name to avoid name resolution issues
tee -a /usr/local/bin/change_hostname.sh > /dev/null <<\EOF tee -a /usr/local/bin/change_hostname.sh > /dev/null <<\EOF
#!/bin/bash #!/bin/bash -e -o pipefail
name="Mac-$(python -c 'from time import time; print int(round(time() * 1000))')" name="Mac-$(python -c 'from time import time; print int(round(time() * 1000))')"
scutil --set HostName "${name}.local" scutil --set HostName "${name}.local"

View File

@@ -1,12 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
# Enable firewall. SSH and VNC opened. Can't did it at bootstrap step, so placed it here
defaults write /Library/Preferences/com.apple.alf globalstate -int 1
# Setting correct time zone
echo "Configuring system time to GMT..."
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari # https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari
# Safaris executable is located at /usr/bin/safaridriver # Safaris executable is located at /usr/bin/safaridriver

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
[[ ! -d ~/.ssh ]] && mkdir ~/.ssh 2>/dev/null [[ ! -d ~/.ssh ]] && mkdir ~/.ssh 2>/dev/null
chmod 777 ~/.ssh chmod 777 ~/.ssh

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
# Disabling automatic updates # Disabling automatic updates
sudo softwareupdate --schedule off sudo softwareupdate --schedule off

View File

@@ -1,12 +1,16 @@
#!/bin/bash #!/bin/bash -e -o pipefail
source ~/utils/utils.sh
# Close all finder windows because they can interfere with UI tests # Close all finder windows because they can interfere with UI tests
osascript -e 'tell application "Finder" to close windows' osascript -e 'tell application "Finder" to close windows'
# Ignore available updates to prevent system pop-ups if is_Less_BigSur; then
updateName=$(softwareupdate -l | grep "Title: " | awk -F[:,] '{print $2}' | awk '{$1=$1};1') # Ignore available updates to prevent system pop-ups
if [ ! -z "$updateName" ]; then updateName=$(softwareupdate -l | grep "Title: " | awk -F[:,] '{print $2}' | awk '{$1=$1};1') || true
sudo softwareupdate --ignore "$updateName" if [ ! -z "$updateName" ]; then
sudo softwareupdate --ignore "$updateName"
fi
fi fi
# Put documentation to $HOME root # Put documentation to $HOME root

View File

@@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
set -e
Launch_Daemons="/Library/LaunchDaemons" Launch_Daemons="/Library/LaunchDaemons"

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
echo Additional NTP servers adding into /etc/ntp.conf file... echo Additional NTP servers adding into /etc/ntp.conf file...
cat > /etc/ntp.conf << EOF cat > /etc/ntp.conf << EOF

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
imagedata_file="$HOME/imagedata.json" imagedata_file="$HOME/imagedata.json"

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash -e -o pipefail
# set screensaver idleTime to 0, to prevent turning screensaver on # set screensaver idleTime to 0, to prevent turning screensaver on
macUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62` macUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62`

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
echo "Changing shell to bash" echo "Changing shell to bash"
sudo chsh -s /bin/bash $USERNAME sudo chsh -s /bin/bash $USERNAME
sudo chsh -s /bin/bash root sudo chsh -s /bin/bash root

View File

@@ -1,4 +1,4 @@
#!/bin/bash -e #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
function filter_components_by_version { function filter_components_by_version {

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
echo "install soundflower" echo "install soundflower"
brew cask install soundflower brew cask install soundflower

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
echo Installing aws... echo Installing aws...
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

View File

@@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
set -e
AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac" AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac"

View File

@@ -1,4 +1,4 @@
set -e #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh

View File

@@ -1,3 +1,4 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
echo "Installing Chrome..." echo "Installing Chrome..."

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/bash -e -o pipefail
echo "Installing Cocoapods..." echo "Installing Cocoapods..."
# Setup the Cocoapods master repo # Setup the Cocoapods master repo

View File

@@ -1,5 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
set -e
source ~/utils/utils.sh source ~/utils/utils.sh

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
########################################################################### ###########################################################################
# The main idea of this script is to automate dotnet installs # The main idea of this script is to automate dotnet installs
@@ -23,7 +23,7 @@ echo "Parsing dotnet SDK (except rc and preview versions) from .json..."
if is_BigSur; then if is_BigSur; then
DOTNET_CHANNELS=( DOTNET_CHANNELS=(
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json'
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json'
) )
elif is_Less_Catalina; then elif is_Less_Catalina; then
DOTNET_CHANNELS=( DOTNET_CHANNELS=(
@@ -33,7 +33,7 @@ else
DOTNET_CHANNELS=( DOTNET_CHANNELS=(
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json'
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.0/releases.json' 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.0/releases.json'
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json'
) )
fi fi

View File

@@ -1,11 +1,9 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
echo "Installing Microsoft Edge..." echo "Installing Microsoft Edge..."
# Workaround to install version 85 since webdriver is broken for 86
cd "$(brew --repo homebrew/homebrew-cask)"
git checkout 81f9d08d2b9b7557c0178621078cf59d2c5db2bc
brew cask install microsoft-edge brew cask install microsoft-edge
git checkout master
EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
EDGE_VERSION=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3) EDGE_VERSION=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3)

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
echo "Installing Firefox..." echo "Installing Firefox..."
brew cask install firefox brew cask install firefox

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
echo "Installing GCC@8 using homebrew..." echo "Installing GCC@8 using homebrew..."
brew install gcc@8 brew install gcc@8

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
echo Installing Git... echo Installing Git...
brew install git brew install git

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
export PATH="$HOME/.ghcup/bin:$PATH" export PATH="$HOME/.ghcup/bin:$PATH"

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
MINICONDA_INSTALLER="/tmp/miniconda.sh" MINICONDA_INSTALLER="/tmp/miniconda.sh"
curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
# MongoDB object-value database # MongoDB object-value database
# installs last version of MongoDB Community Edition # installs last version of MongoDB Community Edition

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
node_modules=( node_modules=(
@@ -16,7 +18,6 @@ if is_Less_Catalina; then
echo Installing NPM 3.x.x... echo Installing NPM 3.x.x...
npm install -g npm@3 npm install -g npm@3
npm config set prefix /usr/local
# This step is required to install App Center CLI # This step is required to install App Center CLI
echo Installing Omelette... echo Installing Omelette...

View File

@@ -1,5 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
########################################################################### ###########################################################################
# The script installs node version manager with node versions 6,8,10 and 12 # The script installs node version manager with node versions 6,8,10 and 12
# #
@@ -24,11 +23,8 @@ if [ $? -eq 0 ]; then
nvm alias node12 lts/erbium nvm alias node12 lts/erbium
nvm alias node13 v13 nvm alias node13 v13
nvm alias node14 v14 nvm alias node14 v14
# set system node as default
if is_Catalina || is_BigSur; then nvm alias default system
# set system node as default
nvm alias default system
fi
else else
echo error echo error
fi fi

View File

@@ -1,6 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
set -e
source ~/utils/utils.sh source ~/utils/utils.sh

View File

@@ -1,19 +1,16 @@
#!/bin/sh #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
echo "Installing OpenSSL..."
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
echo Installing OpenSSL... echo Installing OpenSSL...
/usr/local/bin/brew install openssl brew install openssl
# Install OpenSSL 1.0.2t # Install OpenSSL 1.0.2t
# https://www.openssl.org/policies/releasestrat.html - Version 1.0.2 will be supported until 2019-12-31 (LTS) # https://www.openssl.org/policies/releasestrat.html - Version 1.0.2 will be supported until 2019-12-31 (LTS)
# To preserve backward compatibility with ruby-toolcache # To preserve backward compatibility with ruby-toolcache
/usr/local/bin/brew tap-new local/openssl brew tap-new --no-git local/openssl
FORMULA_PATH=$(/usr/local/bin/brew extract openssl local/openssl | grep "Homebrew/Library/Taps") FORMULA_PATH=$(brew extract openssl local/openssl | grep "Homebrew/Library/Taps")
/usr/local/bin/brew install $FORMULA_PATH brew install $FORMULA_PATH
# Set OpenSSL 1.0.2t as default # Set OpenSSL 1.0.2t as default
ln -sf /usr/local/Cellar/openssl@1.0.2t /usr/local/Cellar/openssl ln -sf /usr/local/Cellar/openssl@1.0.2t /usr/local/Cellar/openssl
@@ -25,4 +22,4 @@ ln -sf ../Cellar/openssl/1.0.2t /usr/local/opt/openssl
# https://github.com/microsoft/azure-pipelines-agent/blob/master/docs/start/envosx.md # https://github.com/microsoft/azure-pipelines-agent/blob/master/docs/start/envosx.md
mkdir -p /usr/local/lib/ mkdir -p /usr/local/lib/
ln -s /usr/local/opt/openssl@1.0.2t/lib/libcrypto.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl@1.0.2t/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl@1.0.2t/lib/libssl.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl@1.0.2t/lib/libssl.1.0.0.dylib /usr/local/lib/

View File

@@ -1,5 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
set -e
echo Installing PHP echo Installing PHP
brew install php brew install php

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
#Install latest version of postgresql #Install latest version of postgresql
brew install postgres brew install postgres
@@ -6,13 +6,21 @@ brew install postgres
#Service postgresql should be started before use. #Service postgresql should be started before use.
brew services start postgresql brew services start postgresql
#Verify that PostgreSQL is ready for accept incoming connections. #Verify PostgreSQL is ready for accept incoming connections
# exit codes: echo "Check PostgreSQL service is running"
# ready - 0 i=10
# reject - 1 COMMAND='pg_isready'
# connection timeout - 2 while [ $i -gt 0 ]; do
# incorrect credentials or parameters - 3 echo "Check PostgreSQL service status"
pg_isready eval $COMMAND && break
((i--))
if [ $i == 0 ]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
sleep 10
done
#Stop postgresql #Stop postgresql
brew services stop postgresql brew services stop postgresql

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
echo Installing Azure CLI... echo Installing Azure CLI...

View File

@@ -1,10 +1,9 @@
#!/bin/bash #!/bin/bash -e -o pipefail
################################################################################ ################################################################################
## File: pypy.sh ## File: pypy.sh
## Desc: Installs PyPy ## Desc: Installs PyPy
################################################################################ ################################################################################
source ~/utils/utils.sh source ~/utils/utils.sh
set -e
function InstallPyPy function InstallPyPy
{ {

View File

@@ -1,18 +1,19 @@
#!/bin/sh #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
echo "Installing Python Tooling" echo "Installing Python Tooling"
echo "Brew Installing Python 3" echo "Brew Installing Python 3"
# Workaround to have both 3.8 & 3.9(which required by some brew formulas) in the system, but only 3.8 is linked # Workaround to have both 3.8 & 3.9(which required by some brew formulas) in the system, but only 3.8 is linked
/usr/local/bin/brew install python@3.8 brew install python@3.8
/usr/local/bin/brew install python@3.9 brew install python@3.9
/usr/local/bin/brew unlink python@3.9 brew unlink python@3.9
/usr/local/bin/brew unlink python@3.8 brew unlink python@3.8
/usr/local/bin/brew link python@3.8 brew link python@3.8
echo "Brew Installing Python 2" echo "Brew Installing Python 2"
# Create local tap with formula due to python2 formula depreciation # Create local tap with formula due to python2 formula depreciation
/usr/local/bin/brew tap-new local/python2 brew tap-new --no-git local/python2
FORMULA_PATH=$(/usr/local/bin/brew extract python@2 local/python2 | grep "Homebrew/Library/Taps") FORMULA_PATH=$(brew extract python@2 local/python2 | grep "Homebrew/Library/Taps")
/usr/local/bin/brew install $FORMULA_PATH brew install $FORMULA_PATH

View File

@@ -1,2 +1,3 @@
#!/bin/bash #!/bin/bash -e -o pipefail
shutdown -r now shutdown -r now

View File

@@ -1,17 +1,6 @@
#!/bin/sh #!/bin/bash -e -o pipefail
set -e
source ~/utils/utils.sh source ~/utils/utils.sh
echo Installing Ruby... echo Installing Ruby...
if is_Less_BigSur; then brew install ruby
# We can't install latest ruby 2.7 as a default version related with bug
# https://github.com/fastlane/fastlane/issues/15397
/usr/local/bin/brew install ruby@2.6
ln -sf /usr/local/opt/ruby\@2.6 /usr/local/opt/ruby
else
brew install ruby
fi

View File

@@ -1,17 +1,10 @@
#!/bin/sh #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
echo Updating RubyGems... echo Updating RubyGems...
gem update --system gem update --system
# Freeze xcodeproj 1.18.0 because version 1.19.0 contains breaking changes related to CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER flag
# Related issues:
# - https://github.com/CocoaPods/CocoaPods/issues/10153
# - https://github.com/actions/virtual-environments/issues/1804
# Need to revisit when Cocoapods 1.10.0 is released and added to VM
gem install xcodeproj -v 1.18.0
echo Installing xcode-install utility... echo Installing xcode-install utility...
gem install xcode-install --force gem install xcode-install --force

View File

@@ -1,6 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
set -e
echo Installing Rustup... echo Installing Rustup...
brew install rustup-init brew install rustup-init

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e -o pipefail
echo "Get the latest Stack version..." echo "Get the latest Stack version..."
StackRelease=$(curl -s "https://api.github.com/repos/commercialhaskell/stack/releases/latest") StackRelease=$(curl -s "https://api.github.com/repos/commercialhaskell/stack/releases/latest")

View File

@@ -1,7 +1,6 @@
#!/bin/sh #!/bin/bash -e -o pipefail
########################################################################### ###########################################################################
# The script downloads macos hosted tool cache for several Python versions # The script downloads macos hosted tool cache for several Python versions
# and installs them onto the system # and installs them onto the system
# #
########################################################################### ###########################################################################

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
# Download hosted tool cache with npm # Download hosted tool cache with npm
NPM_FEED="npm.pkg.github.com" NPM_FEED="npm.pkg.github.com"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash -e -o pipefail
set -e
source ~/utils/utils.sh source ~/utils/utils.sh
# Set env variable for vcpkg # Set env variable for vcpkg

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
source ~/utils/xamarin-utils.sh source ~/utils/xamarin-utils.sh
@@ -22,9 +23,6 @@ echo "Moving Visual Studio to /Applications/..."
pushd $TMPMOUNT pushd $TMPMOUNT
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/ tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
echo "Launching vstools..."
/Applications/Visual\ Studio.app/Contents/MacOS/vstool
popd popd
sudo hdiutil detach "$TMPMOUNT" sudo hdiutil detach "$TMPMOUNT"
sudo rm -rf "$TMPMOUNT" sudo rm -rf "$TMPMOUNT"

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
ANDROID_HOME=$HOME/Library/Android/sdk ANDROID_HOME=$HOME/Library/Android/sdk

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
source ~/utils/xamarin-utils.sh source ~/utils/xamarin-utils.sh
@@ -8,6 +9,7 @@ XAMARIN_MAC_VERSIONS=($(get_toolset_value '.xamarin."mac-versions" | reverse | .
XAMARIN_ANDROID_VERSIONS=($(get_toolset_value '.xamarin."android-versions" | reverse | .[]')) XAMARIN_ANDROID_VERSIONS=($(get_toolset_value '.xamarin."android-versions" | reverse | .[]'))
LATEST_SDK_SYMLINK=$(get_toolset_value '.xamarin.bundles[0].symlink') LATEST_SDK_SYMLINK=$(get_toolset_value '.xamarin.bundles[0].symlink')
CURRENT_SDK_SYMLINK=$(get_toolset_value '.xamarin."bundle-default"') CURRENT_SDK_SYMLINK=$(get_toolset_value '.xamarin."bundle-default"')
DEFAULT_XCODE_VERSION=$(get_default_xcode_from_toolset)
if [ "$CURRENT_SDK_SYMLINK" == "latest" ]; then if [ "$CURRENT_SDK_SYMLINK" == "latest" ]; then
CURRENT_SDK_SYMLINK=$LATEST_SDK_SYMLINK CURRENT_SDK_SYMLINK=$LATEST_SDK_SYMLINK
@@ -63,8 +65,10 @@ createBundleLink $CURRENT_SDK_SYMLINK "Current"
# Fix nuget in some mono versions because of known bugs # Fix nuget in some mono versions because of known bugs
# #
# Fix Mono issue with default nuget: https://github.com/mono/mono/issues/17637 if is_Less_BigSur; then
installNuget "6.4.0" "5.3.1" # Fix Mono issue with default nuget: https://github.com/mono/mono/issues/17637
installNuget "6.4.0" "5.3.1"
fi
if is_Less_Catalina; then if is_Less_Catalina; then
installNuget "4.8.1" "4.3.0" installNuget "4.8.1" "4.3.0"
@@ -79,3 +83,8 @@ popd
echo "Clean up packages..." echo "Clean up packages..."
sudo rm -rf "$TMPMOUNT" sudo rm -rf "$TMPMOUNT"
# Fix Xamarin issue with Xcode symlink: https://github.com/xamarin/xamarin-macios/issues/9960
PREFERENCES_XAMARIN_DIR="${HOME}/Library/Preferences/Xamarin"
mkdir -p $PREFERENCES_XAMARIN_DIR
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string /Applications/Xcode_${DEFAULT_XCODE_VERSION}.app" $PREFERENCES_XAMARIN_DIR/Settings.plist

View File

@@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
XCODE_LIST=($(get_xcode_list_from_toolset)) XCODE_LIST=($(get_xcode_list_from_toolset))
DEFAULT_XCODE_VERSION=$(get_default_xcode_from_toolset) DEFAULT_XCODE_VERSION=$(get_default_xcode_from_toolset)
# https://github.com/microsoft/appcenter/issues/847 # https://github.com/microsoft/appcenter/issues/847
# Assets.xcassets : error : CoreData: error: (6922) I/O error for database # Assets.xcassets : error : CoreData: error: (6922) I/O error for database
# at $HOME/Library/Developer/Xcode/UserData/IB Support/Simulator Devices/{GUID} # at $HOME/Library/Developer/Xcode/UserData/IB Support/Simulator Devices/{GUID}
echo "Erase a device's contents and settings:" echo "Erase a device's contents and settings:"
for XCODE_VERSION in "${XCODE_LIST[@]}" for XCODE_VERSION in "${XCODE_LIST[@]}"
@@ -15,6 +15,11 @@ do
#add sleep to let CoreSimulatorService to exit #add sleep to let CoreSimulatorService to exit
sleep 3 sleep 3
# Version 12.2_beta installed into 12.2 directory and 12.1_GM_seed in 12.1
pattern="[0-9]{1,2}.*_"
if [[ $XCODE_VERSION =~ $pattern ]] ; then
XCODE_VERSION=$(echo $XCODE_VERSION | cut -d"_" -f 1)
fi
# Select xcode version by default # Select xcode version by default
sudo xcode-select -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer" sudo xcode-select -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer"

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh

View File

@@ -1,10 +1,8 @@
#!/bin/sh #!/bin/bash -e -o pipefail
# The script currently requires 2 external variables to be set: XCODE_INSTALL_USER # The script currently requires 2 external variables to be set: XCODE_INSTALL_USER
# and XCODE_INSTALL_PASSWORD, in order to access the Apple Developer Center # and XCODE_INSTALL_PASSWORD, in order to access the Apple Developer Center
set -e
source ~/utils/utils.sh source ~/utils/utils.sh
source ~/utils/xcode-utils.sh source ~/utils/xcode-utils.sh

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
download_with_retries() { download_with_retries() {
# Due to restrictions of bash functions, positional arguments are used here. # Due to restrictions of bash functions, positional arguments are used here.
# In case if you using latest argument NAME, you should also set value to all previous parameters. # In case if you using latest argument NAME, you should also set value to all previous parameters.
@@ -5,22 +7,31 @@ download_with_retries() {
local URL="$1" local URL="$1"
local DEST="${2:-.}" local DEST="${2:-.}"
local NAME="${3:-${URL##*/}}" local NAME="${3:-${URL##*/}}"
local COMPRESSED="$4"
echo "Downloading $URL..." if [[ $COMPRESSED == "compressed" ]]; then
wget $URL --output-document="$DEST/$NAME" \ COMMAND="curl $URL -4 -sL --compressed -o '$DEST/$NAME'"
--tries=30 \ else
--wait 30 \ COMMAND="curl $URL -4 -sL -o '$DEST/$NAME'"
--retry-connrefused \
--retry-on-host-error \
--retry-on-http-error=404,429,500,502,503 \
--no-verbose
if [ $? != 0 ]; then
echo "Could not download $URL; Exiting build!"
exit 1
fi fi
return 0 echo "Downloading $URL..."
retries=20
interval=30
while [ $retries -gt 0 ]; do
((retries--))
eval $COMMAND
if [ $? != 0 ]; then
echo "Unable to download $URL, next attempt in $interval sec, $retries attempts left"
sleep $interval
else
echo "$URL was downloaded successfully to $DEST/$NAME"
return 0
fi
done
echo "Could not download $URL"
return 1
} }
is_BigSur() { is_BigSur() {

View File

@@ -1,11 +1,11 @@
#!/bin/sh #!/bin/bash -e -o pipefail
# Xamarin can clean their SDKs while updating to newer versions, # Xamarin can clean their SDKs while updating to newer versions,
# so we should be able to detect it during image generation # so we should be able to detect it during image generation
downloadAndInstallPKG() { downloadAndInstallPKG() {
local PKG_URL=$1 local PKG_URL=$1
local PKG_NAME=${PKG_URL##*/} local PKG_NAME=${PKG_URL##*/}
download_with_retries $PKG_URL download_with_retries $PKG_URL
echo "Installing $PKG_NAME..." echo "Installing $PKG_NAME..."
@@ -159,7 +159,7 @@ installNunitConsole() {
local MONO_VERSION=$1 local MONO_VERSION=$1
cat <<EOF > ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} cat <<EOF > ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN}
#!/bin/sh #!/bin/bash -e -o pipefail
exec /Library/Frameworks/Mono.framework/Versions/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT3_PATH/nunit3-console.exe "\$@" exec /Library/Frameworks/Mono.framework/Versions/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT3_PATH/nunit3-console.exe "\$@"
EOF EOF
sudo chmod +x ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} sudo chmod +x ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN}
@@ -180,7 +180,7 @@ downloadNUnitConsole() {
echo "Installing NUnit 3..." echo "Installing NUnit 3..."
sudo unzip nunit3.zip -d $NUNIT3_PATH sudo unzip nunit3.zip -d $NUNIT3_PATH
NUNIT3_CONSOLE_BIN=nunit3-console NUNIT3_CONSOLE_BIN=nunit3-console
popd popd
} }

View File

@@ -1,3 +1,5 @@
#!/bin/bash -e -o pipefail
createXamarinProvisionatorSymlink() { createXamarinProvisionatorSymlink() {
local XCODE_VERSION="$1" local XCODE_VERSION="$1"
local FULL_VERSION=$(echo "${XCODE_VERSION}.0.0" | cut -d'.' -f 1,2,3) local FULL_VERSION=$(echo "${XCODE_VERSION}.0.0" | cut -d'.' -f 1,2,3)

View File

@@ -19,7 +19,7 @@
"android-versions": [ "android-versions": [
"11.0.2.0", "10.3.1.4", "10.2.0.100", "10.1.3.7", "10.0.6.2" "11.0.2.0", "10.3.1.4", "10.2.0.100", "10.1.3.7", "10.0.6.2"
], ],
"bundle-default": "6_12_0", "bundle-default": "latest",
"bundles": [ "bundles": [
{ {
"symlink": "6_12_1", "symlink": "6_12_1",

View File

@@ -2,7 +2,7 @@
"xcode": { "xcode": {
"default": "11.7", "default": "11.7",
"versions": [ "versions": [
"12.2_beta", "12.1_GM_seed", "11.7" "12.2_beta", "11.7"
] ]
}, },
"xamarin": { "xamarin": {

View File

@@ -128,11 +128,7 @@ if (Test-IsWin19) {
} }
# Expand disk size of OS drive # Expand disk size of OS drive
New-Item -Path d:\ -Name cmds.txt -ItemType File -Force $driveLetter = "C"
Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" $size = Get-PartitionSupportedSize -DriveLetter $driveLetter
Resize-Partition -DriveLetter $driveLetter -Size $size.SizeMax
$expandResult = (diskpart /s 'd:\cmds.txt') Get-Volume | Select-Object DriveLetter, SizeRemaining, Size | Sort-Object DriveLetter
Write-Host $expandResult
Write-Host "Disk sizes after expansion"
wmic logicaldisk get size,freespace,caption

View File

@@ -13,7 +13,7 @@
"virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}", "virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}",
"virtual_network_subnet_name": "{{env `VNET_SUBNET`}}", "virtual_network_subnet_name": "{{env `VNET_SUBNET`}}",
"private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}",
"vm_size": "Standard_D4_v2", "vm_size": "Standard_DS4_v2",
"run_scan_antivirus": "false", "run_scan_antivirus": "false",
"root_folder": "C:", "root_folder": "C:",
"toolset_json_path": "{{env `TEMP`}}\\toolset.json", "toolset_json_path": "{{env `TEMP`}}\\toolset.json",