diff --git a/images/linux/Ubuntu1604-README.md b/images/linux/Ubuntu1604-README.md index c06b5d7b..57198a44 100644 --- a/images/linux/Ubuntu1604-README.md +++ b/images/linux/Ubuntu1604-README.md @@ -1,11 +1,13 @@ | Announcements | |-| +| [Default Node.JS will be switched to 14.x on all platforms ](https://github.com/actions/virtual-environments/issues/1953) | +| [[macOS] Default Python will be upgraded to 3.9](https://github.com/actions/virtual-environments/issues/1929) | | [.NET 5.0 will become a default .NET version on November, 10](https://github.com/actions/virtual-environments/issues/1891) | | [[Ubuntu] [Windows] Boost 1.69.0 will be deprecated on November, 10](https://github.com/actions/virtual-environments/issues/1847) | | [Ubuntu-latest workflows will use Ubuntu-20.04](https://github.com/actions/virtual-environments/issues/1816) | *** # Ubuntu 16.04.7 LTS -- Image Version: 20201026.1 +- Image Version: 20201102.0 ## Installed Software ### Language and Runtime @@ -14,7 +16,7 @@ - Clang 6.0.0, 8.0.0, 9.0.1 - Erlang 11.1 - Mono 6.12.0.90 -- Node 12.19.0 +- Node 14.15.0 - Python 2.7.12 - Python3 3.5.2 - PowerShell 7.0.3 @@ -24,8 +26,8 @@ ### Package Management - Gem 3.1.4 -- Helm 3.3.4 -- Homebrew 2.5.6 +- Helm 3.4.0 +- Homebrew 2.5.8 - Miniconda 4.8.3 - Npm 6.14.8 - Pip 8.1.1 @@ -48,7 +50,7 @@ - Bazel 3.7.0 - Bazelisk 1.7.3 - CMake 3.17.0 -- CodeQL Action Bundle 2.3.0 +- CodeQL Action Bundle 2.3.1+202010222007 - curl 7.47.0 - Docker Compose 1.27.4 - Docker-Buildx 0.4.2 @@ -56,21 +58,21 @@ - Git 2.29.0 - Git LFS 2.12.0 - Git-ftp 1.0.2 -- Google Cloud SDK 315.0.0 +- Google Cloud SDK 316.0.0 - Haveged 1.9.1 -- Heroku 7.46.2 +- Heroku 7.47.0 - HHVM (HipHop VM) 4.56.1 - jq 1.5 - Kind 0.9.0 - Kubectl 1.19.3 -- Kustomize 3.8.5 +- Kustomize 3.8.6 - Leiningen 2.9.4 - m4 1.4.17 - Mercurial 4.4.1 -- Minikube 1.14.1 -- Newman 5.2.0 +- Minikube 1.14.2 +- Newman 5.2.1 - nvm 0.36.0 -- Packer 1.6.4 +- Packer 1.6.5 - PhantomJS 2.1.1 - Pulumi 2.12.1 - R 4.0.3 @@ -86,14 +88,14 @@ ### CLI Tools - Alibaba Cloud CLI 3.0.60 -- AWS CLI 1.18.164 +- AWS CLI 1.18.169 - AWS CLI Session manager plugin 1.2.7.0 -- AWS SAM CLI 1.6.2 -- Azure CLI (azure-cli) 2.13.0 +- AWS SAM CLI 1.7.0 +- Azure CLI (azure-cli) 2.14.0 - Azure CLI (azure-devops) 0.18.0 -- GitHub CLI 1.1.0 +- GitHub CLI 1.2.0 - Hub CLI 2.14.2 -- Netlify CLI 2.65.7 +- Netlify CLI 2.67.2 - oc CLI 4.5.0 - ORAS CLI 0.8.1 - Vercel CLI 20.1.2 @@ -109,8 +111,8 @@ ### PHP | Tool | Version | | -------- | ----------------------------------------- | -| PHP | 5.6.40 7.0.33 7.1.33 7.2.34 7.3.23 7.4.11 | -| Composer | 2.0.2 | +| PHP | 5.6.40 7.0.33 7.1.33 7.2.34 7.3.24 7.4.12 | +| Composer | 2.0.4 | | PHPUnit | 7.5.20 | ### Haskell @@ -126,16 +128,16 @@ #### Packages - Bindgen 0.55.1 -- Cargo audit 0.12.1 -- Cargo outdated 0.9.11 +- Cargo audit 0.13.1 +- Cargo outdated 0.9.13 - Cargo clippy 0.0.212 - Cbindgen 0.15.0 - Rustfmt 1.4.20 ### Browsers and Drivers -- Google Chrome 86.0.4240.111 +- Google Chrome 86.0.4240.183 - ChromeDriver 86.0.4240.22 -- Mozilla Firefox 81.0.2 +- Mozilla Firefox 82.0 - Geckodriver 0.27.0 ### .NET Core SDK @@ -150,7 +152,7 @@ - sqlite3 3.11.0 #### MySQL -- MySQL 5.7.31 +- MySQL 5.7.32 - MySQL Server (user:root password:root) - MS SQL Server Client Tools @@ -178,9 +180,9 @@ #### Node.js - 8.17.0 -- 10.22.1 +- 10.23.0 - 12.19.0 -- 14.14.0 +- 14.15.0 #### Go - 1.11.13 diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 1989caf4..15a19653 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -240,6 +240,17 @@ function Get-CachedDockerImages { return $images } +function Get-CachedDockerImagesTableData { + return (sudo docker images --digests --format "*{{.Repository}}:{{.Tag}}|{{.Digest}} |{{.CreatedAt}}").Split("*") | Where-Object { $_ } | ForEach-Object { + $parts=$_.Split("|") + [PSCustomObject] @{ + "Repository:Tag" = $parts[0] + "Digest" = $parts[1] + "Created" = $parts[2].split(' ')[0] + } + } +} + function Get-AptPackages { $toolsetJson = Get-ToolsetContent $apt = $toolsetJson.apt @@ -252,4 +263,4 @@ function Get-PipxVersion { $result -match "(?\d+\.\d+\.\d+\.?\d*)" | Out-Null $pipxVersion = $Matches.Version return "Pipx $pipxVersion" -} \ No newline at end of file +} diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index df77ea23..9cf57034 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -224,7 +224,8 @@ $markdown += Build-AndroidTable | New-MDTable $markdown += New-MDNewLine $markdown += New-MDHeader "Cached Docker images" -Level 3 -$markdown += New-MDList -Style Unordered -Lines @(Get-CachedDockerImages) +$markdown += Get-CachedDockerImagesTableData | New-MDTable +$markdown += New-MDNewLine $markdown += New-MDHeader "Installed apt packages" -Level 3 $markdown += New-MDList -Style Unordered -Lines @(Get-AptPackages) diff --git a/images/linux/scripts/base/apt.sh b/images/linux/scripts/base/apt.sh index 1efbb672..cf221452 100644 --- a/images/linux/scripts/base/apt.sh +++ b/images/linux/scripts/base/apt.sh @@ -1,9 +1,5 @@ #!/bin/bash -e -export DEBIAN_FRONTEND=noninteractive -apt-get -yq update -apt-get -yq dist-upgrade - # Stop and disable apt-daily upgrade services; systemctl stop apt-daily.timer systemctl disable apt-daily.timer @@ -16,7 +12,7 @@ systemctl disable apt-daily-upgrade.service sudo sed -i 's/APT::Periodic::Update-Package-Lists "1"/APT::Periodic::Update-Package-Lists "0"/' /etc/apt/apt.conf.d/20auto-upgrades # Enable retry logic for apt up to 10 times -echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80-retries +echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80-retries # Configure apt to always assume Y echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes diff --git a/images/linux/scripts/base/repos.sh b/images/linux/scripts/base/repos.sh index 9005d32a..a489c62a 100644 --- a/images/linux/scripts/base/repos.sh +++ b/images/linux/scripts/base/repos.sh @@ -16,4 +16,7 @@ curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg -apt-get update \ No newline at end of file + +# update +apt-get -yq update +apt-get -yq dist-upgrade diff --git a/images/linux/scripts/installers/azpowershell.sh b/images/linux/scripts/installers/azpowershell.sh index 13253b5f..f18492c5 100644 --- a/images/linux/scripts/installers/azpowershell.sh +++ b/images/linux/scripts/installers/azpowershell.sh @@ -18,6 +18,10 @@ pwsh -Command "Update-Module -Name PowerShellGet -Force" # 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 -Verbose" + if isUbuntu20; then + rm -rf "/usr/share/az_$version/Az.Accounts" + pwsh -Command "Save-Module -Name Az.Accounts -LiteralPath /usr/share/az_$version -RequiredVersion 1.9.5 -Force -Verbose" + fi done # Run tests to determine that the software installed as expected diff --git a/images/linux/scripts/installers/powershellcore.sh b/images/linux/scripts/installers/powershellcore.sh index 4f700fbc..0ac52072 100644 --- a/images/linux/scripts/installers/powershellcore.sh +++ b/images/linux/scripts/installers/powershellcore.sh @@ -9,8 +9,7 @@ source $HELPER_SCRIPTS/os.sh # Install Powershell if isUbuntu20 ; then - dotnet tool install --tool-path /opt/microsoft/powershell/7 powershell - ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh + snap install powershell --classic --channel=edge/useedge fi if isUbuntu16 || isUbuntu18 ; then diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index 1136ae92..1c5ff532 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -42,8 +42,6 @@ "arch": "x64", "platform" : "linux", "versions": [ - "1.11.*", - "1.12.*", "1.13.*", "1.14.*", "1.15.*" @@ -57,7 +55,6 @@ "platform_version": "16.04", "arch": "x64", "versions": [ - "1.69.0", "1.72.0" ] } diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index de611ebc..226dd190 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -42,8 +42,6 @@ "arch": "x64", "platform" : "linux", "versions": [ - "1.11.*", - "1.12.*", "1.13.*", "1.14.*", "1.15.*" @@ -57,7 +55,6 @@ "platform_version": "18.04", "arch": "x64", "versions": [ - "1.69.0", "1.72.0" ] } diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index a519b30d..6168f4bf 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -72,6 +72,9 @@ { "type": "shell", "script": "{{template_dir}}/scripts/base/apt.sh", + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, { diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 977464e3..6fc3f813 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -75,6 +75,9 @@ { "type": "shell", "script": "{{template_dir}}/scripts/base/apt.sh", + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, { diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 54bc6fb5..bde4024c 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -74,9 +74,20 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "expect_disconnect": true, + "scripts": [ + "{{template_dir}}/scripts/base/reboot.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "script": "{{template_dir}}/scripts/base/apt.sh", + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, { diff --git a/images/macos/provision/core/node.sh b/images/macos/provision/core/node.sh index 59e727ce..194437a9 100644 --- a/images/macos/provision/core/node.sh +++ b/images/macos/provision/core/node.sh @@ -27,8 +27,8 @@ if is_Less_Catalina; then npm install -g appcenter-cli@^1.0.0 else # Install Node.JS 12 for macOS >= 10.15 - brew install node@12 - brew link node@12 --force + brew install node@14 + brew link node@14 --force for module in ${node_modules[@]}; do echo "Install $module" diff --git a/images/macos/provision/core/rust.sh b/images/macos/provision/core/rust.sh index de82c7b4..89e70537 100644 --- a/images/macos/provision/core/rust.sh +++ b/images/macos/provision/core/rust.sh @@ -11,7 +11,8 @@ CARGO_HOME=$HOME/.cargo source $CARGO_HOME/env echo Install common tools... +rustup component add rustfmt clippy cargo install bindgen cbindgen cargo-audit cargo-outdated echo Cleanup Cargo registry cached data... -rm -rf $CARGO_HOME/registry/* \ No newline at end of file +rm -rf $CARGO_HOME/registry/* diff --git a/images/macos/provision/core/xcode-tools.sh b/images/macos/provision/core/xcode-tools.sh index 773b07a9..5c491708 100755 --- a/images/macos/provision/core/xcode-tools.sh +++ b/images/macos/provision/core/xcode-tools.sh @@ -77,6 +77,7 @@ runFirstLaunch $DEFAULT_XCODE_VERSION if is_Catalina; then ln -sf /Applications/Xcode_11.2.1.app /Applications/Xcode_11.2.app ln -sf /Applications/Xcode_11.3.1.app /Applications/Xcode_11.3.app + ln -sf /Applications/Xcode_11.4.1.app /Applications/Xcode_11.4.app fi echo "Setting Xcode ${DEFAULT_XCODE_VERSION} as default" diff --git a/images/macos/tests/Node.Tests.ps1 b/images/macos/tests/Node.Tests.ps1 index 7fde021d..65005eb6 100644 --- a/images/macos/tests/Node.Tests.ps1 +++ b/images/macos/tests/Node.Tests.ps1 @@ -4,7 +4,7 @@ Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" Describe "Node.JS" { BeforeAll { $os = Get-OSVersion - $expectedNodeVersion = if ($os.IsHigherThanMojave) { "v12.*" } else { "v8.*" } + $expectedNodeVersion = if ($os.IsHigherThanMojave) { "v14.*" } else { "v8.*" } } It "Node.JS is installed" { @@ -29,7 +29,7 @@ Describe "NVM" { $nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh" $nvmInitCommand = ". $nvmPath > /dev/null 2>&1 || true" } - + It "Nvm is installed" { $nvmPath | Should -Exist "$nvmInitCommand && nvm --version" | Should -ReturnZeroExitCode @@ -43,7 +43,7 @@ Describe "NVM" { param ( [string] $NvmVersion ) - + "$nvmInitCommand && nvm ls $($NvmVersion)" | Should -ReturnZeroExitCode } } diff --git a/images/macos/toolsets/toolset-10.15.json b/images/macos/toolsets/toolset-10.15.json index 11a7e016..79f6d9eb 100644 --- a/images/macos/toolsets/toolset-10.15.json +++ b/images/macos/toolsets/toolset-10.15.json @@ -2,7 +2,7 @@ "xcode": { "default": "12", "versions": [ - "12.2_beta", "12.1", "12", "11.7", "11.6", "11.5", "11.4.1", "11.4", "11.3.1", "11.2.1", "11.1", "11", "10.3" + "12.2_beta", "12.1", "12", "11.7", "11.6", "11.5", "11.4.1", "11.3.1", "11.2.1", "10.3" ] }, "xamarin": { @@ -168,8 +168,6 @@ "arch": "x64", "platform" : "darwin", "versions": [ - "1.11.*", - "1.12.*", "1.13.*", "1.14.*", "1.15.*" diff --git a/images/win/scripts/Installers/Configure-Shell.ps1 b/images/win/scripts/Installers/Configure-Shell.ps1 deleted file mode 100644 index 61b30bf3..00000000 --- a/images/win/scripts/Installers/Configure-Shell.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -# Create shells folder -$shellPath = "C:\shells" -New-Item -Path $shellPath -ItemType Directory | Out-Null - -# sh and bash <--> C:\msys64\usr\bin\bash.exe -New-Item -ItemType SymbolicLink -Path "$shellPath\bash.exe" -Target "C:\msys64\bin\bash.exe" | Out-Null -New-Item -ItemType SymbolicLink -Path "$shellPath\sh.exe" -Target "C:\msys64\bin\sh.exe" | Out-Null - -# WSL is available on Windows Server 2019 -if (Test-IsWin19) -{ - # winbash <--> C:\Windows\System32\bash.exe - New-Item -ItemType SymbolicLink -Path "$shellPath\winbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null -} - -# gitbash <--> C:\Program Files\Git\bin\bash.exe -New-Item -ItemType SymbolicLink -Path "$shellPath\gitbash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null - -# msysbash <--> C:\msys64\usr\bin\bash.exe -New-Item -ItemType SymbolicLink -Path "$shellPath\msysbash.exe" -Target "C:\msys64\usr\bin\bash.exe" | Out-Null - -# Add shells to PATH -Add-MachinePathItem $shellPath \ No newline at end of file diff --git a/images/win/scripts/Installers/Finalize-VM.ps1 b/images/win/scripts/Installers/Finalize-VM.ps1 index d0bb3d26..8e29dbe2 100644 --- a/images/win/scripts/Installers/Finalize-VM.ps1 +++ b/images/win/scripts/Installers/Finalize-VM.ps1 @@ -33,4 +33,8 @@ Remove-Item $profile.AllUsersAllHosts -Force # Clean yarn and npm cache yarn cache clean -npm cache clean --force \ No newline at end of file +npm cache clean --force + +# allow msi to write to temp folder +# see https://github.com/actions/virtual-environments/issues/1704 +icacls "C:\Windows\Temp" /q /c /t /grant Users:F /T diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 6c89250e..27a61969 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -26,7 +26,7 @@ Install-Binary -Url $downloadUrl ` "/SP-", ` "/CLOSEAPPLICATIONS", ` "/RESTARTAPPLICATIONS", ` - "/o:PathOption=Cmd", ` + "/o:PathOption=CmdTools", ` "/o:BashTerminalOption=ConHost", ` "/o:EnableSymlinks=Enabled", ` "/COMPONENTS=gitlfs") @@ -36,5 +36,15 @@ Choco-Install -PackageName hub # Disable GCM machine-wide [Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) +Add-MachinePathItem "C:\Program Files\Git\bin" + +if (Test-IsWin16) { + $env:Path += ";$env:ProgramFiles\Git\usr\bin\" +} + +# Add well-known SSH host keys to ssh_known_hosts +ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" +ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" + Invoke-PesterTests -TestFile "Git" -TestName "Git" Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Hub CLI" diff --git a/images/win/scripts/Installers/Install-Mingw64.ps1 b/images/win/scripts/Installers/Install-Mingw64.ps1 index 2b999f45..b6c86048 100644 --- a/images/win/scripts/Installers/Install-Mingw64.ps1 +++ b/images/win/scripts/Installers/Install-Mingw64.ps1 @@ -7,7 +7,7 @@ Choco-Install -PackageName mingw # Make a copy of mingw32-make.exe to make.exe, which is a more discoverable name # and so the same command line can be used on Windows as on macOS and Linux -$path = Get-Command mingw32-make.exe -CommandType All | Where-Object { $_.Path.Contains("C:\ProgramData\Chocolatey") } | Get-Item +$path = where.exe mingw32-make.exe | Get-Item Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe') Invoke-PesterTests -TestFile "Tools" -TestName "Mingw64" diff --git a/images/win/scripts/Installers/Install-Msys2.ps1 b/images/win/scripts/Installers/Install-Msys2.ps1 index 26a61e39..f0da3850 100644 --- a/images/win/scripts/Installers/Install-Msys2.ps1 +++ b/images/win/scripts/Installers/Install-Msys2.ps1 @@ -9,19 +9,35 @@ $dash = "-" * 40 -# Downloading msys2 -$msys2Release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest" -$msys2Uri = ((Invoke-RestMethod $msys2Release).assets | Where-Object { - $_.name -match "x86_64" -and $_.name.EndsWith("sfx.exe") }).browser_download_url -$msys2File = Start-DownloadWithRetry -Url $msys2Uri +$origPath = $env:PATH +$gitPath = "$env:ProgramFiles\Git" -# extract sfx.exe to C:\ +$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest" + +$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object { + $_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url + +# Download the latest msys2 x86_64, filename includes release date +Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])" +$msys2File = Start-DownloadWithRetry -Url $msys2Uri +Write-Host "Finished download" + +# nix style path for tar +$msys2FileU = "/$msys2File".replace(':', '').replace('\', '/') + +# Git tar needs exe's from mingw64\bin +$env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath" + +$tar = "$gitPath\usr\bin\tar.exe" + +# extract tar.xz to C:\ Write-Host "Starting msys2 extraction" -& $msys2File -y -oC:\ +&$tar -xJf $msys2FileU -C /c/ +Remove-Item $msys2File Write-Host "Finished extraction" # Add msys2 bin tools folders to PATH temporary -$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:PATH" +$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath" Write-Host "`n$dash bash pacman-key --init" bash.exe -c "pacman-key --init 2>&1" @@ -57,10 +73,6 @@ Write-Host "`n$dash Install mingw32 packages" $pre = "mingw-w64-i686-" pacman.exe -S --noconfirm --needed --noprogressbar $tools32.replace('___', $pre).split(' ') -# install openssh -Write-Host "`n$dash Install openssh package" -pacman.exe -S --noconfirm --needed --noprogressbar openssh - # clean all packages to decrease image size Write-Host "`n$dash Clean packages" pacman.exe -Scc --noconfirm @@ -76,29 +88,4 @@ pacman.exe -Q | grep -v ^mingw-w64- Write-Host "`nMSYS2 installation completed" -# Environment -# add C:\msys64\mingw64\bin and C:\msys64\usr\bin to PATH -# C:\msys64\mingw64\bin add after C:\Windows\System32 to not replace built-in tar.exe -$regEnvKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -$pathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path' -$pathValue += ";C:\msys64\mingw64\bin;C:\msys64\usr\bin" -Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $pathValue - -# Add well-known SSH host keys to ssh_known_hosts to Msys2 -ssh-keyscan -t rsa github.com >> "C:\msys64\etc\ssh\ssh_known_hosts" -ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\msys64\etc\ssh\ssh_known_hosts" - -# Add well-known SSH host keys to ssh_known_hosts to Git -if (Test-Path "C:\Program Files\Git\etc\ssh") -{ - ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" - ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" -} - -# Copy bash wrapper from git -$wrapperPath = "C:\msys64\bin" -New-Item -Path $wrapperPath -ItemType Directory -Force | Out-Null -Copy-Item -Path "$env:ProgramFiles\Git\bin\bash.exe" -Destination $wrapperPath -Copy-Item -Path "$env:ProgramFiles\Git\bin\sh.exe" -Destination $wrapperPath - Invoke-PesterTests -TestFile "MSYS2" diff --git a/images/win/scripts/Installers/Install-Pipx.ps1 b/images/win/scripts/Installers/Install-Pipx.ps1 new file mode 100644 index 00000000..a78cf456 --- /dev/null +++ b/images/win/scripts/Installers/Install-Pipx.ps1 @@ -0,0 +1,14 @@ +# Set custom directorys for pipx +$env:PIPX_BIN_DIR = "${env:ProgramFiles(x86)}\pipx_bin" +$env:PIPX_HOME = "${env:ProgramFiles(x86)}\pipx" + +# Install pipx +pip install pipx + +# Set environment variables +Add-MachinePathItem "${env:PIPX_BIN_DIR}" +Set-SystemVariable -SystemVariable PIPX_BIN_DIR -Value $env:PIPX_BIN_DIR +Set-SystemVariable -SystemVariable PIPX_HOME -Value $env:PIPX_HOME + +# Test pipx +Invoke-PesterTests -TestFile "Tools" -TestName "Pipx" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-PipxPackages.ps1 b/images/win/scripts/Installers/Install-PipxPackages.ps1 new file mode 100644 index 00000000..e83f5add --- /dev/null +++ b/images/win/scripts/Installers/Install-PipxPackages.ps1 @@ -0,0 +1,12 @@ +$pipxToolset = (Get-ToolsetContent).pipx +foreach($tool in $pipxToolset) { + if ($tool.python) { + $pythonPath = (Get-Item -Path "${env:AGENT_TOOLSDIRECTORY}\Python\${tool.python}.*\x64\python-${tool.python}*").FullName + Write-Host "Install ${tool.package} into python ${tool.python}" + pipx install $tool.package --python $pythonPath + } else { + Write-Host "Install ${tool.package} into default python" + pipx install $tool.package + } +} +Invoke-PesterTests -TestFile "PipxPackages" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-YAMLLint.ps1 b/images/win/scripts/Installers/Install-YAMLLint.ps1 deleted file mode 100644 index 1ebc09a3..00000000 --- a/images/win/scripts/Installers/Install-YAMLLint.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -pip install yamllint - -Invoke-PesterTests -TestFile "Tools" -TestName "yamllint" \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 0ca95ee7..be9603f6 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -262,6 +262,17 @@ function Get-CachedDockerImages { return (docker images --digests --format "* {{.Repository}}:{{.Tag}}").Split("*") | Where-Object { $_ } } +function Get-CachedDockerImagesTableData { + return (docker images --digests --format "*{{.Repository}}:{{.Tag}}|{{.Digest}} |{{.CreatedAt}}").Split("*") | Where-Object { $_ } | ForEach-Object { + $parts=$_.Split("|") + [PSCustomObject] @{ + "Repository:Tag" = $parts[0] + "Digest" = $parts[1] + "Created" = $parts[2].split(' ')[0] + } + } +} + function Get-PacmanVersion { $msys2BinDir = "C:\msys64\usr\bin" $pacmanPath = Join-Path $msys2BinDir "pacman.exe" @@ -271,13 +282,11 @@ function Get-PacmanVersion { return "- Pacman $pacmanVersion" } -function Get-ShellTarget { - $shells = Get-ChildItem C:\shells -File | Select-Object @{n="Name";e={ - $name = $_.Name - if ($name -eq 'bash.exe') {"$name (Default)"} else {$name}}},@{n="Target";e={@($_.Target)[0]}} | Sort-Object Name - $shells | New-MDTable -Columns ([ordered]@{Name = "left"; Target = "left";}) -} - function Get-YAMLLintVersion { yamllint --version -} \ No newline at end of file +} + +function Get-PipxVersion { + $pipxVersion = pipx --version + return "Pipx $pipxVersion" +} diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 06e1054d..91c19dc6 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -59,7 +59,8 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-RubyGemsVersion), (Get-HelmVersion), (Get-ComposerVersion), - (Get-NugetVersion) + (Get-NugetVersion), + (Get-PipxVersion) ) $markdown += New-MDHeader "Project Management" -Level 3 @@ -142,22 +143,14 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-SeleniumWebDriverVersion -Driver "iexplorer") ) -$markdown += New-MDHeader "Shells" -Level 3 -$markdown += Get-ShellTarget -$markdown += New-MDNewLine - $markdown += New-MDHeader "MSYS2" -Level 3 $markdown += Get-PacmanVersion $markdown += New-MDNewLine -$markdown += New-MDHeader "Notes:" -Level 5 $markdown += @' ``` Location: C:\msys64 -1. MSYS2 is pre-installed on image -2. C:\msys64\mingw64\bin is added to PATH and has lower precedence than C:\Windows\System32 -3. C:\msys64\usr\bin is added to PATH and has lower precedence than C:\Windows\System32 -4. Default bash.exe shell is set to the C:\msys64\usr\bin\bash.exe +Note: MSYS2 is pre-installed on image but not added to PATH. ``` '@ $markdown += New-MDNewLine @@ -243,6 +236,7 @@ $markdown += New-MDNewLine # Docker images section $markdown += New-MDHeader "Cached Docker images" -Level 3 -$markdown += New-MDList -Style Unordered -Lines @(Get-CachedDockerImages) +$markdown += Get-CachedDockerImagesTableData | New-MDTable +$markdown += New-MDNewLine -$markdown | Out-File -FilePath "C:\InstalledSoftware.md" \ No newline at end of file +$markdown | Out-File -FilePath "C:\InstalledSoftware.md" diff --git a/images/win/scripts/Tests/Git.Tests.ps1 b/images/win/scripts/Tests/Git.Tests.ps1 index e7675ee0..8dd159fa 100644 --- a/images/win/scripts/Tests/Git.Tests.ps1 +++ b/images/win/scripts/Tests/Git.Tests.ps1 @@ -1,5 +1,5 @@ Describe "Git" { - $gitTools = 'git', 'git-lfs' + $gitTools = 'bash', 'awk', 'git', 'git-lfs' $gitTestCases = $gitTools | ForEach-Object { @{ toolName = $_ diff --git a/images/win/scripts/Tests/PipxPackages.Tests.ps1 b/images/win/scripts/Tests/PipxPackages.Tests.ps1 new file mode 100644 index 00000000..41041078 --- /dev/null +++ b/images/win/scripts/Tests/PipxPackages.Tests.ps1 @@ -0,0 +1,7 @@ +Describe "PipxPackages" { + $pipxToolset = (Get-ToolsetContent).pipx + $testCases = $pipxToolset | ForEach-Object { @{package = $_.package; cmd = $_.cmd} } + It "" -TestCases $testCases { + "$cmd" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/win/scripts/Tests/Shell.Tests.ps1 b/images/win/scripts/Tests/Shell.Tests.ps1 deleted file mode 100644 index 084f40ca..00000000 --- a/images/win/scripts/Tests/Shell.Tests.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -Describe "Shell" { - $shellTestCases = @( - @{Name = "C:\shells\bash.exe"; Target = "C:\msys64\bin\bash.exe"}, - @{Name = "C:\shells\sh.exe"; Target = "C:\msys64\bin\sh.exe"}, - @{Name = "C:\shells\gitbash.exe"; Target = "$env:ProgramFiles\Git\bin\bash.exe"}, - @{Name = "C:\shells\msysbash.exe"; Target = "C:\msys64\usr\bin\bash.exe"} - ) - - $pathTestCases = @( - @{Path = "C:\shells"}, - @{Path = "C:\msys64\mingw64\bin"}, - @{Path = "C:\msys64\usr\bin"} - ) - - $IsWin16 = Test-IsWin16 - - It "Default bash.exe from MSYS2" { - (Get-Command bash).Path | Should -BeExactly "C:\shells\bash.exe" - } - - It "Default sh.exe from MSYS2" { - (Get-Command sh).Path | Should -BeExactly "C:\shells\sh.exe" - } - - It "Folder C:\shells exists" { - "C:\shells" | Should -Exist - } - - It "C:\Windows\System32 before C:\msys64\mingw64\bin and C:\msys64\usr\bin" { - $path = $env:Path.Split(";").ToLower() - $indexOfSystem32 = $path.IndexOf("c:\windows\system32") - - $path.IndexOf("c:\msys64\mingw64\bin") | Should -BeGreaterThan $indexOfSystem32 - $path.IndexOf("c:\msys64\usr\bin") | Should -BeGreaterThan $indexOfSystem32 - } - - It "C:\shells\winbash.exe target to $env:SystemRoot\System32\bash.exe" -Skip:$IsWin16 { - $Name = "C:\shells\winbash.exe" - $Target = "$env:SystemRoot\System32\bash.exe" - (Get-Item $Name).Target | Should -BeExactly $Target - } - - It " target to " -TestCases $shellTestCases { - (Get-Item $Name).Target | Should -BeExactly $Target - } - - It " is in PATH" -TestCases $pathTestCases { - $env:Path.Split(";") | Should -Contain $Path - } -} \ No newline at end of file diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index cbb0609a..a0024532 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -214,12 +214,6 @@ Describe "ServiceFabricSDK" { } } -Describe "yamllint" { - It "yamllint" { - "yamllint --version" | Should -ReturnZeroExitCode - } -} - Describe "Svn" { It "svn" { "svn --version --quiet" | Should -ReturnZeroExitCode @@ -269,3 +263,9 @@ Describe "Zstd" { "zstd -V" | Should -ReturnZeroExitCode } } + +Describe "Pipx" { + It "Pipx" { + "pipx --version" | Should -ReturnZeroExitCode + } +} diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index fef0a3fc..f5d30694 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -73,7 +73,6 @@ "platform" : "win32", "toolset": "msvc14.1", "versions": [ - "1.69.0", "1.72.0" ] } @@ -238,5 +237,11 @@ "mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2016", "microsoft/aspnetcore-build:1.0-2.0" ] - } + }, + "pipx": [ + { + "package": "yamllint", + "cmd": "yamllint --version" + } + ] } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index c76c9701..ebb7aa82 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -66,16 +66,6 @@ ], "default": "1.14.*" }, - { - "name": "Boost", - "url" : "https://raw.githubusercontent.com/actions/boost-versions/main/versions-manifest.json", - "arch": "x86_64", - "platform" : "win32", - "toolset": "msvc14.1", - "versions": [ - "1.69.0" - ] - }, { "name": "Boost", "url" : "https://raw.githubusercontent.com/actions/boost-versions/main/versions-manifest.json", @@ -290,5 +280,11 @@ "mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019", "microsoft/aspnetcore-build:1.0-2.0" ] - } + }, + "pipx": [ + { + "package": "yamllint", + "cmd": "yamllint --version" + } + ] } diff --git a/images/win/windows2016.json b/images/win/windows2016.json index 8c1314d6..120e7ac9 100644 --- a/images/win/windows2016.json +++ b/images/win/windows2016.json @@ -235,8 +235,9 @@ "{{ template_dir }}/scripts/Installers/Install-PyPy.ps1", "{{ template_dir }}/scripts/Installers/Install-Toolset.ps1", "{{ template_dir }}/scripts/Installers/Configure-Toolset.ps1", - "{{ template_dir }}/scripts/Installers/Install-YAMLLint.ps1", - "{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1" + "{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1", + "{{ template_dir }}/scripts/Installers/Install-Pipx.ps1", + "{{ template_dir }}/scripts/Installers/Install-PipxPackages.ps1" ] }, { @@ -332,8 +333,7 @@ "type": "powershell", "scripts": [ "{{ template_dir }}/scripts/Installers/Install-WindowsUpdates.ps1", - "{{ template_dir }}/scripts/Installers/Configure-DynamicPort.ps1", - "{{ template_dir }}/scripts/Installers/Configure-Shell.ps1" + "{{ template_dir }}/scripts/Installers/Configure-DynamicPort.ps1" ], "elevated_user": "{{user `install_user`}}", "elevated_password": "{{user `install_password`}}" diff --git a/images/win/windows2019.json b/images/win/windows2019.json index a002f77f..a27bf27d 100644 --- a/images/win/windows2019.json +++ b/images/win/windows2019.json @@ -249,9 +249,10 @@ "{{ template_dir }}/scripts/Installers/Install-PyPy.ps1", "{{ template_dir }}/scripts/Installers/Install-Toolset.ps1", "{{ template_dir }}/scripts/Installers/Configure-Toolset.ps1", - "{{ template_dir }}/scripts/Installers/Install-YAMLLint.ps1", "{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1", - "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1" + "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1", + "{{ template_dir }}/scripts/Installers/Install-Pipx.ps1", + "{{ template_dir }}/scripts/Installers/Install-PipxPackages.ps1" ] }, { @@ -330,8 +331,7 @@ "type": "powershell", "scripts": [ "{{ template_dir }}/scripts/Installers/Install-WindowsUpdates.ps1", - "{{ template_dir }}/scripts/Installers/Configure-DynamicPort.ps1", - "{{ template_dir }}/scripts/Installers/Configure-Shell.ps1" + "{{ template_dir }}/scripts/Installers/Configure-DynamicPort.ps1" ], "elevated_user": "{{user `install_user`}}", "elevated_password": "{{user `install_password`}}"