From d0ba2cd2a425c177d9d3d360aade483139463fe4 Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Thu, 21 May 2020 19:49:51 +0100 Subject: [PATCH 01/13] Replace `Get-WmiObject` with `Get-CimInstance` --- images/win/scripts/ImageHelpers/InstallHelpers.ps1 | 2 +- images/win/scripts/Installers/Install-ContainersFeature.ps1 | 3 ++- images/win/scripts/Installers/Validate-WDK.ps1 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 827485a33..b4e287052 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -377,7 +377,7 @@ function Get-ToolsByName { function Get-WinVersion { - (Get-WmiObject -class Win32_OperatingSystem).Caption + (Get-CimInstance -ClassName Win32_OperatingSystem).Caption } function Test-IsWin19 diff --git a/images/win/scripts/Installers/Install-ContainersFeature.ps1 b/images/win/scripts/Installers/Install-ContainersFeature.ps1 index f7a2e92e6..a0513f5e2 100644 --- a/images/win/scripts/Installers/Install-ContainersFeature.ps1 +++ b/images/win/scripts/Installers/Install-ContainersFeature.ps1 @@ -8,7 +8,8 @@ Write-Host "Install Containers feature" Install-WindowsFeature -Name Containers -if ((GWMI Win32_Processor).VirtualizationFirmwareEnabled[0] -and (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions[0]) { +$cpu = (Get-CimInstance -ClassName Win32_Processor)[0] +if ($cpu.VirtualizationFirmwareEnabled -and $cpu.SecondLevelAddressTranslationExtensions) { Write-Host "Install Hyper-V feature" Install-WindowsFeature -Name Hyper-V -IncludeManagementTools } else { diff --git a/images/win/scripts/Installers/Validate-WDK.ps1 b/images/win/scripts/Installers/Validate-WDK.ps1 index ee64f20b5..564a0ab2a 100644 --- a/images/win/scripts/Installers/Validate-WDK.ps1 +++ b/images/win/scripts/Installers/Validate-WDK.ps1 @@ -7,7 +7,7 @@ Import-Module -Name ImageHelpers -Force function Get-WDKVersion { - $WDKVersion = (Get-WmiObject Win32_Product -Filter "Name = 'Windows Driver Kit'").version + $WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version if (!$WDKVersion) { From e8d2146082e0aa0ddb5427942a315a69bf64bce6 Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Thu, 28 May 2020 03:30:22 +0000 Subject: [PATCH 02/13] add minikube to ubuntu and windows images (#830) * add minikube to ubuntu and windows images * address review comments * remove extra lines * remove extra json added * remove 1604 * merge upstream * add comment * remove caching --- .../scripts/installers/kubernetes-tools.sh | 14 +++++++++++ .../Installers/Install-KubernetesCli.ps1 | 1 + .../Installers/Validate-KubernetesCli.ps1 | 23 +++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/images/linux/scripts/installers/kubernetes-tools.sh b/images/linux/scripts/installers/kubernetes-tools.sh index 6fcdb4c02..0503b8503 100644 --- a/images/linux/scripts/installers/kubernetes-tools.sh +++ b/images/linux/scripts/installers/kubernetes-tools.sh @@ -20,6 +20,11 @@ apt-get install -y kubectl # Install Helm curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash +# Install minikube +curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 +sudo install minikube-linux-amd64 /usr/local/bin/minikube + + # 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 kubectl; then @@ -32,7 +37,16 @@ if ! command -v helm; then exit 1 fi +# Run tests to determine that the software installed as expected +echo "Testing to make sure that minikube was installed" +if ! command -v minikube; then + echo "minikube was not installed" + exit 1 +fi + # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "kubectl ($(kubectl version --client --short |& head -n 1))" DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" +# minikube version output already has word minikube in it. example minikube version: v1.9.2 +DocumentInstalledItem "$(minikube version --short)" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-KubernetesCli.ps1 b/images/win/scripts/Installers/Install-KubernetesCli.ps1 index c6ad04bc7..e006f7793 100644 --- a/images/win/scripts/Installers/Install-KubernetesCli.ps1 +++ b/images/win/scripts/Installers/Install-KubernetesCli.ps1 @@ -4,3 +4,4 @@ ################################################################################ Choco-Install -PackageName kubernetes-cli +Choco-Install -PackageName minikube diff --git a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 index da83f2fbe..5b3d768b6 100644 --- a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 +++ b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 @@ -26,3 +26,26 @@ _Environment:_ "@ Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +if((Get-Command -Name 'minikube')) +{ + Write-Host "minikube $(minikube version --short) in path" +} +else +{ + Write-Host "minikube is not in path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "minikube" + +$version = $(minikube version --short=true) + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of minikube.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description From a29d0c400adae9aa13c6bbbf2898e868a680b7b6 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Thu, 28 May 2020 09:00:23 +0300 Subject: [PATCH 03/13] Update IEDriverServer url (#944) * update IEDriverServer url * update path * add versioninfo.txt --- .../Installers/Install-IEWebDriver.ps1 | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/images/win/scripts/Installers/Install-IEWebDriver.ps1 b/images/win/scripts/Installers/Install-IEWebDriver.ps1 index 87104c1aa..e62b8ab62 100644 --- a/images/win/scripts/Installers/Install-IEWebDriver.ps1 +++ b/images/win/scripts/Installers/Install-IEWebDriver.ps1 @@ -2,31 +2,37 @@ ## File: Install-SeleniumWebDrivers.ps1 ## Desc: Install Selenium Web Drivers ################################################################################ -$DestinationPath = "$($env:SystemDrive)\" -$DriversZipFile = "SeleniumWebDrivers.zip" -Write-Host "Destination path: [$DestinationPath]" -Write-Host "Selenium drivers download and install..." + try { - Invoke-WebRequest -UseBasicParsing -Uri "https://seleniumwebdrivers.blob.core.windows.net/seleniumwebdrivers/${DriversZipFile}" -OutFile $DriversZipFile -} -catch { - Write-Error "[!] Failed to download $DriversZipFile" + $latestReleaseUrl = "https://selenium-release.storage.googleapis.com/" + $latestReleaseInfo = Invoke-RestMethod -Uri $latestReleaseUrl + $latestIEVersion = $latestReleaseInfo.ListBucketResult.Contents | Where-Object Key -match "IEDriverServer_x64" | Sort-Object LastModified | Select-Object -ExpandProperty Key -Last 1 + $ieDriverUrl = -join ($latestReleaseUrl, $latestIEVersion) +} catch { + Write-Error "[!] Failed to get IEDriver version [$latestReleaseUrl]: $_" exit 1 } -$TempSeleniumDir = Join-Path $Env:TEMP "SeleniumWebDrivers" -Extract-7Zip -Path $DriversZipFile -DestinationPath $Env:TEMP -Remove-Item $DriversZipFile - -$SeleniumWebDriverPath = Join-Path $DestinationPath "SeleniumWebDrivers" -$IEDriverPathTemp = Join-Path $TempSeleniumDir 'IEDriver' - -if (-not (Test-Path -Path $SeleniumWebDriverPath)) { - New-Item -Path $SeleniumWebDriverPath -ItemType "directory" +# Download IE selenium driver +try { + Write-Host "Selenium IEDriverServer download and install..." + $driverZipFile = Start-DownloadWithRetry -Url $ieDriverUrl -Name "SeleniumWebDrivers.zip" +} +catch { + Write-Error "[!] Failed to download $ieDriverUrl" + exit 1 } -Move-Item -Path "$IEDriverPathTemp" -Destination $SeleniumWebDriverPath +$ieDriverPath = "C:\SeleniumWebDrivers\IEDriver" +if (-not (Test-Path -Path $ieDriverPath)) { + $null = New-Item -Path $ieDriverPath -ItemType Directory -Force +} -Write-Host "Setting the environment variables" +Extract-7Zip -Path $driverZipFile -DestinationPath $ieDriverPath +Remove-Item $driverZipFile -setx IEWebDriver "C:\SeleniumWebDrivers\IEDriver" /M +Write-Host "Get the IEDriver version..." +(Get-Item "$ieDriverPath\IEDriverServer.exe").VersionInfo.FileVersion | Out-File -FilePath "$ieDriverPath\versioninfo.txt" + +Write-Host "Setting the IEWebDriver environment variables" +setx IEWebDriver $ieDriverPath /M From 728883de5d1e958aa26c2e06d4f01c1666f6e451 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Thu, 28 May 2020 10:36:52 +0300 Subject: [PATCH 04/13] [Ubuntu] Install 3 latest Haskell version and latest Cabal version (#939) * Remove deprecated versions * add regexp for the latest versions * refactor some checks * change cabal version * change version retrieval to awk * minor comments improvment --- images/linux/scripts/installers/haskell.sh | 37 +++++++--------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index af9facd1b..1d4dd02da 100644 --- a/images/linux/scripts/installers/haskell.sh +++ b/images/linux/scripts/installers/haskell.sh @@ -6,7 +6,6 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/os.sh # Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. # https://launchpad.net/~hvr/+archive/ubuntu/ghc @@ -14,25 +13,15 @@ apt-get install -y software-properties-common add-apt-repository -y ppa:hvr/ghc apt-get update -# Install various versions of ghc and cabal -if isUbuntu20 ; then - ghcVersions="8.6.5 8.8.3 8.10.1" - cabalVersions="3.2" -fi - -if isUbuntu16 || isUbuntu18 ; then - # Install various versions of ghc and cabal - ghcVersions="8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1 8.8.2 8.8.3 8.10.1" - cabalVersions="2.0 2.2 2.4 3.0 3.2" -fi +# Get 3 latest Haskell versions and latest Cabal version +ghcVersions=$(apt-cache search "^ghc-" | grep -Po '(\d*\.){2}\d*' | awk 'BEGIN {FS=OFS=SUBSEP="."}{if (arr[$1,$2] < $3) arr[$1,$2] = $3} END {for (i in arr) print i,arr[i]}' | sort --version-sort | tail -3) +cabalVersion=$(apt-cache search cabal-install-[0-9] | grep -Po '\d*\.\d*' | sort --unique --version-sort | tail -1) for version in $ghcVersions; do apt-get install -y ghc-$version done -for version in $cabalVersions; do - apt-get install -y cabal-install-$version -done +apt-get install -y cabal-install-$cabalVersion # Install the latest stable release of haskell stack curl -sSL https://get.haskellstack.org/ | sh @@ -46,13 +35,13 @@ for version in $ghcVersions; do exit 1 fi done -# Check all cabal versions -for version in $cabalVersions; do - if ! command -v /opt/cabal/$version/bin/cabal; then - echo "cabal $version was not installed" - exit 1 - fi -done + +# Check cabal +if ! command -v /opt/cabal/$cabalVersion/bin/cabal; then + echo "cabal $cabalVersion was not installed" + exit 1 +fi + # Check stack if ! command -v stack; then exit 1 @@ -60,9 +49,7 @@ fi # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" -for version in $cabalVersions; do - DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$version/bin/cabal --version))" -done +DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$cabalVersion/bin/cabal --version))" for version in $ghcVersions; do DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))" done From 8290bdeb6ef827d3ec78895cc3cbc0b010dc42fe Mon Sep 17 00:00:00 2001 From: Andy Mishechkin <57713077+andy-mishechkin@users.noreply.github.com> Date: Thu, 28 May 2020 17:18:02 +0400 Subject: [PATCH 05/13] "Zeit-now" CLI to "zeit-vercel" CLI (#947) * Zeit Now has been replaced to Zeit Vercel * Checking the [now] command has been added * zeit-now -> zeit-vercel * zeit--Now has been renamed to zeit-vercel in Ubuntu temlates --- .../installers/{zeit-now.sh => zeit-vercel.sh} | 17 +++++++++++++---- images/linux/ubuntu1604.json | 2 +- images/linux/ubuntu1804.json | 2 +- images/linux/ubuntu2004.json | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) rename images/linux/scripts/installers/{zeit-now.sh => zeit-vercel.sh} (57%) diff --git a/images/linux/scripts/installers/zeit-now.sh b/images/linux/scripts/installers/zeit-vercel.sh similarity index 57% rename from images/linux/scripts/installers/zeit-now.sh rename to images/linux/scripts/installers/zeit-vercel.sh index 563ba47e1..8f5c22e49 100644 --- a/images/linux/scripts/installers/zeit-now.sh +++ b/images/linux/scripts/installers/zeit-vercel.sh @@ -7,16 +7,25 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -# Install the Zeit Now CLI -npm i -g now +# Install the Zeit 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" + exit 1 +fi + +echo "Creating the symlink now to vercel" +ln -s /usr/local/bin/vercel /usr/local/bin/now + +echo "Validate the link" if ! command -v now; then - echo "Zeit Now CLI was not installed" + echo "Now link to Zeit Vercel CLI was not created" exit 1 fi # Document the installed version echo "Document the installed version" -DocumentInstalledItem "Zeit Now CLI ($(now --version))" +DocumentInstalledItem "Zeit Vercel CLI ($(vercel --version))" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 09e7083d8..d90ddb166 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -229,7 +229,7 @@ "{{template_dir}}/scripts/installers/terraform.sh", "{{template_dir}}/scripts/installers/packer.sh", "{{template_dir}}/scripts/installers/vcpkg.sh", - "{{template_dir}}/scripts/installers/zeit-now.sh", + "{{template_dir}}/scripts/installers/zeit-vercel.sh", "{{template_dir}}/scripts/installers/dpkg-config.sh", "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh" diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index d20432b57..4327b60c9 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -233,7 +233,7 @@ "{{template_dir}}/scripts/installers/terraform.sh", "{{template_dir}}/scripts/installers/packer.sh", "{{template_dir}}/scripts/installers/vcpkg.sh", - "{{template_dir}}/scripts/installers/zeit-now.sh", + "{{template_dir}}/scripts/installers/zeit-vercel.sh", "{{template_dir}}/scripts/installers/dpkg-config.sh", "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh" diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 168526399..344762750 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -230,7 +230,7 @@ "{{template_dir}}/scripts/installers/terraform.sh", "{{template_dir}}/scripts/installers/packer.sh", "{{template_dir}}/scripts/installers/vcpkg.sh", - "{{template_dir}}/scripts/installers/zeit-now.sh", + "{{template_dir}}/scripts/installers/zeit-vercel.sh", "{{template_dir}}/scripts/installers/dpkg-config.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh" ], From ea645ec9afe0b8a96a15bc1f6f1fbdf2addcc3b3 Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Thu, 28 May 2020 10:15:39 -0500 Subject: [PATCH 06/13] Skip first time welcome message in .NET Core Since .NET Core 3.1.300, there is a new environment variable named `DOTNET_NOLOGO` that specifies whether .NET Core welcome and telemetry messages are displayed on first run. https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet --- images/linux/scripts/installers/dotnetcore-sdk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index 06323d0ef..ec0f0dc3b 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -99,5 +99,6 @@ done # NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test # Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine setEtcEnvironmentVariable DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1 +setEtcEnvironmentVariable DOTNET_NOLOGO 1 prependEtcEnvironmentPath /home/runner/.dotnet/tools echo 'export PATH="$PATH:$HOME/.dotnet/tools"' | tee -a /etc/skel/.bashrc From 9b76f6f84b85909cbf3ba1e2eb73e2ed7506e2a0 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Thu, 28 May 2020 19:30:28 +0300 Subject: [PATCH 07/13] Update to latest kind version (#954) --- images/linux/scripts/installers/kind.sh | 6 ++--- .../win/scripts/Installers/Install-Kind.ps1 | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/images/linux/scripts/installers/kind.sh b/images/linux/scripts/installers/kind.sh index 59696906a..4fc7c0d42 100644 --- a/images/linux/scripts/installers/kind.sh +++ b/images/linux/scripts/installers/kind.sh @@ -6,12 +6,10 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh # Install KIND -KIND_VERSION="v0.7.0" - -curl -L -o /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" +URL=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r '.assets[].browser_download_url | select(contains("kind-linux-amd64"))') +curl -L -o /usr/local/bin/kind $URL chmod +x /usr/local/bin/kind # Run tests to determine that the software installed as expected diff --git a/images/win/scripts/Installers/Install-Kind.ps1 b/images/win/scripts/Installers/Install-Kind.ps1 index 12f0caa04..0e97cc04b 100644 --- a/images/win/scripts/Installers/Install-Kind.ps1 +++ b/images/win/scripts/Installers/Install-Kind.ps1 @@ -3,37 +3,38 @@ ## Desc: Install Kind ################################################################################ -$stableKindTag = "v0.7.0" -$tagToUse = $stableKindTag; -$destFilePath = "C:\ProgramData\kind" +function Get-LatestRelease +{ + $url = 'https://api.github.com/repos/kubernetes-sigs/kind/releases/latest' + (Invoke-RestMethod -Uri $url).assets.browser_download_url -match "kind-windows-amd64" +} try { - $kindUrl = "https://github.com/kubernetes-sigs/kind/releases/download/$tagToUse/kind-windows-amd64" - - Write-Host "Downloading kind.exe..." - New-Item -Path $destFilePath -ItemType Directory -Force + Write-Host "Starting Install kind.exe..." + $destFilePath = "C:\ProgramData\kind" + $null = New-Item -Path $destFilePath -ItemType Directory -Force + $kindUrl = Get-LatestRelease $kindInstallerPath = Start-DownloadWithRetry -Url $kindUrl -Name "kind.exe" -DownloadPath $destFilePath - Write-Host "Starting Install kind.exe..." $process = Start-Process -FilePath $kindInstallerPath -Wait -PassThru $exitCode = $process.ExitCode if ($exitCode -eq 0 -or $exitCode -eq 3010) { - Write-Host -Object 'Installation successful' + Write-Host 'Installation successful' Add-MachinePathItem $destFilePath } else { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + Write-Host "Non zero exit code returned by the installation process : $exitCode." exit $exitCode } } catch { - Write-Host -Object "Failed to install the Executable kind.exe" - Write-Host -Object $_.Exception.Message - exit -1 + Write-Host "Failed to install the Executable kind.exe" + Write-Host $_.Exception.Message + exit 1 } From 7976605290b6c59b56109cb17c95560b1b2f87c3 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 29 May 2020 09:28:06 +0300 Subject: [PATCH 08/13] Add git-ftp on Ubuntu image (#950) * Add git-ftp * Remove comment * Minor fix * Move installation to git.sh --- images/linux/scripts/installers/git.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/images/linux/scripts/installers/git.sh b/images/linux/scripts/installers/git.sh index 1d8e58a14..e2b27429a 100644 --- a/images/linux/scripts/installers/git.sh +++ b/images/linux/scripts/installers/git.sh @@ -17,6 +17,9 @@ git --version curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash apt-get install -y --no-install-recommends git-lfs +# Install git-ftp +apt-get install git-ftp -y + # Run tests to determine that the software installed as expected echo "Testing git installation" if ! command -v git; then @@ -28,6 +31,11 @@ if ! command -v git-lfs; then echo "git-lfs was not installed" exit 1 fi +echo "Testing git-ftp installation" +if ! command -v git-ftp; then + echo "git-ftp was not installed" + exit 1 +fi # Document what was added to the image echo "Lastly, document the installed versions" @@ -35,6 +43,7 @@ echo "Lastly, document the installed versions" DocumentInstalledItem "Git ($(git --version 2>&1 | cut -d ' ' -f 3))" # git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.1) DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 | cut -d ' ' -f 1 | cut -d '/' -f 2))" +DocumentInstalledItem "Git-ftp ($(git-ftp --version | cut -d ' ' -f 3))" #Install hub snap install hub --classic From 7b4cd37ecf9c846d63583c01fdfb6d0b61df65aa Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Fri, 29 May 2020 10:34:21 +0300 Subject: [PATCH 09/13] Temporary downgrade Azure-Cli to 2.5.1 (#959) * hardcode 2.5.1 for win and linux * change instllation to downgrade for ubuntu --- images/linux/scripts/installers/azure-cli.sh | 7 +++++++ images/win/scripts/Installers/Install-AzureCli.ps1 | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/azure-cli.sh b/images/linux/scripts/installers/azure-cli.sh index 713d23151..af6e41963 100644 --- a/images/linux/scripts/installers/azure-cli.sh +++ b/images/linux/scripts/installers/azure-cli.sh @@ -6,9 +6,16 @@ # 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" diff --git a/images/win/scripts/Installers/Install-AzureCli.ps1 b/images/win/scripts/Installers/Install-AzureCli.ps1 index 4b5d7dae1..c5432bc6b 100644 --- a/images/win/scripts/Installers/Install-AzureCli.ps1 +++ b/images/win/scripts/Installers/Install-AzureCli.ps1 @@ -3,7 +3,8 @@ ## Desc: Install Azure CLI ################################################################################ -Choco-Install -PackageName azure-cli +# Temporary hardcode 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 +Choco-Install -PackageName azure-cli -ArgumentList "--version=2.5.1" $AzureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory' New-Item -ItemType "directory" -Path $AzureCliExtensionPath From 696110c157bd3855970499339b3f9bf76877171a Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov <61747324+dibir-magomedsaygitov@users.noreply.github.com> Date: Fri, 29 May 2020 14:26:08 +0300 Subject: [PATCH 10/13] Refactor AzModules installation (#945) * refactor azmodules installation --- .../linux/scripts/installers/azpowershell.sh | 100 ++++-------------- 1 file changed, 23 insertions(+), 77 deletions(-) diff --git a/images/linux/scripts/installers/azpowershell.sh b/images/linux/scripts/installers/azpowershell.sh index 9f43f85e1..9af42bafa 100644 --- a/images/linux/scripts/installers/azpowershell.sh +++ b/images/linux/scripts/installers/azpowershell.sh @@ -8,90 +8,36 @@ 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) +# List of versions if isUbuntu20 ; then - latestVersion=$(pwsh -Command '(Find-Module -Name Az).Version') - modulePath="/usr/share/az_$latestVersion" - echo "Save Az Module ($latestVersion) to $modulePath" - pwsh -Command "Save-Module -Name Az -LiteralPath $modulePath -RequiredVersion $latestVersion -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 "\$env:PSModulePath = '${modulePath}:' + \$env:PSModulePath - if ( -not (Get-Module -ListAvailable -Name Az.Accounts)) { - Write-Host 'Az Module was not installed' - exit 1 - }"; then - exit 1 - fi - - # Document what was added to the image - DocumentInstalledItem "Az Module ($latestVersion)" - exit 0 + 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) -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' -sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_3.5.0 -RequiredVersion 3.5.0 -Force' -sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_3.8.0 -RequiredVersion 3.8.0 -Force' +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" -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 - $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 - $actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_3.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'; then - exit 1 -fi +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" -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)" -DocumentInstalledItem "Az Module (3.5.0)" -DocumentInstalledItem "Az Module (3.8.0)" +for version in ${versions[@]}; do + DocumentInstalledItem "Az Module ($version)" +done From 6ac6655c9f644d34160b0f838cf6558d66e9d39c Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Fri, 29 May 2020 14:38:59 +0300 Subject: [PATCH 11/13] more readable script (#956) --- images/linux/scripts/installers/haskell.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index 1d4dd02da..32e4fc4dd 100644 --- a/images/linux/scripts/installers/haskell.sh +++ b/images/linux/scripts/installers/haskell.sh @@ -13,14 +13,20 @@ apt-get install -y software-properties-common add-apt-repository -y ppa:hvr/ghc apt-get update -# Get 3 latest Haskell versions and latest Cabal version -ghcVersions=$(apt-cache search "^ghc-" | grep -Po '(\d*\.){2}\d*' | awk 'BEGIN {FS=OFS=SUBSEP="."}{if (arr[$1,$2] < $3) arr[$1,$2] = $3} END {for (i in arr) print i,arr[i]}' | sort --version-sort | tail -3) -cabalVersion=$(apt-cache search cabal-install-[0-9] | grep -Po '\d*\.\d*' | sort --unique --version-sort | tail -1) +# Get 3 latest Haskell Major.Minor versions +allGhcVersions=$(apt-cache search "^ghc-" | grep -Po '(\d*\.){2}\d*' | sort --unique --version-sort) +ghcMajorMinorVersions=$(echo "$allGhcVersions" | cut -d "." -f 1,2 | sort --unique --version-sort | tail -3) -for version in $ghcVersions; do - apt-get install -y ghc-$version +for version in $ghcMajorMinorVersions; do + # Get latest patch version for given Major.Minor one (ex. 8.6.5 for 8.6) and install it + exactVersion=$(echo "$allGhcVersions" | grep $version | sort --unique --version-sort | tail -1) + apt-get install -y ghc-$exactVersion + ghcInstalledVersions+=("$exactVersion") done +# Get latest cabal version +cabalVersion=$(apt-cache search cabal-install-[0-9] | grep -Po '\d*\.\d*' | sort --unique --version-sort | tail -1) + apt-get install -y cabal-install-$cabalVersion # Install the latest stable release of haskell stack @@ -50,7 +56,7 @@ fi # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$cabalVersion/bin/cabal --version))" -for version in $ghcVersions; do +for version in ${ghcInstalledVersions[@]}; do DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))" done DocumentInstalledItem "Haskell Stack ($(stack --version))" From 28da6d6fa10b8acd3ef2657aafdf8ff1244f4037 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Fri, 29 May 2020 05:05:11 -0700 Subject: [PATCH 12/13] Update Windows2019 image to use 2004 SDK & WDK (#935) --- images/win/scripts/Installers/Install-WDK.ps1 | 4 ++-- images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-WDK.ps1 b/images/win/scripts/Installers/Install-WDK.ps1 index 557152cf2..67da3a324 100644 --- a/images/win/scripts/Installers/Install-WDK.ps1 +++ b/images/win/scripts/Installers/Install-WDK.ps1 @@ -9,8 +9,8 @@ Import-Module -Name ImageHelpers -Force if (Test-IsWin19) { - $winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2083338" - $wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2085767" + $winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2120843" + $wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2128854" $FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix" $VSver = "2019" } diff --git a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 index 08d5e7ea2..e1a9c4d0f 100644 --- a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 +++ b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 @@ -72,6 +72,7 @@ $WorkLoads = '--allWorkloads --includeRecommended ' + ` '--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ' + ` '--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ' + ` '--add Microsoft.VisualStudio.Component.Windows10SDK.18362 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.19041 ' + ` '--add Microsoft.VisualStudio.Component.WinXP ' + ` '--add Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices ' + ` '--add Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools ' + ` From 330e62af9dc6e6d5f54c65b31ed4ff1871b5499b Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 29 May 2020 12:27:33 +0000 Subject: [PATCH 13/13] Add download retry helper on Ubuntu (#955) * Add download retry helper --- images/linux/scripts/helpers/install.sh | 30 +++++++++++++++++++++++++ images/linux/scripts/installers/pypy.sh | 28 +++++------------------ 2 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 images/linux/scripts/helpers/install.sh diff --git a/images/linux/scripts/helpers/install.sh b/images/linux/scripts/helpers/install.sh new file mode 100644 index 000000000..15c2e1a01 --- /dev/null +++ b/images/linux/scripts/helpers/install.sh @@ -0,0 +1,30 @@ +#!/bin/bash +################################################################################ +## File: install.sh +## Desc: Helper functions for installing tools +################################################################################ + +download_with_retries() { +# 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. +# Example: download_with_retries $ANDROID_SDK_URL "." "android_sdk.zip" + local URL="$1" + local DEST="${2:-.}" + local NAME="${3:-${URL##*/}}" + + echo "Downloading $URL..." + i=20 + while [ $i -gt 0 ]; do + ((i--)) + wget $URL --output-document="$DEST/$NAME" \ + --no-verbose + if [ $? != 0 ]; then + sleep 30 + else + return 0 + fi + done + + echo "Could not download $URL" + return 1 +} \ No newline at end of file diff --git a/images/linux/scripts/installers/pypy.sh b/images/linux/scripts/installers/pypy.sh index 117a927b1..cfb097bd6 100644 --- a/images/linux/scripts/installers/pypy.sh +++ b/images/linux/scripts/installers/pypy.sh @@ -6,6 +6,7 @@ # 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 @@ -16,7 +17,7 @@ function InstallPyPy 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" - wget -q -O $PACKAGE_TAR_TEMP_PATH $PACKAGE_URL + 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 @@ -69,28 +70,11 @@ function InstallPyPy rm -f $PACKAGE_TAR_TEMP_PATH } -function getPyPyVersions -{ - uri="https://downloads.python.org/pypy/" - i=20 - - while [ $i -gt 0 ]; do - ((i--)) - result="$(curl -4 -s --compressed $uri | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')" - if [ -z "$result" ]; then - sleep 30 - else - echo "$result" - return - fi - done - - echo "There are no more attempts to retrive PyPy version" - exit 1 -} - # Installation PyPy -pypyVersions=$(getPyPyVersions) +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[]')