From bac163a71bdb60285e49158c0dc60ee54099d53e Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Tue, 29 Sep 2020 18:13:37 +0300 Subject: [PATCH 01/19] move mms provisioner scripts --- .../Add-SshHostKeys.ps1 | 4 ++ .../Create-Junction.ps1 | 30 ++++++++++++++ .../Remove-AzureRegistrySettings.ps1 | 9 +++++ .../Set-RunnerToolCache.ps1 | 14 +++++++ .../Update-VSConfiguration.ps1 | 4 ++ .../Update-WindowsPath.ps1 | 39 +++++++++++++++++++ 6 files changed, 100 insertions(+) create mode 100644 images/win/afterDeploymentActions/Add-SshHostKeys.ps1 create mode 100644 images/win/afterDeploymentActions/Create-Junction.ps1 create mode 100644 images/win/afterDeploymentActions/Remove-AzureRegistrySettings.ps1 create mode 100644 images/win/afterDeploymentActions/Set-RunnerToolCache.ps1 create mode 100644 images/win/afterDeploymentActions/Update-VSConfiguration.ps1 create mode 100644 images/win/afterDeploymentActions/Update-WindowsPath.ps1 diff --git a/images/win/afterDeploymentActions/Add-SshHostKeys.ps1 b/images/win/afterDeploymentActions/Add-SshHostKeys.ps1 new file mode 100644 index 000000000..2ddeb1310 --- /dev/null +++ b/images/win/afterDeploymentActions/Add-SshHostKeys.ps1 @@ -0,0 +1,4 @@ +# 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 dsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" \ No newline at end of file diff --git a/images/win/afterDeploymentActions/Create-Junction.ps1 b/images/win/afterDeploymentActions/Create-Junction.ps1 new file mode 100644 index 000000000..a41f0f0c5 --- /dev/null +++ b/images/win/afterDeploymentActions/Create-Junction.ps1 @@ -0,0 +1,30 @@ +# Create Rust junction points to cargo and rustup folder +$cargoTarget = "$env:USERPROFILE\.cargo" +if (-not (Test-Path $cargoTarget)) +{ + New-Item -ItemType Junction -Path $cargoTarget -Target "C:\Rust\.cargo" + + if (Test-Path $cargoTarget) + { + Write-Host "Junction created for $cargoTarget <<===>> C:\Rust\.cargo" + } + else + { + Write-Host "Junction was not created for $cargoTarget" + } +} + +$rustupTarget = "$env:USERPROFILE\.rustup" +if (-not (Test-Path $rustupTarget)) +{ + New-Item -ItemType Junction -Path $rustupTarget -Target "C:\Rust\.rustup" + + if (Test-Path $rustupTarget) + { + Write-Host "Junction created for $rustupTarget <<===>> C:\Rust\.rustup" + } + else + { + Write-Host "Junction was not created for $rustupTarget" + } +} \ No newline at end of file diff --git a/images/win/afterDeploymentActions/Remove-AzureRegistrySettings.ps1 b/images/win/afterDeploymentActions/Remove-AzureRegistrySettings.ps1 new file mode 100644 index 000000000..d59f5375f --- /dev/null +++ b/images/win/afterDeploymentActions/Remove-AzureRegistrySettings.ps1 @@ -0,0 +1,9 @@ +# Script to address any current issues with images that could be easily worked around. +$ErrorActionPreference="Stop" + +# Remove 3 registry settings that are left behind when sysprepping. Having those registry settings together with a +# race condition that kicks in when trying to run custom scripts extensions and stops us from reimaging machines. +# ICM: https://portal.microsofticm.com/imp/v3/incidents/details/191973270/home +Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'Incarnation' -Force -ErrorAction Ignore +Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'InVmSvdSeqNo' -Force -ErrorAction Ignore +Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'LastGoalStateMethod' -Force -ErrorAction Ignore diff --git a/images/win/afterDeploymentActions/Set-RunnerToolCache.ps1 b/images/win/afterDeploymentActions/Set-RunnerToolCache.ps1 new file mode 100644 index 000000000..3f11343ce --- /dev/null +++ b/images/win/afterDeploymentActions/Set-RunnerToolCache.ps1 @@ -0,0 +1,14 @@ +if ([string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE)) +{ + $env:RUNNER_TOOL_CACHE=$env:AGENT_TOOLSDIRECTORY + [System.Environment]::SetEnvironmentVariable('RUNNER_TOOL_CACHE', $env:AGENT_TOOLSDIRECTORY, [System.EnvironmentVariableTarget]::Machine) + Write-Host "RUNNER_TOOL_CACHE set to match AGENT_TOOLSDIRECTORY: $env:RUNNER_TOOL_CACHE" + + [System.Environment]::SetEnvironmentVariable('AGENT_TOOLSDIRECTORY', $null, [System.EnvironmentVariableTarget]::Machine) + $isAgentToolsDirectoryNotThere = [string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE) + Write-Host "AGENT_TOOLSDIRECTORY deleted: $isAgentToolsDirectoryNotThere" +} +else +{ + Write-Host "RUNNER_TOOL_CACHE non-empty: $env:RUNNER_TOOL_CACHE" +} diff --git a/images/win/afterDeploymentActions/Update-VSConfiguration.ps1 b/images/win/afterDeploymentActions/Update-VSConfiguration.ps1 new file mode 100644 index 000000000..0ff9d7bfb --- /dev/null +++ b/images/win/afterDeploymentActions/Update-VSConfiguration.ps1 @@ -0,0 +1,4 @@ +$vsInstallRoot = Get-VisualStudioPath +$devEnvPath = "$vsInstallRoot\Common7\IDE\devenv.exe" + +cmd.exe /c "`"$devEnvPath`" /updateconfiguration" \ No newline at end of file diff --git a/images/win/afterDeploymentActions/Update-WindowsPath.ps1 b/images/win/afterDeploymentActions/Update-WindowsPath.ps1 new file mode 100644 index 000000000..ef84a6e25 --- /dev/null +++ b/images/win/afterDeploymentActions/Update-WindowsPath.ps1 @@ -0,0 +1,39 @@ +$isPathUpdated = $false +$hgPath = "$Env:ProgramFiles\Mercurial\" +$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) + +if (Test-Path -Path $hgPath) +{ + $latestPath = "$hgPath;$latestPath" + Write-Host "Added Mercurial to PATH" + $isPathUpdated = $true +} +else +{ + Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it." +} + +$dotnetPath = "$env:USERPROFILE\.dotnet\tools" +if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools")) +{ + $latestPath = $latestPath.Replace("C:\Users\VssAdministrator\.dotnet\tools", "$dotnetPath") + $isPathUpdated = $true +} + +if (-not $latestPath.Contains($dotnetPath)) +{ + $latestPath = "$dotnetPath;$latestPath" + Write-Host "Added .dotnet\tools $dotnetPath to PATH" + $isPathUpdated = $true +} +else +{ + Write-Host "$dotnetPath already in PATH" +} + +if ($isPathUpdated) +{ + [System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine) +} +$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) +Write-Host "Windows PATH: $updatedPath" \ No newline at end of file From 94c7463a7f6af79d630ac981ce7e7ba318e9b0ef Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Tue, 29 Sep 2020 18:16:37 +0300 Subject: [PATCH 02/19] rename folder --- .../Add-SshHostKeys.ps1 | 0 .../Create-Junction.ps1 | 0 .../Remove-AzureRegistrySettings.ps1 | 0 .../Set-RunnerToolCache.ps1 | 0 .../Update-VSConfiguration.ps1 | 0 .../Update-WindowsPath.ps1 | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename images/win/{afterDeploymentActions => post-generation}/Add-SshHostKeys.ps1 (100%) rename images/win/{afterDeploymentActions => post-generation}/Create-Junction.ps1 (100%) rename images/win/{afterDeploymentActions => post-generation}/Remove-AzureRegistrySettings.ps1 (100%) rename images/win/{afterDeploymentActions => post-generation}/Set-RunnerToolCache.ps1 (100%) rename images/win/{afterDeploymentActions => post-generation}/Update-VSConfiguration.ps1 (100%) rename images/win/{afterDeploymentActions => post-generation}/Update-WindowsPath.ps1 (100%) diff --git a/images/win/afterDeploymentActions/Add-SshHostKeys.ps1 b/images/win/post-generation/Add-SshHostKeys.ps1 similarity index 100% rename from images/win/afterDeploymentActions/Add-SshHostKeys.ps1 rename to images/win/post-generation/Add-SshHostKeys.ps1 diff --git a/images/win/afterDeploymentActions/Create-Junction.ps1 b/images/win/post-generation/Create-Junction.ps1 similarity index 100% rename from images/win/afterDeploymentActions/Create-Junction.ps1 rename to images/win/post-generation/Create-Junction.ps1 diff --git a/images/win/afterDeploymentActions/Remove-AzureRegistrySettings.ps1 b/images/win/post-generation/Remove-AzureRegistrySettings.ps1 similarity index 100% rename from images/win/afterDeploymentActions/Remove-AzureRegistrySettings.ps1 rename to images/win/post-generation/Remove-AzureRegistrySettings.ps1 diff --git a/images/win/afterDeploymentActions/Set-RunnerToolCache.ps1 b/images/win/post-generation/Set-RunnerToolCache.ps1 similarity index 100% rename from images/win/afterDeploymentActions/Set-RunnerToolCache.ps1 rename to images/win/post-generation/Set-RunnerToolCache.ps1 diff --git a/images/win/afterDeploymentActions/Update-VSConfiguration.ps1 b/images/win/post-generation/Update-VSConfiguration.ps1 similarity index 100% rename from images/win/afterDeploymentActions/Update-VSConfiguration.ps1 rename to images/win/post-generation/Update-VSConfiguration.ps1 diff --git a/images/win/afterDeploymentActions/Update-WindowsPath.ps1 b/images/win/post-generation/Update-WindowsPath.ps1 similarity index 100% rename from images/win/afterDeploymentActions/Update-WindowsPath.ps1 rename to images/win/post-generation/Update-WindowsPath.ps1 From 85b60d074cd4e7106ea37b6de7b00b5d3ac3a3be Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Wed, 30 Sep 2020 12:34:36 +0300 Subject: [PATCH 03/19] resolve comments --- .../win/post-generation/Add-SshHostKeys.ps1 | 2 +- .../win/post-generation/Create-Junction.ps1 | 30 ------------------- .../post-generation/Create-RustJunction.ps1 | 12 ++++++++ .../Remove-AzureRegistrySettings.ps1 | 4 +-- .../post-generation/Set-RunnerToolCache.ps1 | 14 --------- ...-WindowsPath.ps1 => Update-DotnetPath.ps1} | 17 ----------- .../post-generation/Update-MercurialPath.ps1 | 16 ++++++++++ 7 files changed, 30 insertions(+), 65 deletions(-) delete mode 100644 images/win/post-generation/Create-Junction.ps1 create mode 100644 images/win/post-generation/Create-RustJunction.ps1 delete mode 100644 images/win/post-generation/Set-RunnerToolCache.ps1 rename images/win/post-generation/{Update-WindowsPath.ps1 => Update-DotnetPath.ps1} (61%) create mode 100644 images/win/post-generation/Update-MercurialPath.ps1 diff --git a/images/win/post-generation/Add-SshHostKeys.ps1 b/images/win/post-generation/Add-SshHostKeys.ps1 index 2ddeb1310..114a98d6a 100644 --- a/images/win/post-generation/Add-SshHostKeys.ps1 +++ b/images/win/post-generation/Add-SshHostKeys.ps1 @@ -1,4 +1,4 @@ # 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 dsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" \ No newline at end of file +ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" \ No newline at end of file diff --git a/images/win/post-generation/Create-Junction.ps1 b/images/win/post-generation/Create-Junction.ps1 deleted file mode 100644 index a41f0f0c5..000000000 --- a/images/win/post-generation/Create-Junction.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -# Create Rust junction points to cargo and rustup folder -$cargoTarget = "$env:USERPROFILE\.cargo" -if (-not (Test-Path $cargoTarget)) -{ - New-Item -ItemType Junction -Path $cargoTarget -Target "C:\Rust\.cargo" - - if (Test-Path $cargoTarget) - { - Write-Host "Junction created for $cargoTarget <<===>> C:\Rust\.cargo" - } - else - { - Write-Host "Junction was not created for $cargoTarget" - } -} - -$rustupTarget = "$env:USERPROFILE\.rustup" -if (-not (Test-Path $rustupTarget)) -{ - New-Item -ItemType Junction -Path $rustupTarget -Target "C:\Rust\.rustup" - - if (Test-Path $rustupTarget) - { - Write-Host "Junction created for $rustupTarget <<===>> C:\Rust\.rustup" - } - else - { - Write-Host "Junction was not created for $rustupTarget" - } -} \ No newline at end of file diff --git a/images/win/post-generation/Create-RustJunction.ps1 b/images/win/post-generation/Create-RustJunction.ps1 new file mode 100644 index 000000000..86f3fc106 --- /dev/null +++ b/images/win/post-generation/Create-RustJunction.ps1 @@ -0,0 +1,12 @@ +# Create Rust junction points to cargo and rustup folder +$cargoTarget = "$env:USERPROFILE\.cargo" +if (-not (Test-Path $cargoTarget)) +{ + New-Item -ItemType Junction -Path $cargoTarget -Target "C:\Rust\.cargo" +} + +$rustupTarget = "$env:USERPROFILE\.rustup" +if (-not (Test-Path $rustupTarget)) +{ + New-Item -ItemType Junction -Path $rustupTarget -Target "C:\Rust\.rustup" +} \ No newline at end of file diff --git a/images/win/post-generation/Remove-AzureRegistrySettings.ps1 b/images/win/post-generation/Remove-AzureRegistrySettings.ps1 index d59f5375f..e3a62d372 100644 --- a/images/win/post-generation/Remove-AzureRegistrySettings.ps1 +++ b/images/win/post-generation/Remove-AzureRegistrySettings.ps1 @@ -1,9 +1,7 @@ -# Script to address any current issues with images that could be easily worked around. $ErrorActionPreference="Stop" -# Remove 3 registry settings that are left behind when sysprepping. Having those registry settings together with a +# Remove 3 registry settings that are left behind when sysprepping. Having those registry settings together with a # race condition that kicks in when trying to run custom scripts extensions and stops us from reimaging machines. -# ICM: https://portal.microsofticm.com/imp/v3/incidents/details/191973270/home Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'Incarnation' -Force -ErrorAction Ignore Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'InVmSvdSeqNo' -Force -ErrorAction Ignore Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'LastGoalStateMethod' -Force -ErrorAction Ignore diff --git a/images/win/post-generation/Set-RunnerToolCache.ps1 b/images/win/post-generation/Set-RunnerToolCache.ps1 deleted file mode 100644 index 3f11343ce..000000000 --- a/images/win/post-generation/Set-RunnerToolCache.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -if ([string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE)) -{ - $env:RUNNER_TOOL_CACHE=$env:AGENT_TOOLSDIRECTORY - [System.Environment]::SetEnvironmentVariable('RUNNER_TOOL_CACHE', $env:AGENT_TOOLSDIRECTORY, [System.EnvironmentVariableTarget]::Machine) - Write-Host "RUNNER_TOOL_CACHE set to match AGENT_TOOLSDIRECTORY: $env:RUNNER_TOOL_CACHE" - - [System.Environment]::SetEnvironmentVariable('AGENT_TOOLSDIRECTORY', $null, [System.EnvironmentVariableTarget]::Machine) - $isAgentToolsDirectoryNotThere = [string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE) - Write-Host "AGENT_TOOLSDIRECTORY deleted: $isAgentToolsDirectoryNotThere" -} -else -{ - Write-Host "RUNNER_TOOL_CACHE non-empty: $env:RUNNER_TOOL_CACHE" -} diff --git a/images/win/post-generation/Update-WindowsPath.ps1 b/images/win/post-generation/Update-DotnetPath.ps1 similarity index 61% rename from images/win/post-generation/Update-WindowsPath.ps1 rename to images/win/post-generation/Update-DotnetPath.ps1 index ef84a6e25..c051ebd4a 100644 --- a/images/win/post-generation/Update-WindowsPath.ps1 +++ b/images/win/post-generation/Update-DotnetPath.ps1 @@ -1,18 +1,5 @@ -$isPathUpdated = $false -$hgPath = "$Env:ProgramFiles\Mercurial\" $latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) -if (Test-Path -Path $hgPath) -{ - $latestPath = "$hgPath;$latestPath" - Write-Host "Added Mercurial to PATH" - $isPathUpdated = $true -} -else -{ - Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it." -} - $dotnetPath = "$env:USERPROFILE\.dotnet\tools" if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools")) { @@ -31,9 +18,5 @@ else Write-Host "$dotnetPath already in PATH" } -if ($isPathUpdated) -{ - [System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine) -} $updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) Write-Host "Windows PATH: $updatedPath" \ No newline at end of file diff --git a/images/win/post-generation/Update-MercurialPath.ps1 b/images/win/post-generation/Update-MercurialPath.ps1 new file mode 100644 index 000000000..de68e1812 --- /dev/null +++ b/images/win/post-generation/Update-MercurialPath.ps1 @@ -0,0 +1,16 @@ +$hgPath = "$Env:ProgramFiles\Mercurial\" +$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) + +if (Test-Path -Path $hgPath) +{ + $latestPath = "$hgPath;$latestPath" + Write-Host "Added Mercurial to PATH" + $isPathUpdated = $true +} +else +{ + Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it." +} + +$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) +Write-Host "Windows PATH: $updatedPath" \ No newline at end of file From 56633cec4a6ad6c1eb0e4755e8d47b7c4eda31b2 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Wed, 30 Sep 2020 20:13:40 +0300 Subject: [PATCH 04/19] refactor and rename scripts --- ...trySettings.ps1 => AzureRegistrySettings.ps1} | 0 .../{Update-DotnetPath.ps1 => DotnetPath.ps1} | 12 +----------- images/win/post-generation/MercurialPath.ps1 | 8 ++++++++ ...{Create-RustJunction.ps1 => RustJunction.ps1} | 0 .../{Add-SshHostKeys.ps1 => SshHostKeys.ps1} | 0 .../win/post-generation/Update-MercurialPath.ps1 | 16 ---------------- ...e-VSConfiguration.ps1 => VSConfiguration.ps1} | 0 7 files changed, 9 insertions(+), 27 deletions(-) rename images/win/post-generation/{Remove-AzureRegistrySettings.ps1 => AzureRegistrySettings.ps1} (100%) rename images/win/post-generation/{Update-DotnetPath.ps1 => DotnetPath.ps1} (55%) create mode 100644 images/win/post-generation/MercurialPath.ps1 rename images/win/post-generation/{Create-RustJunction.ps1 => RustJunction.ps1} (100%) rename images/win/post-generation/{Add-SshHostKeys.ps1 => SshHostKeys.ps1} (100%) delete mode 100644 images/win/post-generation/Update-MercurialPath.ps1 rename images/win/post-generation/{Update-VSConfiguration.ps1 => VSConfiguration.ps1} (100%) diff --git a/images/win/post-generation/Remove-AzureRegistrySettings.ps1 b/images/win/post-generation/AzureRegistrySettings.ps1 similarity index 100% rename from images/win/post-generation/Remove-AzureRegistrySettings.ps1 rename to images/win/post-generation/AzureRegistrySettings.ps1 diff --git a/images/win/post-generation/Update-DotnetPath.ps1 b/images/win/post-generation/DotnetPath.ps1 similarity index 55% rename from images/win/post-generation/Update-DotnetPath.ps1 rename to images/win/post-generation/DotnetPath.ps1 index c051ebd4a..ea5a2de5a 100644 --- a/images/win/post-generation/Update-DotnetPath.ps1 +++ b/images/win/post-generation/DotnetPath.ps1 @@ -4,19 +4,9 @@ $dotnetPath = "$env:USERPROFILE\.dotnet\tools" if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools")) { $latestPath = $latestPath.Replace("C:\Users\VssAdministrator\.dotnet\tools", "$dotnetPath") - $isPathUpdated = $true } if (-not $latestPath.Contains($dotnetPath)) { $latestPath = "$dotnetPath;$latestPath" - Write-Host "Added .dotnet\tools $dotnetPath to PATH" - $isPathUpdated = $true -} -else -{ - Write-Host "$dotnetPath already in PATH" -} - -$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) -Write-Host "Windows PATH: $updatedPath" \ No newline at end of file +} \ No newline at end of file diff --git a/images/win/post-generation/MercurialPath.ps1 b/images/win/post-generation/MercurialPath.ps1 new file mode 100644 index 000000000..7847d7142 --- /dev/null +++ b/images/win/post-generation/MercurialPath.ps1 @@ -0,0 +1,8 @@ +$hgPath = "$Env:ProgramFiles\Mercurial\" +$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) + +if (Test-Path -Path $hgPath) +{ + $latestPath = "$hgPath;$latestPath" + Write-Host "Added Mercurial to PATH" +} diff --git a/images/win/post-generation/Create-RustJunction.ps1 b/images/win/post-generation/RustJunction.ps1 similarity index 100% rename from images/win/post-generation/Create-RustJunction.ps1 rename to images/win/post-generation/RustJunction.ps1 diff --git a/images/win/post-generation/Add-SshHostKeys.ps1 b/images/win/post-generation/SshHostKeys.ps1 similarity index 100% rename from images/win/post-generation/Add-SshHostKeys.ps1 rename to images/win/post-generation/SshHostKeys.ps1 diff --git a/images/win/post-generation/Update-MercurialPath.ps1 b/images/win/post-generation/Update-MercurialPath.ps1 deleted file mode 100644 index de68e1812..000000000 --- a/images/win/post-generation/Update-MercurialPath.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -$hgPath = "$Env:ProgramFiles\Mercurial\" -$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) - -if (Test-Path -Path $hgPath) -{ - $latestPath = "$hgPath;$latestPath" - Write-Host "Added Mercurial to PATH" - $isPathUpdated = $true -} -else -{ - Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it." -} - -$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) -Write-Host "Windows PATH: $updatedPath" \ No newline at end of file diff --git a/images/win/post-generation/Update-VSConfiguration.ps1 b/images/win/post-generation/VSConfiguration.ps1 similarity index 100% rename from images/win/post-generation/Update-VSConfiguration.ps1 rename to images/win/post-generation/VSConfiguration.ps1 From 91ee0cc2682fcc58b746667164239c906c9293a7 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Thu, 1 Oct 2020 10:48:50 +0300 Subject: [PATCH 05/19] rename and remove scripts --- images/win/post-generation/AzureRegistrySettings.ps1 | 7 ------- images/win/post-generation/{DotnetPath.ps1 => Dotnet.ps1} | 0 images/win/post-generation/MercurialPath.ps1 | 8 -------- 3 files changed, 15 deletions(-) delete mode 100644 images/win/post-generation/AzureRegistrySettings.ps1 rename images/win/post-generation/{DotnetPath.ps1 => Dotnet.ps1} (100%) delete mode 100644 images/win/post-generation/MercurialPath.ps1 diff --git a/images/win/post-generation/AzureRegistrySettings.ps1 b/images/win/post-generation/AzureRegistrySettings.ps1 deleted file mode 100644 index e3a62d372..000000000 --- a/images/win/post-generation/AzureRegistrySettings.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -$ErrorActionPreference="Stop" - -# Remove 3 registry settings that are left behind when sysprepping. Having those registry settings together with a -# race condition that kicks in when trying to run custom scripts extensions and stops us from reimaging machines. -Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'Incarnation' -Force -ErrorAction Ignore -Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'InVmSvdSeqNo' -Force -ErrorAction Ignore -Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'LastGoalStateMethod' -Force -ErrorAction Ignore diff --git a/images/win/post-generation/DotnetPath.ps1 b/images/win/post-generation/Dotnet.ps1 similarity index 100% rename from images/win/post-generation/DotnetPath.ps1 rename to images/win/post-generation/Dotnet.ps1 diff --git a/images/win/post-generation/MercurialPath.ps1 b/images/win/post-generation/MercurialPath.ps1 deleted file mode 100644 index 7847d7142..000000000 --- a/images/win/post-generation/MercurialPath.ps1 +++ /dev/null @@ -1,8 +0,0 @@ -$hgPath = "$Env:ProgramFiles\Mercurial\" -$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) - -if (Test-Path -Path $hgPath) -{ - $latestPath = "$hgPath;$latestPath" - Write-Host "Added Mercurial to PATH" -} From c101287fd83cc310e38f6d19d3a9547324882373 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Thu, 1 Oct 2020 11:41:42 +0300 Subject: [PATCH 06/19] rework dotnet script --- images/win/post-generation/Dotnet.ps1 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/images/win/post-generation/Dotnet.ps1 b/images/win/post-generation/Dotnet.ps1 index ea5a2de5a..5f38eaec8 100644 --- a/images/win/post-generation/Dotnet.ps1 +++ b/images/win/post-generation/Dotnet.ps1 @@ -1,12 +1,9 @@ $latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) - $dotnetPath = "$env:USERPROFILE\.dotnet\tools" -if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools")) -{ - $latestPath = $latestPath.Replace("C:\Users\VssAdministrator\.dotnet\tools", "$dotnetPath") -} if (-not $latestPath.Contains($dotnetPath)) { $latestPath = "$dotnetPath;$latestPath" -} \ No newline at end of file +} + +[System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine) \ No newline at end of file From fb82e1197aef8a52f10d3762019f4b46d2213449 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Thu, 1 Oct 2020 11:52:39 +0300 Subject: [PATCH 07/19] add scripts to templates --- images/win/Windows2016-Azure.json | 5 +++++ images/win/Windows2019-Azure.json | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 77d57aef1..4c8111bed 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -82,6 +82,11 @@ "source": "{{ template_dir }}/scripts/SoftwareReport", "destination": "{{user `image_folder`}}" }, + { + "type": "file", + "source": "{{ template_dir }}/post-generation", + "destination": "{{user `image_folder`}}" + }, { "type": "file", "source": "{{ template_dir }}/scripts/Tests", diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 473051dba..fe47bd64e 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -82,6 +82,11 @@ "source": "{{ template_dir }}/scripts/SoftwareReport", "destination": "{{user `image_folder`}}" }, + { + "type": "file", + "source": "{{ template_dir }}/post-generation", + "destination": "{{user `image_folder`}}" + }, { "type": "file", "source": "{{ template_dir }}/scripts/Tests", From 3a2c8bc0b966a5ea6a4c2982118e2acdac9422eb Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Thu, 1 Oct 2020 12:28:33 +0300 Subject: [PATCH 08/19] change destination --- images/win/Windows2016-Azure.json | 2 +- images/win/Windows2019-Azure.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 4c8111bed..a0edde4bc 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -85,7 +85,7 @@ { "type": "file", "source": "{{ template_dir }}/post-generation", - "destination": "{{user `image_folder`}}" + "destination": "C:/post-generation" }, { "type": "file", diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index fe47bd64e..6f0759e18 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -85,7 +85,7 @@ { "type": "file", "source": "{{ template_dir }}/post-generation", - "destination": "{{user `image_folder`}}" + "destination": "C:/post-generation" }, { "type": "file", From 29300ce6eb3db1b5071d8c1f51b84c0ab18bbe9e Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Thu, 1 Oct 2020 12:43:21 +0300 Subject: [PATCH 09/19] minor change --- images/win/post-generation/Dotnet.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/images/win/post-generation/Dotnet.ps1 b/images/win/post-generation/Dotnet.ps1 index 5f38eaec8..fd43757a6 100644 --- a/images/win/post-generation/Dotnet.ps1 +++ b/images/win/post-generation/Dotnet.ps1 @@ -4,6 +4,5 @@ $dotnetPath = "$env:USERPROFILE\.dotnet\tools" if (-not $latestPath.Contains($dotnetPath)) { $latestPath = "$dotnetPath;$latestPath" -} - -[System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine) \ No newline at end of file + [System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine) +} \ No newline at end of file From da68de0a0932dbaf6f7cac642d38a68af2e66618 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Thu, 1 Oct 2020 13:11:30 +0300 Subject: [PATCH 10/19] Implement logic to check if xcode is beta --- images/macos/helpers/Xcode.Helpers.psm1 | 10 +++++++++- images/macos/software-report/SoftwareReport.Xcode.psm1 | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/images/macos/helpers/Xcode.Helpers.psm1 b/images/macos/helpers/Xcode.Helpers.psm1 index dbc4803c2..c4a5ca70e 100644 --- a/images/macos/helpers/Xcode.Helpers.psm1 +++ b/images/macos/helpers/Xcode.Helpers.psm1 @@ -45,6 +45,14 @@ function Switch-Xcode { Invoke-Expression "sudo xcode-select --switch ${XcodeRootPath}" } +function Test-XcodeStableRelease { + param([string] $XcodeRootPath) + + $licenseInfoPlistPath = Join-Path $XcodeRootPath "Contents" "Resources" "LicenseInfo.plist" + $releaseType = & defaults read $licenseInfoPlistPath "licenseType" + return -not ($releaseType -match "beta") +} + function Get-XcodeSimulatorsInfo { param( [string] $Filter @@ -102,6 +110,6 @@ function Test-XcodeStableVersion { if ($Version -match "GM") { return $false } - + return $true } \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Xcode.psm1 b/images/macos/software-report/SoftwareReport.Xcode.psm1 index 59754d583..3d4cfa52d 100644 --- a/images/macos/software-report/SoftwareReport.Xcode.psm1 +++ b/images/macos/software-report/SoftwareReport.Xcode.psm1 @@ -46,7 +46,8 @@ function Get-XcodeInfoList { $versionInfo = Get-XcodeVersionInfo $versionInfo.Path = $xcodeRootPath $versionInfo.IsDefault = ($xcodeRootPath -eq $defaultXcodeRootPath) - + $versionInfo.IsStable = Test-XcodeStableRelease -XcodeRootPath $xcodeRootPath + $xcodeInfo.Add($xcodeRootPath, [PSCustomObject] @{ VersionInfo = $versionInfo SDKInfo = Get-XcodeSDKList @@ -91,6 +92,7 @@ function Build-XcodeTable { $xcodeList = $xcodeInfo.Values | ForEach-Object { $_.VersionInfo } | Sort-Object $sortRules return $xcodeList | ForEach-Object { $defaultPostfix = If ($_.IsDefault) { " (default)" } else { "" } + $betaPostfix = If ($_.IsStable) { "" } else { " (beta)" } return [PSCustomObject] @{ "Version" = $_.Version.ToString() + $betaPostfix + $defaultPostfix "Build" = $_.Build From ed9705b7fd2ccb8870b8f613910c08d437d29d70 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Thu, 1 Oct 2020 14:53:27 +0300 Subject: [PATCH 11/19] move ssh host key creation to install-git.ps1 --- images/win/post-generation/SshHostKeys.ps1 | 4 ---- images/win/scripts/Installers/Install-Git.ps1 | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 images/win/post-generation/SshHostKeys.ps1 diff --git a/images/win/post-generation/SshHostKeys.ps1 b/images/win/post-generation/SshHostKeys.ps1 deleted file mode 100644 index 114a98d6a..000000000 --- a/images/win/post-generation/SshHostKeys.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -# 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" \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 2a5ea9259..16b7ac15e 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -40,5 +40,10 @@ Choco-Install -PackageName hub Add-MachinePathItem "C:\Program Files\Git\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" From fc8383a81ea4c0b8a65e530c5195af7f111ff8e2 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Fri, 2 Oct 2020 08:05:11 +0300 Subject: [PATCH 12/19] Update Xcode.Helpers.psm1 --- images/macos/helpers/Xcode.Helpers.psm1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/images/macos/helpers/Xcode.Helpers.psm1 b/images/macos/helpers/Xcode.Helpers.psm1 index c4a5ca70e..8ea137e63 100644 --- a/images/macos/helpers/Xcode.Helpers.psm1 +++ b/images/macos/helpers/Xcode.Helpers.psm1 @@ -46,7 +46,10 @@ function Switch-Xcode { } function Test-XcodeStableRelease { - param([string] $XcodeRootPath) + param( + [Parameter(Mandatory)] + [string] $XcodeRootPath + ) $licenseInfoPlistPath = Join-Path $XcodeRootPath "Contents" "Resources" "LicenseInfo.plist" $releaseType = & defaults read $licenseInfoPlistPath "licenseType" From 0cd68997b622901015cc668d235e2318c386349b Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Fri, 2 Oct 2020 10:59:05 +0300 Subject: [PATCH 13/19] $ErrorActionPreference='Stop' for AllUsersAllHosts --- images/win/scripts/Installers/Configure-Toolset.ps1 | 2 -- images/win/scripts/Installers/Finalize-VM.ps1 | 5 ++--- images/win/scripts/Installers/Initialize-VM.ps1 | 3 +++ images/win/scripts/Installers/Install-AzureModules.ps1 | 2 -- images/win/scripts/Installers/Install-PHP.ps1 | 2 -- images/win/scripts/Installers/Install-PostgreSQL.ps1 | 2 -- images/win/scripts/Installers/Install-PowerShellModules.ps1 | 2 -- images/win/scripts/Installers/Install-PyPy.ps1 | 1 - images/win/scripts/Installers/Install-Sbt.ps1 | 2 -- images/win/scripts/Installers/Install-Toolset.ps1 | 2 -- images/win/scripts/Installers/Install-VS.ps1 | 2 -- images/win/scripts/Installers/Install-Vsix.ps1 | 2 -- images/win/scripts/Installers/Update-AndroidSDK.ps1 | 2 -- .../win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 | 2 -- 14 files changed, 5 insertions(+), 26 deletions(-) diff --git a/images/win/scripts/Installers/Configure-Toolset.ps1 b/images/win/scripts/Installers/Configure-Toolset.ps1 index a4fdba1f0..d83ea5c42 100644 --- a/images/win/scripts/Installers/Configure-Toolset.ps1 +++ b/images/win/scripts/Installers/Configure-Toolset.ps1 @@ -27,8 +27,6 @@ Function Set-DefaultVariables } } -$ErrorActionPreference = "Stop" - Import-Module -Name ImageHelpers -Force -DisableNameChecking # Define executables for cached tools diff --git a/images/win/scripts/Installers/Finalize-VM.ps1 b/images/win/scripts/Installers/Finalize-VM.ps1 index ab9e7080b..4e7a260c4 100644 --- a/images/win/scripts/Installers/Finalize-VM.ps1 +++ b/images/win/scripts/Installers/Finalize-VM.ps1 @@ -6,8 +6,6 @@ Write-Host "Cleanup WinSxS" Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase -$ErrorActionPreference = 'silentlycontinue' - Write-Host "Clean up various directories" @( "C:\\Recovery", @@ -30,4 +28,5 @@ Write-Host "Clean up various directories" $winInstallDir = "$env:windir\\Installer" New-Item -Path $winInstallDir -ItemType Directory -Force -$ErrorActionPreference = 'Continue' +# Remove AllUsersAllHosts profile +Remove-Item $profile.AllUsersAllHosts -Force diff --git a/images/win/scripts/Installers/Initialize-VM.ps1 b/images/win/scripts/Installers/Initialize-VM.ps1 index bd4619caa..ad853bb74 100644 --- a/images/win/scripts/Installers/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Initialize-VM.ps1 @@ -30,6 +30,9 @@ function Disable-UserAccessControl { Write-Host "User Access Control (UAC) has been disabled." } +# Enable $ErrorActionPreference='Stop' for AllUsersAllHosts +Add-Content -Path $profile.AllUsersAllHosts -Value '$ErrorActionPreference="Stop"' + # Set TLS1.2 [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" diff --git a/images/win/scripts/Installers/Install-AzureModules.ps1 b/images/win/scripts/Installers/Install-AzureModules.ps1 index d03100bd3..a12dec60c 100644 --- a/images/win/scripts/Installers/Install-AzureModules.ps1 +++ b/images/win/scripts/Installers/Install-AzureModules.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Azure PowerShell modules ################################################################################ -$ErrorActionPreference = "Stop" - # The correct Modules need to be saved in C:\Modules $installPSModulePath = $env:PSMODULES_ROOT_FOLDER if (-not (Test-Path -LiteralPath $installPSModulePath)) diff --git a/images/win/scripts/Installers/Install-PHP.ps1 b/images/win/scripts/Installers/Install-PHP.ps1 index a51c0e276..f629af21a 100644 --- a/images/win/scripts/Installers/Install-PHP.ps1 +++ b/images/win/scripts/Installers/Install-PHP.ps1 @@ -2,8 +2,6 @@ ## File: Install-PHP.ps1 ## Desc: Install PHP ################################################################################ -$ErrorActionPreference = "Stop" - Import-Module -Name ImageHelpers # Install latest PHP in chocolatey diff --git a/images/win/scripts/Installers/Install-PostgreSQL.ps1 b/images/win/scripts/Installers/Install-PostgreSQL.ps1 index 7d46d43ec..0f88bb7f4 100644 --- a/images/win/scripts/Installers/Install-PostgreSQL.ps1 +++ b/images/win/scripts/Installers/Install-PostgreSQL.ps1 @@ -1,5 +1,3 @@ -$ErrorActionPreference = "Stop" - #Define user and password for PostgreSQL database $pgUser = "postgres" $pgPwd = "root" diff --git a/images/win/scripts/Installers/Install-PowerShellModules.ps1 b/images/win/scripts/Installers/Install-PowerShellModules.ps1 index f6cb22d03..f0afb9e6c 100644 --- a/images/win/scripts/Installers/Install-PowerShellModules.ps1 +++ b/images/win/scripts/Installers/Install-PowerShellModules.ps1 @@ -1,5 +1,3 @@ -$ErrorActionPreference = "Stop" - # Set TLS1.2 [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" diff --git a/images/win/scripts/Installers/Install-PyPy.ps1 b/images/win/scripts/Installers/Install-PyPy.ps1 index af1b11820..01739ddaa 100644 --- a/images/win/scripts/Installers/Install-PyPy.ps1 +++ b/images/win/scripts/Installers/Install-PyPy.ps1 @@ -82,7 +82,6 @@ function Install-PyPy } } -$ErrorActionPreference = "Stop" Import-Module -Name ImageHelpers -Force -DisableNameChecking # Get PyPy content from toolset diff --git a/images/win/scripts/Installers/Install-Sbt.ps1 b/images/win/scripts/Installers/Install-Sbt.ps1 index fc8b6a509..1be6d234a 100644 --- a/images/win/scripts/Installers/Install-Sbt.ps1 +++ b/images/win/scripts/Installers/Install-Sbt.ps1 @@ -2,8 +2,6 @@ ## File: Install-Sbt.ps1 ## Desc: Install sbt for Windows ################################################################################ -$ErrorActionPreference = "Stop" - Import-Module -Name ImageHelpers # Install the latest version of sbt. diff --git a/images/win/scripts/Installers/Install-Toolset.ps1 b/images/win/scripts/Installers/Install-Toolset.ps1 index 42cdbaf25..d3aaba785 100644 --- a/images/win/scripts/Installers/Install-Toolset.ps1 +++ b/images/win/scripts/Installers/Install-Toolset.ps1 @@ -29,8 +29,6 @@ Function Install-Asset { Pop-Location } -$ErrorActionPreference = "Stop" - Import-Module -Name ImageHelpers -Force # Get toolcache content from toolset diff --git a/images/win/scripts/Installers/Install-VS.ps1 b/images/win/scripts/Installers/Install-VS.ps1 index ed4fca73f..4c1ce9528 100644 --- a/images/win/scripts/Installers/Install-VS.ps1 +++ b/images/win/scripts/Installers/Install-VS.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Visual Studio ################################################################################ -$ErrorActionPreference = "Stop" - $toolset = Get-ToolsetContent $requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" } $workLoads = @( diff --git a/images/win/scripts/Installers/Install-Vsix.ps1 b/images/win/scripts/Installers/Install-Vsix.ps1 index 4e6062a28..628b643b2 100644 --- a/images/win/scripts/Installers/Install-Vsix.ps1 +++ b/images/win/scripts/Installers/Install-Vsix.ps1 @@ -3,8 +3,6 @@ ## Desc: Install the Visual Studio Extensions from toolset.json ################################################################################### -$ErrorActionPreference = "Stop" - $toolset = Get-ToolsetContent $vsixPackagesList = $toolset.visualStudio.vsix if (-not $vsixPackagesList) { diff --git a/images/win/scripts/Installers/Update-AndroidSDK.ps1 b/images/win/scripts/Installers/Update-AndroidSDK.ps1 index c27a4c18c..a6a201311 100644 --- a/images/win/scripts/Installers/Update-AndroidSDK.ps1 +++ b/images/win/scripts/Installers/Update-AndroidSDK.ps1 @@ -3,8 +3,6 @@ ## Desc: Install and update Android SDK and tools ################################################################################ -$ErrorActionPreference = "Stop" - # Install the standard Android SDK licenses. In the past, there wasn't a better way to do this, # so we are base64-encoding a zip of the licenses directory from another installation. # To create this base64 string, create a zip file that contains nothing but a 'licenses' folder, diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 2f45ecde1..28a07dce9 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -1,5 +1,3 @@ -$ErrorActionPreference = "Stop" - Import-Module MarkdownPS Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking From 64b2205f5c384a38309f80c4a1812941fd4789c8 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Fri, 2 Oct 2020 11:37:55 +0300 Subject: [PATCH 14/19] TOOLSET_JSON_PATH Update-DockerImages.ps1" --- images/win/Windows2016-Azure.json | 7 +------ images/win/Windows2019-Azure.json | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 77d57aef1..34c1abcb3 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -160,12 +160,6 @@ "type": "windows-restart", "restart_timeout": "30m" }, - { - "type": "powershell", - "scripts": [ - "{{ template_dir }}/scripts/Installers/Update-DockerImages.ps1" - ] - }, { "type": "powershell", "valid_exit_codes": [ @@ -176,6 +170,7 @@ "TOOLSET_JSON_PATH={{user `toolset_json_path`}}" ], "scripts": [ + "{{ template_dir }}/scripts/Installers/Update-DockerImages.ps1", "{{ template_dir }}/scripts/Installers/Install-VS.ps1", "{{ template_dir }}/scripts/Installers/Install-NET48.ps1", "{{ template_dir }}/scripts/Installers/Windows2016/Install-SSDT.ps1" diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 473051dba..1d061fd1d 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -168,12 +168,6 @@ "type": "windows-restart", "restart_timeout": "10m" }, - { - "type": "powershell", - "scripts": [ - "{{ template_dir }}/scripts/Installers/Update-DockerImages.ps1" - ] - }, { "type": "powershell", "valid_exit_codes": [ @@ -184,6 +178,7 @@ "TOOLSET_JSON_PATH={{user `toolset_json_path`}}" ], "scripts": [ + "{{ template_dir }}/scripts/Installers/Update-DockerImages.ps1", "{{ template_dir }}/scripts/Installers/Install-VS.ps1", "{{ template_dir }}/scripts/Installers/Install-NET48.ps1" ], From 4ef13d58ee37ba0427b46e3cd8486664f5ee7cf7 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 5 Oct 2020 09:17:49 +0300 Subject: [PATCH 15/19] remove import ImageHelpers module --- images/win/scripts/Installers/Configure-Toolset.ps1 | 2 -- images/win/scripts/Installers/Download-ToolCache.ps1 | 2 -- .../win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 | 2 -- images/win/scripts/Installers/Install-Chrome.ps1 | 2 -- images/win/scripts/Installers/Install-CloudFoundryCli.ps1 | 2 -- images/win/scripts/Installers/Install-DACFx.ps1 | 2 -- images/win/scripts/Installers/Install-Firefox.ps1 | 2 -- images/win/scripts/Installers/Install-Git.ps1 | 2 -- images/win/scripts/Installers/Install-JavaTools.ps1 | 2 -- images/win/scripts/Installers/Install-Miniconda.ps1 | 2 -- images/win/scripts/Installers/Install-NET48.ps1 | 2 -- images/win/scripts/Installers/Install-NodeLts.ps1 | 2 -- images/win/scripts/Installers/Install-PHP.ps1 | 1 - images/win/scripts/Installers/Install-PyPy.ps1 | 2 -- images/win/scripts/Installers/Install-Rust.ps1 | 2 -- images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 | 2 -- images/win/scripts/Installers/Install-Sbt.ps1 | 1 - images/win/scripts/Installers/Install-Selenium.ps1 | 2 -- images/win/scripts/Installers/Install-Toolset.ps1 | 2 -- images/win/scripts/Installers/Install-Vcpkg.ps1 | 2 -- images/win/scripts/Installers/Install-WDK.ps1 | 3 --- images/win/scripts/Installers/Install-WinAppDriver.ps1 | 2 -- images/win/scripts/Installers/Install-Wix.ps1 | 2 -- images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 | 2 -- images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 | 2 -- 25 files changed, 49 deletions(-) diff --git a/images/win/scripts/Installers/Configure-Toolset.ps1 b/images/win/scripts/Installers/Configure-Toolset.ps1 index d83ea5c42..9e067ade2 100644 --- a/images/win/scripts/Installers/Configure-Toolset.ps1 +++ b/images/win/scripts/Installers/Configure-Toolset.ps1 @@ -27,8 +27,6 @@ Function Set-DefaultVariables } } -Import-Module -Name ImageHelpers -Force -DisableNameChecking - # Define executables for cached tools $toolsEnvironmentVariables = @{ Python = @{ diff --git a/images/win/scripts/Installers/Download-ToolCache.ps1 b/images/win/scripts/Installers/Download-ToolCache.ps1 index 6c93e3804..8656fb6a7 100644 --- a/images/win/scripts/Installers/Download-ToolCache.ps1 +++ b/images/win/scripts/Installers/Download-ToolCache.ps1 @@ -62,8 +62,6 @@ Function Set-DefaultRubyVersion { Invoke-Expression "gem update --system" } -Import-Module -Name ImageHelpers -Force - $FeedPrefix = "https://npm.pkg.github.com" $AccessToken = $env:GITHUB_FEED_TOKEN diff --git a/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 b/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 index 52c99f267..ba7922a73 100644 --- a/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 +++ b/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Azure CosmosDb Emulator #################################################################################### -Import-Module -Name ImageHelpers -Force - $InstallerName = "AzureCosmosDBEmulator.msi" $InstallerUrl = "https://aka.ms/cosmosdb-emulator" diff --git a/images/win/scripts/Installers/Install-Chrome.ps1 b/images/win/scripts/Installers/Install-Chrome.ps1 index 5e1d6ae48..790ec09f0 100644 --- a/images/win/scripts/Installers/Install-Chrome.ps1 +++ b/images/win/scripts/Installers/Install-Chrome.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Google Chrome ################################################################################ -Import-Module -Name ImageHelpers -Force - # Download and install latest Chrome browser $ChromeInstallerFile = "chrome_installer.exe" $ChromeInstallerUrl = "https://dl.google.com/chrome/install/375.126/${ChromeInstallerFile}" diff --git a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 index 65831bd7d..2bc7e4b0d 100644 --- a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 +++ b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Cloud Foundry CLI ################################################################################ -Import-Module -Name ImageHelpers - # Download the latest cf cli exe $CloudFoundryCliName = "cf-cli.zip" $CloudFoundryCliUrl = "https://packages.cloudfoundry.org/stable?release=windows64-exe&source=github" diff --git a/images/win/scripts/Installers/Install-DACFx.ps1 b/images/win/scripts/Installers/Install-DACFx.ps1 index fb50af0d9..2160b1dcc 100644 --- a/images/win/scripts/Installers/Install-DACFx.ps1 +++ b/images/win/scripts/Installers/Install-DACFx.ps1 @@ -3,8 +3,6 @@ ## Desc: Install SQL ServerĀ® Data-Tier Application Framework (DACFx) for Windows #################################################################################### -Import-Module -Name ImageHelpers -Force - $InstallerName = "DacFramework.msi" $InstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2134206" diff --git a/images/win/scripts/Installers/Install-Firefox.ps1 b/images/win/scripts/Installers/Install-Firefox.ps1 index 979a7b4b4..f66a72e1b 100644 --- a/images/win/scripts/Installers/Install-Firefox.ps1 +++ b/images/win/scripts/Installers/Install-Firefox.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Mozilla Firefox ################################################################################ -Import-Module -Name ImageHelpers -Force - # Install and configure Firefox browser Write-Host "Install latest Firefox browser..." $VersionsManifest = Invoke-RestMethod "https://product-details.mozilla.org/1.0/firefox_versions.json" diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 2a5ea9259..32de0e644 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Git for Windows ################################################################################ -Import-Module -Name ImageHelpers - function getSimpleValue([string] $url, [string] $filename ) { $fullpath = "${env:Temp}\$filename" Invoke-WebRequest -Uri $url -OutFile $fullpath diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 index 04a56a914..4852f64c1 100644 --- a/images/win/scripts/Installers/Install-JavaTools.ps1 +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -3,8 +3,6 @@ ## Desc: Install various JDKs and java tools ################################################################################ -Import-Module -Name ImageHelpers -Force - function Set-JavaPath { param ( [string] $Version, diff --git a/images/win/scripts/Installers/Install-Miniconda.ps1 b/images/win/scripts/Installers/Install-Miniconda.ps1 index 6f716b509..0b2f59c88 100644 --- a/images/win/scripts/Installers/Install-Miniconda.ps1 +++ b/images/win/scripts/Installers/Install-Miniconda.ps1 @@ -3,8 +3,6 @@ ## Desc: Install the latest version of Miniconda and set $env:CONDA ################################################################################ -Import-Module -Name ImageHelpers -Force - $CondaDestination = "C:\Miniconda" # Lock to Miniconda 4.6 until we do the work to run `conda init` for the vsts user diff --git a/images/win/scripts/Installers/Install-NET48.ps1 b/images/win/scripts/Installers/Install-NET48.ps1 index ef343b530..ef26a3c06 100644 --- a/images/win/scripts/Installers/Install-NET48.ps1 +++ b/images/win/scripts/Installers/Install-NET48.ps1 @@ -3,8 +3,6 @@ ## Desc: Install .NET 4.8 ################################################################################ -Import-Module -Name ImageHelpers -Force - # .NET 4.8 Dev pack $InstallerName = "ndp48-devpack-enu.exe" $InstallerUrl = "https://download.visualstudio.microsoft.com/download/pr/014120d7-d689-4305-befd-3cb711108212/0307177e14752e359fde5423ab583e43/${InstallerName}" diff --git a/images/win/scripts/Installers/Install-NodeLts.ps1 b/images/win/scripts/Installers/Install-NodeLts.ps1 index 8dc4559ed..a44a04fbc 100644 --- a/images/win/scripts/Installers/Install-NodeLts.ps1 +++ b/images/win/scripts/Installers/Install-NodeLts.ps1 @@ -4,8 +4,6 @@ ## Must run after python is configured ################################################################################ -Import-Module -Name ImageHelpers -Force - $PrefixPath = 'C:\npm\prefix' $CachePath = 'C:\npm\cache' diff --git a/images/win/scripts/Installers/Install-PHP.ps1 b/images/win/scripts/Installers/Install-PHP.ps1 index f629af21a..7e766bbae 100644 --- a/images/win/scripts/Installers/Install-PHP.ps1 +++ b/images/win/scripts/Installers/Install-PHP.ps1 @@ -2,7 +2,6 @@ ## File: Install-PHP.ps1 ## Desc: Install PHP ################################################################################ -Import-Module -Name ImageHelpers # Install latest PHP in chocolatey $installDir = "c:\tools\php" diff --git a/images/win/scripts/Installers/Install-PyPy.ps1 b/images/win/scripts/Installers/Install-PyPy.ps1 index 01739ddaa..8b029f024 100644 --- a/images/win/scripts/Installers/Install-PyPy.ps1 +++ b/images/win/scripts/Installers/Install-PyPy.ps1 @@ -82,8 +82,6 @@ function Install-PyPy } } -Import-Module -Name ImageHelpers -Force -DisableNameChecking - # Get PyPy content from toolset $pypyTools = Get-ToolsetContent | Select-Object -ExpandProperty toolcache | Where-Object Name -eq "PyPy" diff --git a/images/win/scripts/Installers/Install-Rust.ps1 b/images/win/scripts/Installers/Install-Rust.ps1 index 35e16dcd9..294a1370f 100644 --- a/images/win/scripts/Installers/Install-Rust.ps1 +++ b/images/win/scripts/Installers/Install-Rust.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Rust for Windows ################################################################################ -Import-Module -Name ImageHelpers - # Rust Env $env:RUSTUP_HOME = "C:\Rust\.rustup" $env:CARGO_HOME = "C:\Rust\.cargo" diff --git a/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 b/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 index 7c0a3cfd1..60cbbefaf 100644 --- a/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 +++ b/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 @@ -3,8 +3,6 @@ ## Desc: Install SQL PowerShell tool ################################################################################ -Import-Module -Name ImageHelpers -Force - $BaseUrl = "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64" # install required MSIs diff --git a/images/win/scripts/Installers/Install-Sbt.ps1 b/images/win/scripts/Installers/Install-Sbt.ps1 index 1be6d234a..cfc37f5b8 100644 --- a/images/win/scripts/Installers/Install-Sbt.ps1 +++ b/images/win/scripts/Installers/Install-Sbt.ps1 @@ -2,7 +2,6 @@ ## File: Install-Sbt.ps1 ## Desc: Install sbt for Windows ################################################################################ -Import-Module -Name ImageHelpers # Install the latest version of sbt. # See https://chocolatey.org/packages/sbt diff --git a/images/win/scripts/Installers/Install-Selenium.ps1 b/images/win/scripts/Installers/Install-Selenium.ps1 index d49ad082d..c1f2ce152 100644 --- a/images/win/scripts/Installers/Install-Selenium.ps1 +++ b/images/win/scripts/Installers/Install-Selenium.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Selenium Server standalone ################################################################################ -Import-Module -Name ImageHelpers -Force - # Acquire latest Selenium release number from GitHub API $latestReleaseUrl = "https://api.github.com/repos/SeleniumHQ/selenium/releases/latest" try { diff --git a/images/win/scripts/Installers/Install-Toolset.ps1 b/images/win/scripts/Installers/Install-Toolset.ps1 index d3aaba785..5a8b3689f 100644 --- a/images/win/scripts/Installers/Install-Toolset.ps1 +++ b/images/win/scripts/Installers/Install-Toolset.ps1 @@ -29,8 +29,6 @@ Function Install-Asset { Pop-Location } -Import-Module -Name ImageHelpers -Force - # Get toolcache content from toolset $ToolsToInstall = @("Python", "Node", "Boost", "Go") diff --git a/images/win/scripts/Installers/Install-Vcpkg.ps1 b/images/win/scripts/Installers/Install-Vcpkg.ps1 index f4b44f98e..4360b2d35 100644 --- a/images/win/scripts/Installers/Install-Vcpkg.ps1 +++ b/images/win/scripts/Installers/Install-Vcpkg.ps1 @@ -3,8 +3,6 @@ ## Desc: Install vcpkg ################################################################################ -Import-Module -Name ImageHelpers -Force - $Uri = 'https://github.com/Microsoft/vcpkg.git' $InstallDir = 'C:\vcpkg' $VcpkgExecPath = 'vcpkg.exe' diff --git a/images/win/scripts/Installers/Install-WDK.ps1 b/images/win/scripts/Installers/Install-WDK.ps1 index 54f08cc92..82690c801 100644 --- a/images/win/scripts/Installers/Install-WDK.ps1 +++ b/images/win/scripts/Installers/Install-WDK.ps1 @@ -4,9 +4,6 @@ ################################################################################ # Requires Windows SDK with the same version number as the WDK - -Import-Module -Name ImageHelpers -Force - if (Test-IsWin19) { $winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2120843" diff --git a/images/win/scripts/Installers/Install-WinAppDriver.ps1 b/images/win/scripts/Installers/Install-WinAppDriver.ps1 index fc79ff993..38745dd92 100644 --- a/images/win/scripts/Installers/Install-WinAppDriver.ps1 +++ b/images/win/scripts/Installers/Install-WinAppDriver.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Windows Application Driver (WinAppDriver) #################################################################################### -Import-Module -Name ImageHelpers -Force - $InstallerName = "WindowsApplicationDriver.msi" $InstallerUrl = "https://github.com/Microsoft/WinAppDriver/releases/download/v1.1/${InstallerName}" diff --git a/images/win/scripts/Installers/Install-Wix.ps1 b/images/win/scripts/Installers/Install-Wix.ps1 index 63305f57f..88ef31b29 100644 --- a/images/win/scripts/Installers/Install-Wix.ps1 +++ b/images/win/scripts/Installers/Install-Wix.ps1 @@ -3,8 +3,6 @@ ## Desc: Install WIX. ################################################################################ -Import-Module -Name ImageHelpers -Force - Choco-Install -PackageName wixtoolset -ArgumentList "--force" if(Test-IsWin19) diff --git a/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 b/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 index b39a547d2..e67d0cb2a 100644 --- a/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 @@ -3,8 +3,6 @@ ## Desc: Install SQL Server Data Tools for Windows ################################################################################ -Import-Module -Name ImageHelpers -Force - #SSDT for Visual Studio 2017 #The link down below points to the latest version of SSDT for Visual Studio 2017 $InstallerName = "SSDT-Setup-ENU.exe" diff --git a/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 b/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 index d89f468fa..897b8bffe 100644 --- a/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 @@ -3,8 +3,6 @@ ## Desc: Install Windows 8.1 SDK ################################################################################ -Import-Module -Name ImageHelpers -Force - $InstallerName = "sdksetup.exe" $InstallerUrl = "http://download.microsoft.com/download/B/0/C/B0C80BA3-8AD6-4958-810B-6882485230B5/standalonesdk/${InstallerName}" $ArgumentList = ("/quiet", "/norestart") From ce454f523e3225fd5b3de22806f55c396f060ac4 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 5 Oct 2020 10:38:36 +0300 Subject: [PATCH 16/19] fix erlang version output --- .../linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index c9257407f..9d910ddcc 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -32,9 +32,7 @@ function Get-ClangVersions { } function Get-ErlangVersion { - $result = Get-CommandResult "erl -version" - $result.Output -match "version (?\d+\.\d+\.\d+)" | Out-Null - $version = $Matches.version + $version = (erl -eval 'erlang:display(erlang:system_info(version)), halt().' -noshell).Trim('"') return "Erlang $version" } From e56fa77d910b9cfbdfc440938608592bcc4e8e4e Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 5 Oct 2020 11:19:24 +0300 Subject: [PATCH 17/19] restore owner --- .../SoftwareReport/SoftwareReport.Generator.ps1 | 3 +++ .../SoftwareReport/SoftwareReport.Helpers.psm1 | 4 ++++ .../SoftwareReport/SoftwareReport.Tools.psm1 | 16 ++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index ff03ba846..ac8c26dd7 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -14,6 +14,9 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameC Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Rust.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking +# Restore file owner in user profile +Restore-UserOwner + $markdown = "" if ($env:ANNOUNCEMENTS) { diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 index 45ab44948..9ef761d78 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -49,3 +49,7 @@ function New-MDNewLine { $newLineSymbol = [System.Environment]::NewLine return $newLineSymbol * $Count } + +function Restore-UserOwner { + sudo chown -R ${env:USER}: $env:HOME +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 915f857fd..2c98ecbcb 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -4,7 +4,7 @@ function Get-7zipVersion { } function Get-AnsibleVersion { - $ansibleVersion = sudo ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 + $ansibleVersion = ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 return "Ansible $ansibleVersion" } @@ -19,12 +19,12 @@ function Get-AzCopy10Version { } function Get-BazelVersion { - $bazelVersion = sudo bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 + $bazelVersion = bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 return "Bazel $bazelVersion" } function Get-BazeliskVersion { - $bazeliskVersion = sudo bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" + $bazeliskVersion = bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" return "Bazelisk $bazeliskVersion" } @@ -92,7 +92,7 @@ function Get-GitFTPVersion { } function Get-GoogleCloudSDKVersion { - return "$(sudo gcloud --version | Select-Object -First 1)" + return "$(gcloud --version | Select-Object -First 1)" } function Get-HavegedVersion { @@ -101,7 +101,7 @@ function Get-HavegedVersion { } function Get-HerokuVersion { - $herokuVersion = sudo heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $herokuVersion = heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Heroku $herokuVersion" } @@ -201,12 +201,12 @@ function Get-JqVersion { } function Get-AzureCliVersion { - $azcliVersion = sudo az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 + $azcliVersion = az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 return "Azure CLI (azure-cli) $azcliVersion" } function Get-AzureDevopsVersion { - $azdevopsVersion = sudo az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 + $azdevopsVersion = az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 return "Azure CLI (azure-devops) $azdevopsVersion" } @@ -238,7 +238,7 @@ function Get-GitHubCliVersion { } function Get-NetlifyCliVersion { - $netlifyVersion = sudo netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $netlifyVersion = netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Netlify CLI $netlifyVersion" } From 70219fe6eeeab5e80724f9a6c8e2b10f6f9eea3b Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Mon, 5 Oct 2020 16:24:53 +0300 Subject: [PATCH 18/19] Add database tools section to Windows docs (#1706) * add database tools section to docs, removed sqlps powershell module * reverted SQLPS module changes * removed SqlServer module from tools, its listed in PS modules * delete function as its not needed Co-authored-by: Leonid Lapshin --- .../SoftwareReport/SoftwareReport.Generator.ps1 | 12 ++++++++---- .../scripts/SoftwareReport/SoftwareReport.Tools.psm1 | 6 ------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 377331ada..c9f170309 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -74,7 +74,6 @@ $markdown += New-MDList -Style Unordered -Lines @( $markdown += New-MDHeader "Tools" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( - (Get-AzCosmosDBEmulatorVersion), (Get-AzCopyVersion), (Get-BazelVersion), (Get-BazeliskVersion), @@ -91,15 +90,12 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-KubectlVersion), (Get-KindVersion), (Get-MinGWVersion), - (Get-MySQLVersion), (Get-MercurialVersion), (Get-NSISVersion), (Get-NewmanVersion), (Get-OpenSSLVersion), (Get-PackerVersion), (Get-PulumiVersion), - (Get-SQLPSVersion), - (Get-SQLServerPSVersion), (Get-SVNVersion), (Get-GHCVersion), (Get-CabalVersion), @@ -168,6 +164,14 @@ $markdown += New-MDHeader "Databases" -Level 3 $markdown += Build-DatabasesMarkdown $markdown += New-MDNewLine +$markdown += New-MDHeader "Database tools" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-AzCosmosDBEmulatorVersion), + (Get-SQLPSVersion), + (Get-MySQLVersion) +) +$markdown += New-MDNewLine + $vs = Get-VisualStudioVersion $markdown += New-MDHeader "$($vs.Name)" -Level 3 $markdown += $vs | New-MDTable diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 0c0f39f55..6c4034871 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -125,12 +125,6 @@ function Get-SQLPSVersion { return "SQLPS $version" } -function Get-SQLServerPSVersion { - $module = Get-Module -Name SQLServer -ListAvailable - $version = $module.Version - return "SQLServer PS $version" -} - function Get-SVNVersion { $svnVersion = $(svn --version --quiet) return "Subversion (SVN) $svnVersion" From c66c1b90fd802e457985465825886d0c81fbfc48 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 5 Oct 2020 22:31:26 +0200 Subject: [PATCH 19/19] Update gh homebrew formula name (#1735) --- images/macos/provision/core/commonutils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/macos/provision/core/commonutils.sh b/images/macos/provision/core/commonutils.sh index 9b32d5c2c..5a98f004f 100644 --- a/images/macos/provision/core/commonutils.sh +++ b/images/macos/provision/core/commonutils.sh @@ -19,7 +19,7 @@ binst_common_utils=( helm aliyun-cli bazelisk - github/gh/gh + gh p7zip ant yamllint