From e91961e2f281b7e2888557bb27084fe060431510 Mon Sep 17 00:00:00 2001 From: Mikhail Koliada <88318005+mikhailkoliada@users.noreply.github.com> Date: Fri, 8 Jul 2022 07:49:17 +0200 Subject: [PATCH] [Ubuntu] Add Microsoft Edge (#5874) trailing whitespace --- .../SoftwareReport.Browsers.psm1 | 6 +++++ .../SoftwareReport.Generator.ps1 | 1 + .../scripts/installers/microsoft-edge.sh | 24 +++++++++++++++++++ images/linux/scripts/tests/Browsers.Tests.ps1 | 8 ++++++- images/linux/ubuntu1804.json | 1 + images/linux/ubuntu2004.json | 1 + images/linux/ubuntu2204.pkr.hcl | 1 + 7 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 images/linux/scripts/installers/microsoft-edge.sh diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 index 8c60f8d7..b480419e 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 @@ -23,6 +23,12 @@ function Get-ChromiumVersion { return $chromiumVersion } +function Get-EdgeVersion { + $edgeVersion = (microsoft-edge --version).trim() + $aptSourceRepo = Get-AptSourceRepository -PackageName "microsoft-edge" + return "$edgeVersion (apt source repository: $aptSourceRepo)" +} + function Get-SeleniumVersion { $seleniumBinaryName = Get-ToolsetValue "selenium.binary_name" $fullSeleniumVersion = (Get-ChildItem "/usr/share/java/${seleniumBinaryName}-*").Name -replace "${seleniumBinaryName}-" diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 0b4b432a..b3a3a452 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -231,6 +231,7 @@ $browsersAndDriversList = @( (Get-ChromeVersion), (Get-ChromeDriverVersion), (Get-ChromiumVersion), + (Get-EdgeVersion), (Get-SeleniumVersion) ) diff --git a/images/linux/scripts/installers/microsoft-edge.sh b/images/linux/scripts/installers/microsoft-edge.sh new file mode 100644 index 00000000..40928991 --- /dev/null +++ b/images/linux/scripts/installers/microsoft-edge.sh @@ -0,0 +1,24 @@ +#!/bin/bash -e +################################################################################ +## File: microsoft-edge.sh +## Desc: Installs Microsoft Edge +################################################################################ + +REPO_URL="https://packages.microsoft.com/repos/edge" +gpg_key="/usr/share/keyrings/microsoft-edge.gpg" +repo_path="/etc/apt/sources.list.d/microsoft-edge.list" + + +wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > $gpg_key +# Specify an arch as Microsoft repository supports armhf and arm64 as well +echo "deb [arch=amd64 signed-by=$gpg_key] $REPO_URL stable main" > $repo_path + +apt-get update +apt-get install --no-install-recommends microsoft-edge-stable + +rm $gpg_key +rm $repo_path + +echo "microsoft-edge $REPO_URL" >> $HELPER_SCRIPTS/apt-sources.txt + +invoke_tests "Browsers" "Edge" diff --git a/images/linux/scripts/tests/Browsers.Tests.ps1 b/images/linux/scripts/tests/Browsers.Tests.ps1 index e6e77bbf..abf4e4a3 100644 --- a/images/linux/scripts/tests/Browsers.Tests.ps1 +++ b/images/linux/scripts/tests/Browsers.Tests.ps1 @@ -18,8 +18,14 @@ Describe "Chrome" { } } +Describe "Edge" { + It "Edge" { + "microsoft-edge --version" | Should -ReturnZeroExitCode + } +} + Describe "Chromium" { It "Chromium" { "chromium-browser --version" | Should -ReturnZeroExitCode } -} +} diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 1f64a336..b36c1eb2 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -203,6 +203,7 @@ "{{template_dir}}/scripts/installers/dotnetcore-sdk.sh", "{{template_dir}}/scripts/installers/erlang.sh", "{{template_dir}}/scripts/installers/firefox.sh", + "{{template_dir}}/scripts/installers/microsoft-edge.sh", "{{template_dir}}/scripts/installers/gcc.sh", "{{template_dir}}/scripts/installers/gfortran.sh", "{{template_dir}}/scripts/installers/git.sh", diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 7c386927..894de265 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -204,6 +204,7 @@ "{{template_dir}}/scripts/installers/dotnetcore-sdk.sh", "{{template_dir}}/scripts/installers/erlang.sh", "{{template_dir}}/scripts/installers/firefox.sh", + "{{template_dir}}/scripts/installers/microsoft-edge.sh", "{{template_dir}}/scripts/installers/gcc.sh", "{{template_dir}}/scripts/installers/gfortran.sh", "{{template_dir}}/scripts/installers/git.sh", diff --git a/images/linux/ubuntu2204.pkr.hcl b/images/linux/ubuntu2204.pkr.hcl index d21eb0d3..776112ec 100644 --- a/images/linux/ubuntu2204.pkr.hcl +++ b/images/linux/ubuntu2204.pkr.hcl @@ -273,6 +273,7 @@ build { "${path.root}/scripts/installers/codeql-bundle.sh", "${path.root}/scripts/installers/containers.sh", "${path.root}/scripts/installers/dotnetcore-sdk.sh", + "${path.root}/scripts/installers/microsoft-edge.sh", "${path.root}/scripts/installers/gcc.sh", "${path.root}/scripts/installers/gfortran.sh", "${path.root}/scripts/installers/git.sh",