From df85366207dfb6c39c1aeb227bfa4f92e46e7ad9 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Thu, 14 May 2020 16:55:23 +0300 Subject: [PATCH 1/4] deprecated software Ubuntu 20.04 --- images/linux/scripts/helpers/os.sh | 9 ++- .../linux/scripts/installers/2004/android.sh | 26 --------- .../scripts/installers/dotnetcore-sdk.sh | 11 +++- images/linux/scripts/installers/haskell.sh | 56 ++++++++++++++----- images/linux/ubuntu2004.json | 2 +- 5 files changed, 58 insertions(+), 46 deletions(-) diff --git a/images/linux/scripts/helpers/os.sh b/images/linux/scripts/helpers/os.sh index 7d8b174fd..9c30c811a 100644 --- a/images/linux/scripts/helpers/os.sh +++ b/images/linux/scripts/helpers/os.sh @@ -6,12 +6,17 @@ function isUbuntu16 { - lsb_release -d|grep 'Ubuntu 16' > /dev/null + lsb_release -d | grep -q 'Ubuntu 16' } function isUbuntu18 { - lsb_release -d|grep 'Ubuntu 18' > /dev/null + lsb_release -d | grep -q 'Ubuntu 18' +} + +function isUbuntu20 +{ + lsb_release -d | grep -q 'Ubuntu 20' } function getOSVersionLabel diff --git a/images/linux/scripts/installers/2004/android.sh b/images/linux/scripts/installers/2004/android.sh index a4a94566c..4d4a32724 100644 --- a/images/linux/scripts/installers/2004/android.sh +++ b/images/linux/scripts/installers/2004/android.sh @@ -50,11 +50,6 @@ echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \ "platforms;android-26" \ "platforms;android-25" \ "platforms;android-24" \ - "platforms;android-23" \ - "platforms;android-22" \ - "platforms;android-21" \ - "platforms;android-19" \ - "platforms;android-17" \ "build-tools;29.0.3" \ "build-tools;29.0.2" \ "build-tools;29.0.0" \ @@ -78,14 +73,6 @@ echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \ "build-tools;24.0.2" \ "build-tools;24.0.1" \ "build-tools;24.0.0" \ - "build-tools;23.0.3" \ - "build-tools;23.0.2" \ - "build-tools;23.0.1" \ - "build-tools;22.0.1" \ - "build-tools;21.1.2" \ - "build-tools;20.0.0" \ - "build-tools;19.1.0" \ - "build-tools;17.0.0" \ "extras;android;m2repository" \ "extras;google;m2repository" \ "extras;google;google_play_services" \ @@ -114,11 +101,6 @@ DocumentInstalledItem "Android SDK Platform 27" DocumentInstalledItem "Android SDK Platform 26" DocumentInstalledItem "Android SDK Platform 25" DocumentInstalledItem "Android SDK Platform 24" -DocumentInstalledItem "Android SDK Platform 23" -DocumentInstalledItem "Android SDK Platform 22" -DocumentInstalledItem "Android SDK Platform 21" -DocumentInstalledItem "Android SDK Platform 19" -DocumentInstalledItem "Android SDK Platform 17" DocumentInstalledItem "Android SDK Patch Applier v4" DocumentInstalledItem "Android SDK Build-Tools 29.0.3" DocumentInstalledItem "Android SDK Build-Tools 29.0.2" @@ -143,12 +125,4 @@ DocumentInstalledItem "Android SDK Build-Tools 24.0.3" DocumentInstalledItem "Android SDK Build-Tools 24.0.2" DocumentInstalledItem "Android SDK Build-Tools 24.0.1" DocumentInstalledItem "Android SDK Build-Tools 24.0.0" -DocumentInstalledItem "Android SDK Build-Tools 23.0.3" -DocumentInstalledItem "Android SDK Build-Tools 23.0.2" -DocumentInstalledItem "Android SDK Build-Tools 23.0.1" -DocumentInstalledItem "Android SDK Build-Tools 22.0.1" -DocumentInstalledItem "Android SDK Build-Tools 21.1.2" -DocumentInstalledItem "Android SDK Build-Tools 20.0.0" -DocumentInstalledItem "Android SDK Build-Tools 19.1.0" -DocumentInstalledItem "Android SDK Build-Tools 17.0.0" DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)" diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index f2210e826..8416efb68 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -7,7 +7,15 @@ source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh -LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.1") +if isUbuntu20 ; then + LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.1") + release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json") +fi + +if isUbuntu16 || isUbuntu18 ; then + LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.0" "dotnet-sdk-3.1") + 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") +fi LSB_RELEASE=$(lsb_release -rs) @@ -44,7 +52,6 @@ for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do 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/3.1/releases.json") sdks=() for release_url in ${release_urls[@]}; do echo "${release_url}" diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index 49b9c65f1..9f80d9867 100644 --- a/images/linux/scripts/installers/haskell.sh +++ b/images/linux/scripts/installers/haskell.sh @@ -6,7 +6,7 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/os.sh # Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. # https://launchpad.net/~hvr/+archive/ubuntu/ghc @@ -15,16 +15,42 @@ add-apt-repository -y ppa:hvr/ghc apt-get update # Install various versions of ghc and cabal -apt-get install -y \ - ghc-8.0.2 \ - ghc-8.2.2 \ - ghc-8.4.4 \ - ghc-8.6.5 \ - ghc-8.8.3 \ - ghc-8.10.1 \ - cabal-install-2.4 \ - cabal-install-3.0 \ - cabal-install-3.2 +if isUbuntu20 ; then + apt-get install -y \ + ghc-8.6.5 \ + ghc-8.8.3 \ + ghc-8.10.1 \ + cabal-install-2.4 \ + cabal-install-3.0 \ + cabal-install-3.2 + + ghcVersions="8.6.5 8.8.3 8.10.1" + cabalVersions="2.4 3.0 3.2" +fi + +if isUbuntu16 || isUbuntu18 ; then + # Install various versions of ghc and cabal + apt-get install -y \ + ghc-8.0.2 \ + ghc-8.2.2 \ + ghc-8.4.4 \ + ghc-8.6.2 \ + ghc-8.6.3 \ + ghc-8.6.4 \ + ghc-8.6.5 \ + ghc-8.8.1 \ + ghc-8.8.2 \ + ghc-8.8.3 \ + ghc-8.10.1 \ + cabal-install-2.0 \ + cabal-install-2.2 \ + cabal-install-2.4 \ + cabal-install-3.0 \ + cabal-install-3.2 + + ghcVersions="8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1 8.8.2 8.8.3 8.10.1" + cabalVersions="2.0 2.2 2.4 3.0 3.2" +fi # Install the latest stable release of haskell stack curl -sSL https://get.haskellstack.org/ | sh @@ -32,14 +58,14 @@ curl -sSL https://get.haskellstack.org/ | sh # Run tests to determine that the software installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work" # Check all ghc versions -for version in 8.0.2 8.2.2 8.4.4 8.6.5 8.8.3 8.10.1; do +for version in $ghcVersions; do if ! command -v /opt/ghc/$version/bin/ghc; then echo "ghc $version was not installed" exit 1 fi done # Check all cabal versions -for version in 2.4 3.0 3.2; do +for version in $cabalVersions; do if ! command -v /opt/cabal/$version/bin/cabal; then echo "cabal $version was not installed" exit 1 @@ -52,10 +78,10 @@ fi # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" -for version in 2.4 3.0 3.2; do +for version in $cabalVersions; do DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$version/bin/cabal --version))" done -for version in 8.0.2 8.2.2 8.4.4 8.6.5 8.8.3 8.10.1; do +for version in $ghcVersions; do DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))" done DocumentInstalledItem "Haskell Stack ($(stack --version))" diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 1d19f90a4..1026f6de9 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -25,7 +25,7 @@ "image_os": "ubuntu20", "github_feed_token": null, "go_default": "1.14", - "go_versions": "1.11 1.12 1.13 1.14" + "go_versions": "1.12 1.13 1.14" }, "sensitive-variables": ["client_secret", "github_feed_token"], "builders": [ From d5fe5064289f4883df39fdac9600923f6a4291d5 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Thu, 14 May 2020 17:00:28 +0300 Subject: [PATCH 2/4] install powershell Ubuntu 20.04 --- images/linux/scripts/installers/dotnetcore-sdk.sh | 2 +- images/linux/scripts/installers/haskell.sh | 2 +- images/linux/scripts/installers/powershellcore.sh | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index 8416efb68..08b553d0e 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -7,7 +7,7 @@ source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh -if isUbuntu20 ; then +if isUbuntu20 ; then LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.1") release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json") fi diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index 9f80d9867..d833a81e8 100644 --- a/images/linux/scripts/installers/haskell.sh +++ b/images/linux/scripts/installers/haskell.sh @@ -15,7 +15,7 @@ add-apt-repository -y ppa:hvr/ghc apt-get update # Install various versions of ghc and cabal -if isUbuntu20 ; then +if isUbuntu20 ; then apt-get install -y \ ghc-8.6.5 \ ghc-8.8.3 \ diff --git a/images/linux/scripts/installers/powershellcore.sh b/images/linux/scripts/installers/powershellcore.sh index 218ccd09e..8a69f4799 100644 --- a/images/linux/scripts/installers/powershellcore.sh +++ b/images/linux/scripts/installers/powershellcore.sh @@ -8,7 +8,13 @@ source $HELPER_SCRIPTS/document.sh # Install Powershell -snap install powershell --classic --channel=edge/useedge +if isUbuntu20 ; then + snap install powershell --classic --channel=edge/useedge +fi + +if isUbuntu16 || isUbuntu18 ; then + apt-get install -y powershell +fi # Run tests to determine that the software installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work" From 99579f621d3ab0f704e7b20ca0c23f8e23310f07 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Thu, 14 May 2020 17:07:13 +0300 Subject: [PATCH 3/4] move preparemetadata.sh to installers folder --- .../scripts/installers/1604/preparemetadata.sh | 13 ------------- .../scripts/installers/1804/preparemetadata.sh | 13 ------------- .../installers/{2004 => }/preparemetadata.sh | 0 images/linux/ubuntu1604.json | 2 +- images/linux/ubuntu1804.json | 2 +- images/linux/ubuntu2004.json | 2 +- 6 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 images/linux/scripts/installers/1604/preparemetadata.sh delete mode 100644 images/linux/scripts/installers/1804/preparemetadata.sh rename images/linux/scripts/installers/{2004 => }/preparemetadata.sh (100%) diff --git a/images/linux/scripts/installers/1604/preparemetadata.sh b/images/linux/scripts/installers/1604/preparemetadata.sh deleted file mode 100644 index a26e10968..000000000 --- a/images/linux/scripts/installers/1604/preparemetadata.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -################################################################################ -## File: preparemetadata.sh -## Desc: This script adds a image title information to the metadata -## document -################################################################################ - -source $HELPER_SCRIPTS/document.sh - -WriteItem "" -AddTitle "$(lsb_release -ds)" -WriteItem "The following software is installed on machines with the $IMAGE_VERSION update." -WriteItem "***" diff --git a/images/linux/scripts/installers/1804/preparemetadata.sh b/images/linux/scripts/installers/1804/preparemetadata.sh deleted file mode 100644 index e3304945a..000000000 --- a/images/linux/scripts/installers/1804/preparemetadata.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -################################################################################ -## File: preparemetadata.sh -## Desc: This script adds a image title information to the metadata -## document -################################################################################ - -source $HELPER_SCRIPTS/document.sh - -WriteItem "" -AddTitle "$(lsb_release -ds)" -WriteItem "The following software is installed on machines with the $IMAGE_VERSION update." -WriteItem "***" \ No newline at end of file diff --git a/images/linux/scripts/installers/2004/preparemetadata.sh b/images/linux/scripts/installers/preparemetadata.sh similarity index 100% rename from images/linux/scripts/installers/2004/preparemetadata.sh rename to images/linux/scripts/installers/preparemetadata.sh diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 5aa162f0d..dce22d126 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -101,7 +101,7 @@ { "type": "shell", "scripts":[ - "{{template_dir}}/scripts/installers/1604/preparemetadata.sh" + "{{template_dir}}/scripts/installers/preparemetadata.sh" ], "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 8408704f5..7e5421c1b 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -104,7 +104,7 @@ { "type": "shell", "scripts":[ - "{{template_dir}}/scripts/installers/1804/preparemetadata.sh" + "{{template_dir}}/scripts/installers/preparemetadata.sh" ], "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 1026f6de9..508406efe 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -104,7 +104,7 @@ { "type": "shell", "scripts":[ - "{{template_dir}}/scripts/installers/2004/preparemetadata.sh" + "{{template_dir}}/scripts/installers/preparemetadata.sh" ], "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", From 2ab2f90a8ef8fb020b52fc19048be7b154143385 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Thu, 14 May 2020 17:09:27 +0300 Subject: [PATCH 4/4] update preimagedata.sh ubuntu20 --- images/linux/scripts/installers/preimagedata.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/images/linux/scripts/installers/preimagedata.sh b/images/linux/scripts/installers/preimagedata.sh index 91b36a9cb..26be3bfa4 100644 --- a/images/linux/scripts/installers/preimagedata.sh +++ b/images/linux/scripts/installers/preimagedata.sh @@ -6,6 +6,10 @@ os_name=$(lsb_release -ds | sed "s/ /\\\n/g") image_label="ubuntu-$(lsb_release -rs)" github_url="https://github.com/actions/virtual-environments/blob" +if [[ "$image_label" =~ "ubuntu-20" ]]; then + software_url="${github_url}/ubuntu20/${image_version}/images/linux/Ubuntu2004-README.md" +fi + if [[ "$image_label" =~ "ubuntu-18" ]]; then software_url="${github_url}/ubuntu18/${image_version}/images/linux/Ubuntu1804-README.md" fi