From 5afe6fcc4e2ebdc9dd89ce453c9c7b4167c3955e Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Wed, 24 Feb 2021 18:21:51 +0300 Subject: [PATCH] [Ubuntu] Remove azcopy 7 (#2779) * remove azcopy 7 installation * Fix software report generator * fix variable name * add install helper --- .../SoftwareReport/SoftwareReport.Generator.ps1 | 3 +-- .../SoftwareReport/SoftwareReport.Tools.psm1 | 11 +++-------- images/linux/scripts/installers/azcopy.sh | 14 ++++++-------- images/linux/scripts/tests/Tools.Tests.ps1 | 6 ++---- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index ee7dc9948..a66994962 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -90,8 +90,7 @@ $toolsList = @( (Get-7zipVersion), (Get-AnsibleVersion), (Get-AptFastVersion), - (Get-AzCopy7Version), - (Get-AzCopy10Version), + (Get-AzCopyVersion), (Get-BazelVersion), (Get-BazeliskVersion), (Get-BinUtilsVersion), diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index e6650fca2..ef6635477 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -13,14 +13,9 @@ function Get-AptFastVersion { return "apt-fast $aptFastVersion" } -function Get-AzCopy7Version { - $azcopy7Version = azcopy --version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" - return "AzCopy7 $azcopy7Version (available by ``azcopy`` alias)" -} - -function Get-AzCopy10Version { - $azcopy10Version = azcopy10 --version | Take-OutputPart -Part 2 - return "AzCopy10 $azcopy10Version (available by ``azcopy10`` alias)" +function Get-AzCopyVersion { + $azcopyVersion = azcopy --version | Take-OutputPart -Part 2 + return "AzCopy $azcopyVersion (available by ``azcopy`` and ``azcopy10`` aliases)" } function Get-BazelVersion { diff --git a/images/linux/scripts/installers/azcopy.sh b/images/linux/scripts/installers/azcopy.sh index 58dfdf658..af5e5916f 100644 --- a/images/linux/scripts/installers/azcopy.sh +++ b/images/linux/scripts/installers/azcopy.sh @@ -4,16 +4,14 @@ ## Desc: Installs AzCopy ################################################################################ -# Install AzCopy7 -wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64 -tar -xf azcopy.tar.gz -rm azcopy.tar.gz -./install.sh +source $HELPER_SCRIPTS/install.sh # Install AzCopy10 -wget -O /tmp/azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux +download_with_retries "https://aka.ms/downloadazcopy-v10-linux" "/tmp" "azcopy.tar.gz" tar zxvf /tmp/azcopy.tar.gz --strip-components=1 -C /tmp -mv /tmp/azcopy /usr/local/bin/azcopy10 -chmod +x /usr/local/bin/azcopy10 +mv /tmp/azcopy /usr/local/bin/azcopy +chmod +x /usr/local/bin/azcopy +# Create azcopy 10 alias for backward compatibility +ln -sf /usr/local/bin/azcopy /usr/local/bin/azcopy10 invoke_tests "Tools" "azcopy" \ No newline at end of file diff --git a/images/linux/scripts/tests/Tools.Tests.ps1 b/images/linux/scripts/tests/Tools.Tests.ps1 index e17b21d65..60372d9cc 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -1,11 +1,9 @@ Describe "azcopy" { It "azcopy" { - #(azcopy --version) command returns exit code 1 (see details: https://github.com/Azure/azure-storage-azcopy/releases) - $azcopyVersion = (Get-CommandResult "azcopy --version").Output - $azcopyVersion | Should -BeLike "*azcopy*" + "azcopy --version" | Should -ReturnZeroExitCode } - It "azcopy10" { + It "azcopy10 link exists" { "azcopy10 --version" | Should -ReturnZeroExitCode } }