From 6070c253028459a3c647b2540b826954ad42c73c Mon Sep 17 00:00:00 2001 From: Andy Mishechkin <57713077+andy-mishechkin@users.noreply.github.com> Date: Mon, 8 Jun 2020 11:59:13 +0400 Subject: [PATCH] [Windows] Add azcopy utility (#1008) * azcopy10 deployment for Windows has been added * small bugfixing * Header has been added to Install-AzCopy.ps1 * Header has been added to Validate-AzCopy.ps1 * Packer tempaltes have been modified --- images/win/Windows2016-Azure.json | 12 ++++++++++++ images/win/Windows2019-Azure.json | 12 ++++++++++++ images/win/scripts/Installers/Install-AzCopy.ps1 | 6 ++++++ images/win/scripts/Installers/Validate-AzCopy.ps1 | 10 ++++++++++ .../SoftwareReport/SoftwareReport.Generator.ps1 | 1 + .../scripts/SoftwareReport/SoftwareReport.Tools.psm1 | 4 ++++ 6 files changed, 45 insertions(+) create mode 100644 images/win/scripts/Installers/Install-AzCopy.ps1 create mode 100644 images/win/scripts/Installers/Validate-AzCopy.ps1 diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 622909b03..ba6197d26 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -289,6 +289,12 @@ "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzCopy.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -712,6 +718,12 @@ "{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzCopy.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index dc303a192..3b5ba9d79 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -274,6 +274,12 @@ "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzCopy.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -697,6 +703,12 @@ "{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzCopy.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Install-AzCopy.ps1 b/images/win/scripts/Installers/Install-AzCopy.ps1 new file mode 100644 index 000000000..035edee25 --- /dev/null +++ b/images/win/scripts/Installers/Install-AzCopy.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-AzCopy.ps1 +## Desc: Install AzCopy10 +################################################################################ + +Choco-Install -PackageName azcopy10 \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-AzCopy.ps1 b/images/win/scripts/Installers/Validate-AzCopy.ps1 new file mode 100644 index 000000000..dd090297a --- /dev/null +++ b/images/win/scripts/Installers/Validate-AzCopy.ps1 @@ -0,0 +1,10 @@ +################################################################################ +## File: Validate-AzCopy.ps1 +## Desc: Validate AzCopy10 +################################################################################ +if (Get-Command -Name 'azcopy') { + Write-Host "$(azcopy --version) on path" +} else { + Write-Error "azcopy not on path" + exit 1 +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 903d39476..07938d2f7 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -93,6 +93,7 @@ $markdown += New-MDList -Style Unordered -Lines @( $markdown += New-MDHeader "CLI Tools" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( (Get-AzureCLIVersion), + (Get-AzCopyVersion), (Get-AzureDevopsExtVersion), (Get-AWSCLIVersion), (Get-AWSSAMVersion), diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 510269c25..0fcb5e3a1 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -141,6 +141,10 @@ function Get-AzureCLIVersion { return "Azure CLI $azureCLIVersion" } +function Get-AzCopyVersion { + return ($(azcopy --version) -replace "version ") +} + function Get-AzureDevopsExtVersion { $azureDevExtVersion = (az version | ConvertFrom-Json | Foreach{ $_."extensions" })."azure-devops" return "Azure DevOps CLI extension $azureDevExtVersion"