From cc8bdd738467c8803411af1e5571f8ba6b95d2a3 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Feb 2020 09:56:16 +0400 Subject: [PATCH 1/6] dotnetcore-sdk.sh has been refactored for using in both Ubuntu 16/18 deployments --- .vscode/tasks.json | 50 +++------- images/linux/scripts/base/repos.sh | 6 +- .../scripts/installers/1804/dotnetcore-sdk.sh | 99 ------------------- .../installers/{1604 => }/dotnetcore-sdk.sh | 4 + images/linux/ubuntu1604.json | 2 +- images/linux/ubuntu1804.json | 2 +- 6 files changed, 22 insertions(+), 141 deletions(-) delete mode 100644 images/linux/scripts/installers/1804/dotnetcore-sdk.sh rename images/linux/scripts/installers/{1604 => }/dotnetcore-sdk.sh (96%) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index da6002dd0..744b21456 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,42 +1,14 @@ -// Available variables which can be used inside of strings. -// ${workspaceRoot}: the root folder of the team -// ${file}: the current opened file -// ${relativeFile}: the current opened file relative to workspaceRoot -// ${fileBasename}: the current opened file's basename -// ${fileDirname}: the current opened file's dirname -// ${fileExtname}: the current opened file's extension -// ${cwd}: the current working directory of the spawned process { - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - - // Start PowerShell - "windows": { - "command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe", - //"command": "${env:ProgramFiles}/PowerShell/6.0.0/powershell.exe", - "args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ] - }, - "linux": { - "command": "/usr/bin/powershell", - "args": [ "-NoProfile" ] - }, - "osx": { - "command": "/usr/local/bin/powershell", - "args": [ "-NoProfile" ] - }, - - // Associate with test task runner - "tasks": [ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ { - "taskName": "Test", - "suppressTaskName": true, - "isTestCommand": true, - "args": [ - "Write-Host 'Invoking Pester...'; $ProgressPreference = 'SilentlyContinue'; Invoke-Pester -Script test -PesterOption @{IncludeVSCodeMarker=$true};", - "Invoke-Command { Write-Host 'Completed Test task in task runner.' }" - ], - "problemMatcher": "$pester" + "type": "bashdb", + "request": "launch", + "name": "Bash-Debug (simplest configuration)", + "program": "${file}" } - ] -} + ] +} \ No newline at end of file diff --git a/images/linux/scripts/base/repos.sh b/images/linux/scripts/base/repos.sh index f8280cc06..6c56d1cae 100644 --- a/images/linux/scripts/base/repos.sh +++ b/images/linux/scripts/base/repos.sh @@ -9,7 +9,11 @@ LSB_RELEASE=$(lsb_release -rs) # Install Microsoft repository wget https://packages.microsoft.com/config/ubuntu/$LSB_RELEASE/packages-microsoft-prod.deb dpkg -i packages-microsoft-prod.deb -apt-get update +apt-get install apt-transport-https # Install Microsoft GPG public key 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 +sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list' +apt-get update \ No newline at end of file diff --git a/images/linux/scripts/installers/1804/dotnetcore-sdk.sh b/images/linux/scripts/installers/1804/dotnetcore-sdk.sh deleted file mode 100644 index d1fb73ec3..000000000 --- a/images/linux/scripts/installers/1804/dotnetcore-sdk.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -################################################################################ -## File: dotnetcore-sdk.sh -## Desc: Installs .NET Core SDK -################################################################################ - -source $HELPER_SCRIPTS/apt.sh -source $HELPER_SCRIPTS/document.sh - -LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.0" "dotnet-sdk-3.1") - -LSB_RELEASE=$(lsb_release -rs) - -mksamples() -{ - sdk=$1 - sample=$2 - mkdir "$sdk" - cd "$sdk" || exit - set -e - dotnet help - dotnet new globaljson --sdk-version "$sdk" - dotnet new "$sample" - dotnet restore - dotnet build - set +e - cd .. || exit - rm -rf "$sdk" -} - -set -e - -# Disable telemetry -export DOTNET_CLI_TELEMETRY_OPTOUT=1 - -for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do - echo "Determing if .NET Core ($latest_package) is installed" - if ! IsInstalled $latest_package; then - echo "Could not find .NET Core ($latest_package), installing..." - curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg - mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg - sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list' - apt-get install apt-transport-https - apt-get update - apt-get install $latest_package -y - else - echo ".NET Core ($latest_package) is already installed" - fi -done - -# Get list of all released SDKs from channels which are not end-of-life or preview -release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.0/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json") -sdks=() -for release_url in ${release_urls[@]}; do - echo "${release_url}" - releases=$(curl "${release_url}") - sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdk.version')) - sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version')) -done - -sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r) - -for sdk in $sortedSdks; do - url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz" - echo "$url" >> urls - echo "Adding $url to list to download later" -done - -# Download additional SDKs -echo "Downloading release tarballs..." -cat urls | xargs -n 1 -P 16 wget -q -for tarball in *.tar.gz; do - dest="./tmp-$(basename -s .tar.gz $tarball)" - echo "Extracting $tarball to $dest" - mkdir "$dest" && tar -C "$dest" -xzf "$tarball" - rsync -qav "$dest/shared/" /usr/share/dotnet/shared/ - rsync -qav "$dest/host/" /usr/share/dotnet/host/ - rsync -qav "$dest/sdk/" /usr/share/dotnet/sdk/ - rm -rf "$dest" - rm "$tarball" -done -rm urls - -DocumentInstalledItem ".NET Core SDK:" -# Smoke test each SDK -for sdk in $sortedSdks; do - mksamples "$sdk" "console" - mksamples "$sdk" "mstest" - mksamples "$sdk" "xunit" - mksamples "$sdk" "web" - mksamples "$sdk" "mvc" - mksamples "$sdk" "webapi" - DocumentInstalledItemIndent "$sdk" -done - -# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test -# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine -echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" | tee -a /etc/environment -echo 'export PATH="$PATH:$HOME/.dotnet/tools"' | tee -a /etc/skel/.bashrc diff --git a/images/linux/scripts/installers/1604/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh similarity index 96% rename from images/linux/scripts/installers/1604/dotnetcore-sdk.sh rename to images/linux/scripts/installers/dotnetcore-sdk.sh index 7db727558..1d36ef977 100644 --- a/images/linux/scripts/installers/1604/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -4,6 +4,7 @@ ## Desc: Installs .NET Core SDK ################################################################################ +HELPER_SCRIPTS=/repos/virtual-environments/images/linux/scripts/helpers source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh @@ -30,6 +31,9 @@ mksamples() set -e +# Disable telemetry +export DOTNET_CLI_TELEMETRY_OPTOUT=1 + for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do echo "Determing if .NET Core ($latest_package) is installed" if ! IsInstalled $latest_package; then diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index f3b95f063..5bd28548c 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -129,7 +129,7 @@ "{{template_dir}}/scripts/installers/docker-compose.sh", "{{template_dir}}/scripts/installers/docker-moby.sh", "{{template_dir}}/scripts/installers/docker.sh", - "{{template_dir}}/scripts/installers/1604/dotnetcore-sdk.sh", + "{{template_dir}}/scripts/installers/dotnetcore-sdk.sh", "{{template_dir}}/scripts/installers/erlang.sh", "{{template_dir}}/scripts/installers/firefox.sh", "{{template_dir}}/scripts/installers/gcc.sh", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 5938c2aa5..732de5215 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -132,7 +132,7 @@ "{{template_dir}}/scripts/installers/docker-compose.sh", "{{template_dir}}/scripts/installers/docker-moby.sh", "{{template_dir}}/scripts/installers/docker.sh", - "{{template_dir}}/scripts/installers/1804/dotnetcore-sdk.sh", + "{{template_dir}}/scripts/installers/dotnetcore-sdk.sh", "{{template_dir}}/scripts/installers/erlang.sh", "{{template_dir}}/scripts/installers/firefox.sh", "{{template_dir}}/scripts/installers/gcc.sh", From 02192d4fd6b97da61114896a2d64cdbf67502b50 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Feb 2020 10:11:28 +0400 Subject: [PATCH 2/6] Return to tasks.json from master branch --- .vscode/tasks.json | 48 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 744b21456..7827bd0eb 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,14 +1,42 @@ +// Available variables which can be used inside of strings. +// ${workspaceRoot}: the root folder of the team +// ${file}: the current opened file +// ${relativeFile}: the current opened file relative to workspaceRoot +// ${fileBasename}: the current opened file's basename +// ${fileDirname}: the current opened file's dirname +// ${fileExtname}: the current opened file's extension +// ${cwd}: the current working directory of the spawned process { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + + // Start PowerShell + "windows": { + "command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe", + //"command": "${env:ProgramFiles}/PowerShell/6.0.0/powershell.exe", + "args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ] + }, + "linux": { + "command": "/usr/bin/powershell", + "args": [ "-NoProfile" ] + }, + "osx": { + "command": "/usr/local/bin/powershell", + "args": [ "-NoProfile" ] + }, + + // Associate with test task runner + "tasks": [ { - "type": "bashdb", - "request": "launch", - "name": "Bash-Debug (simplest configuration)", - "program": "${file}" + "taskName": "Test", + "suppressTaskName": true, + "isTestCommand": true, + "args": [ + "Write-Host 'Invoking Pester...'; $ProgressPreference = 'SilentlyContinue'; Invoke-Pester -Script test -PesterOption @{IncludeVSCodeMarker=$true};", + "Invoke-Command { Write-Host 'Completed Test task in task runner.' }" + ], + "problemMatcher": "$pester" } - ] + ] } \ No newline at end of file From ae119feb62accd32611e5f1076816aa089188965 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Feb 2020 10:32:44 +0400 Subject: [PATCH 3/6] dotnetcore-sdk.sh - excess debug string has been removed --- images/linux/scripts/installers/dotnetcore-sdk.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index 1d36ef977..88b6cb0a2 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -3,8 +3,6 @@ ## File: dotnetcore-sdk.sh ## Desc: Installs .NET Core SDK ################################################################################ - -HELPER_SCRIPTS=/repos/virtual-environments/images/linux/scripts/helpers source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh From bff4ce772620dd5e77fc493411ac65d1d6e99760 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Feb 2020 11:15:04 +0400 Subject: [PATCH 4/6] Original tasks.json has been reverted --- .vscode/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7827bd0eb..da6002dd0 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -39,4 +39,4 @@ "problemMatcher": "$pester" } ] -} \ No newline at end of file +} From 28a081bda6220bd659bd2334bc521bb7021ee098 Mon Sep 17 00:00:00 2001 From: "Andrey Mishechkin (Akvelon INC)" Date: Thu, 20 Feb 2020 13:49:38 +0400 Subject: [PATCH 5/6] Setting '-y' has been added to installation of apt-transport-https --- images/linux/scripts/base/repos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/base/repos.sh b/images/linux/scripts/base/repos.sh index 6c56d1cae..abf4586e0 100644 --- a/images/linux/scripts/base/repos.sh +++ b/images/linux/scripts/base/repos.sh @@ -9,7 +9,7 @@ LSB_RELEASE=$(lsb_release -rs) # Install Microsoft repository wget https://packages.microsoft.com/config/ubuntu/$LSB_RELEASE/packages-microsoft-prod.deb dpkg -i packages-microsoft-prod.deb -apt-get install apt-transport-https +apt-get install -y apt-transport-https # Install Microsoft GPG public key curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - From a3c8fe11533a3bc4cdc3c45ca145a5d4162858ae Mon Sep 17 00:00:00 2001 From: "Andrey Mishechkin (Akvelon INC)" Date: Thu, 20 Feb 2020 18:26:31 +0400 Subject: [PATCH 6/6] Adding the Ubuntu 18 repository has been revoved from repos.sh --- images/linux/scripts/base/repos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/base/repos.sh b/images/linux/scripts/base/repos.sh index abf4586e0..847101aea 100644 --- a/images/linux/scripts/base/repos.sh +++ b/images/linux/scripts/base/repos.sh @@ -13,7 +13,7 @@ apt-get install -y apt-transport-https # Install Microsoft GPG public key 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 -sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list' apt-get update \ No newline at end of file