diff --git a/images.CI/azure-pipelines/ubuntu2004.yml b/images.CI/azure-pipelines/ubuntu2004.yml new file mode 100644 index 000000000..87e06ad73 --- /dev/null +++ b/images.CI/azure-pipelines/ubuntu2004.yml @@ -0,0 +1,20 @@ +schedules: +- cron: "0 0 * * *" + displayName: Daily + branches: + include: + - master + always: true + +trigger: none +pr: + autoCancel: true + branches: + include: + - master + +jobs: +- template: image-generation.yml + parameters: + image_type: ubuntu2004 + image_readme_name: Ubuntu2004-README.md \ No newline at end of file diff --git a/images/linux/config/ubuntu2004.conf b/images/linux/config/ubuntu2004.conf new file mode 100644 index 000000000..63c41c268 --- /dev/null +++ b/images/linux/config/ubuntu2004.conf @@ -0,0 +1,2 @@ +# Name of pool supported by this image +POOL_NAME="Ubuntu 2004" diff --git a/images/linux/scripts/helpers/os.sh b/images/linux/scripts/helpers/os.sh index fa2d4cf44..9c30c811a 100644 --- a/images/linux/scripts/helpers/os.sh +++ b/images/linux/scripts/helpers/os.sh @@ -6,15 +6,20 @@ 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 { - isUbuntu16 && echo xenial || echo bionic + lsb_release -cs } \ No newline at end of file diff --git a/images/linux/scripts/installers/1604/php.sh b/images/linux/scripts/installers/1604/php.sh deleted file mode 100644 index d22090417..000000000 --- a/images/linux/scripts/installers/1604/php.sh +++ /dev/null @@ -1,313 +0,0 @@ -#!/bin/bash -################################################################################ -## File: php.sh -## Desc: Installs php -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/etc-environment.sh -source $HELPER_SCRIPTS/document.sh - -LSB_RELEASE=$(lsb_release -rs) - -set -e - -apt-add-repository ppa:ondrej/php -y - -# Install php5.6 -apt-get update -apt-fast install -y --no-install-recommends \ - php5.6 \ - php5.6-bcmath \ - php5.6-bz2 \ - php5.6-cgi \ - php5.6-cli \ - php5.6-common \ - php5.6-curl \ - php5.6-dba \ - php5.6-dev \ - php5.6-enchant \ - php5.6-fpm \ - php5.6-gd \ - php5.6-gmp \ - php5.6-imap \ - php5.6-interbase \ - php5.6-intl \ - php5.6-json \ - php5.6-ldap \ - php5.6-mbstring \ - php5.6-mcrypt \ - php5.6-mysql \ - php5.6-odbc \ - php5.6-opcache \ - php5.6-pgsql \ - php5.6-phpdbg \ - php5.6-pspell \ - php5.6-readline \ - php5.6-recode \ - php5.6-snmp \ - php5.6-soap \ - php5.6-sqlite3 \ - php5.6-sybase \ - php5.6-tidy \ - php5.6-xml \ - php5.6-xmlrpc \ - php5.6-xsl \ - php5.6-zip -apt-get remove --purge -yq php5.6-dev - -# Install php7.0 -apt-fast install -y --no-install-recommends \ - php7.0 \ - php7.0-bcmath \ - php7.0-bz2 \ - php7.0-cgi \ - php7.0-cli \ - php7.0-common \ - php7.0-curl \ - php7.0-dba \ - php7.0-dev \ - php7.0-enchant \ - php7.0-fpm \ - php7.0-gd \ - php7.0-gmp \ - php7.0-imap \ - php7.0-interbase \ - php7.0-intl \ - php7.0-json \ - php7.0-ldap \ - php7.0-mbstring \ - php7.0-mcrypt \ - php7.0-mysql \ - php7.0-odbc \ - php7.0-opcache \ - php7.0-pgsql \ - php7.0-phpdbg \ - php7.0-pspell \ - php7.0-readline \ - php7.0-recode \ - php7.0-snmp \ - php7.0-soap \ - php7.0-sqlite3 \ - php7.0-sybase \ - php7.0-tidy \ - php7.0-xml \ - php7.0-xmlrpc \ - php7.0-xsl \ - php7.0-zip -apt-get remove --purge -yq php7.0-dev - -# Install php7.1 -apt-fast install -y --no-install-recommends \ - php7.1 \ - php7.1-bcmath \ - php7.1-bz2 \ - php7.1-cgi \ - php7.1-cli \ - php7.1-common \ - php7.1-curl \ - php7.1-dba \ - php7.1-dev \ - php7.1-enchant \ - php7.1-fpm \ - php7.1-gd \ - php7.1-gmp \ - php7.1-imap \ - php7.1-interbase \ - php7.1-intl \ - php7.1-json \ - php7.1-ldap \ - php7.1-mbstring \ - php7.1-mcrypt \ - php7.1-mysql \ - php7.1-odbc \ - php7.1-opcache \ - php7.1-pgsql \ - php7.1-phpdbg \ - php7.1-pspell \ - php7.1-readline \ - php7.1-recode \ - php7.1-snmp \ - php7.1-soap \ - php7.1-sqlite3 \ - php7.1-sybase \ - php7.1-tidy \ - php7.1-xml \ - php7.1-xmlrpc \ - php7.1-xsl \ - php7.1-zip -apt-get remove --purge -yq php7.1-dev - -# Install php7.2 -apt-fast install -y --no-install-recommends \ - php7.2 \ - php7.2-bcmath \ - php7.2-bz2 \ - php7.2-cgi \ - php7.2-cli \ - php7.2-common \ - php7.2-curl \ - php7.2-dba \ - php7.2-dev \ - php7.2-enchant \ - php7.2-fpm \ - php7.2-gd \ - php7.2-gmp \ - php7.2-imap \ - php7.2-interbase \ - php7.2-intl \ - php7.2-json \ - php7.2-ldap \ - php7.2-mbstring \ - php7.2-mysql \ - php7.2-odbc \ - php7.2-opcache \ - php7.2-pgsql \ - php7.2-phpdbg \ - php7.2-pspell \ - php7.2-readline \ - php7.2-recode \ - php7.2-snmp \ - php7.2-soap \ - php7.2-sqlite3 \ - php7.2-sybase \ - php7.2-tidy \ - php7.2-xml \ - php7.2-xmlrpc \ - php7.2-xsl \ - php7.2-zip - -# Install php7.3 -apt-fast install -y --no-install-recommends \ - php7.3 \ - php7.3-bcmath \ - php7.3-bz2 \ - php7.3-cgi \ - php7.3-cli \ - php7.3-common \ - php7.3-curl \ - php7.3-dba \ - php7.3-dev \ - php7.3-enchant \ - php7.3-fpm \ - php7.3-gd \ - php7.3-gmp \ - php7.3-imap \ - php7.3-interbase \ - php7.3-intl \ - php7.3-json \ - php7.3-ldap \ - php7.3-mbstring \ - php7.3-mysql \ - php7.3-odbc \ - php7.3-opcache \ - php7.3-pgsql \ - php7.3-phpdbg \ - php7.3-pspell \ - php7.3-readline \ - php7.3-recode \ - php7.3-snmp \ - php7.3-soap \ - php7.3-sqlite3 \ - php7.3-sybase \ - php7.3-tidy \ - php7.3-xml \ - php7.3-xmlrpc \ - php7.3-xsl \ - php7.3-zip - -# Install php7.4 -apt-fast install -y --no-install-recommends \ - php7.4 \ - php7.4-bcmath \ - php7.4-bz2 \ - php7.4-cgi \ - php7.4-cli \ - php7.4-common \ - php7.4-curl \ - php7.4-dba \ - php7.4-dev \ - php7.4-enchant \ - php7.4-fpm \ - php7.4-gd \ - php7.4-gmp \ - php7.4-imap \ - php7.4-interbase \ - php7.4-intl \ - php7.4-json \ - php7.4-ldap \ - php7.4-mbstring \ - php7.4-mysql \ - php7.4-odbc \ - php7.4-opcache \ - php7.4-pgsql \ - php7.4-phpdbg \ - php7.4-pspell \ - php7.4-readline \ - php7.4-snmp \ - php7.4-soap \ - php7.4-sqlite3 \ - php7.4-sybase \ - php7.4-tidy \ - php7.4-xml \ - php7.4-xmlrpc \ - php7.4-xsl \ - php7.4-zip - -apt-fast install -y --no-install-recommends \ - php-amqp \ - php-apcu \ - php-igbinary \ - php-memcache \ - php-memcached \ - php-mongodb \ - php-redis \ - php-xdebug \ - php-yaml \ - php-zmq - -apt-get remove --purge -yq php7.2-dev - -apt-fast install -y --no-install-recommends snmp - -# Install composer -php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -php composer-setup.php -sudo mv composer.phar /usr/bin/composer -php -r "unlink('composer-setup.php');" - -# Update /etc/environment -prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin - -# Add composer bin folder to path -echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc - -#Create composer folder for user to preserve folder permissions -mkdir -p /etc/skel/.composer - -# Install phpunit (for PHP) -wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar -chmod +x phpunit -mv phpunit /usr/local/bin/phpunit - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in php php5.6 php7.0 php7.1 php7.2 php7.3 php7.4 composer phpunit; do - if ! command -v $cmd; then - echo "$cmd was not installed" - exit 1 - fi -done - - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "PHP 5.6 ($(php5.6 --version | head -n 1))" -DocumentInstalledItem "PHP 7.0 ($(php7.0 --version | head -n 1))" -DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" -DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" -DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" -DocumentInstalledItem "PHP 7.4 ($(php7.4 --version | head -n 1))" -DocumentInstalledItem "Composer ($(composer --version))" -DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/1804/mercurial.sh b/images/linux/scripts/installers/1804/mercurial.sh deleted file mode 100644 index abd9cdb0d..000000000 --- a/images/linux/scripts/installers/1804/mercurial.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -################################################################################ -## File: mercurial.sh -## Desc: Installs Mercurial -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -apt-get install -y --no-install-recommends mercurial - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v hg; then - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" diff --git a/images/linux/scripts/installers/1804/php.sh b/images/linux/scripts/installers/1804/php.sh deleted file mode 100644 index cbf253935..000000000 --- a/images/linux/scripts/installers/1804/php.sh +++ /dev/null @@ -1,227 +0,0 @@ -#!/bin/bash -################################################################################ -## File: php.sh -## Desc: Installs php -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/etc-environment.sh -source $HELPER_SCRIPTS/document.sh - -LSB_RELEASE=$(lsb_release -rs) - -set -e - -apt-add-repository ppa:ondrej/php -y - -# Install php7.1 -apt-fast install -y --no-install-recommends \ - php7.1 \ - php7.1-bcmath \ - php7.1-bz2 \ - php7.1-cgi \ - php7.1-cli \ - php7.1-common \ - php7.1-curl \ - php7.1-dba \ - php7.1-dev \ - php7.1-enchant \ - php7.1-fpm \ - php7.1-gd \ - php7.1-gmp \ - php7.1-imap \ - php7.1-interbase \ - php7.1-intl \ - php7.1-json \ - php7.1-ldap \ - php7.1-mbstring \ - php7.1-mcrypt \ - php7.1-mysql \ - php7.1-odbc \ - php7.1-opcache \ - php7.1-pgsql \ - php7.1-phpdbg \ - php7.1-pspell \ - php7.1-readline \ - php7.1-recode \ - php7.1-snmp \ - php7.1-soap \ - php7.1-sqlite3 \ - php7.1-sybase \ - php7.1-tidy \ - php7.1-xml \ - php7.1-xmlrpc \ - php7.1-xsl \ - php7.1-zip -apt-get remove --purge -yq php7.1-dev - -# Install php7.2 -apt-fast install -y --no-install-recommends \ - php7.2 \ - php7.2-bcmath \ - php7.2-bz2 \ - php7.2-cgi \ - php7.2-cli \ - php7.2-common \ - php7.2-curl \ - php7.2-dba \ - php7.2-dev \ - php7.2-enchant \ - php7.2-fpm \ - php7.2-gd \ - php7.2-gmp \ - php7.2-imap \ - php7.2-interbase \ - php7.2-intl \ - php7.2-json \ - php7.2-ldap \ - php7.2-mbstring \ - php7.2-mysql \ - php7.2-odbc \ - php7.2-opcache \ - php7.2-pgsql \ - php7.2-phpdbg \ - php7.2-pspell \ - php7.2-readline \ - php7.2-recode \ - php7.2-snmp \ - php7.2-soap \ - php7.2-sqlite3 \ - php7.2-sybase \ - php7.2-tidy \ - php7.2-xml \ - php7.2-xmlrpc \ - php7.2-xsl \ - php7.2-zip - -# Install php7.3 -apt-fast install -y --no-install-recommends \ - php7.3 \ - php7.3-bcmath \ - php7.3-bz2 \ - php7.3-cgi \ - php7.3-cli \ - php7.3-common \ - php7.3-curl \ - php7.3-dba \ - php7.3-dev \ - php7.3-enchant \ - php7.3-fpm \ - php7.3-gd \ - php7.3-gmp \ - php7.3-imap \ - php7.3-interbase \ - php7.3-intl \ - php7.3-json \ - php7.3-ldap \ - php7.3-mbstring \ - php7.3-mysql \ - php7.3-odbc \ - php7.3-opcache \ - php7.3-pgsql \ - php7.3-phpdbg \ - php7.3-pspell \ - php7.3-readline \ - php7.3-recode \ - php7.3-snmp \ - php7.3-soap \ - php7.3-sqlite3 \ - php7.3-sybase \ - php7.3-tidy \ - php7.3-xml \ - php7.3-xmlrpc \ - php7.3-xsl \ - php7.3-zip - -# Install php7.4 -apt-fast install -y --no-install-recommends \ - php7.4 \ - php7.4-bcmath \ - php7.4-bz2 \ - php7.4-cgi \ - php7.4-cli \ - php7.4-common \ - php7.4-curl \ - php7.4-dba \ - php7.4-dev \ - php7.4-enchant \ - php7.4-fpm \ - php7.4-gd \ - php7.4-gmp \ - php7.4-imap \ - php7.4-interbase \ - php7.4-intl \ - php7.4-json \ - php7.4-ldap \ - php7.4-mbstring \ - php7.4-mysql \ - php7.4-odbc \ - php7.4-opcache \ - php7.4-pgsql \ - php7.4-phpdbg \ - php7.4-pspell \ - php7.4-readline \ - php7.4-snmp \ - php7.4-soap \ - php7.4-sqlite3 \ - php7.4-sybase \ - php7.4-tidy \ - php7.4-xml \ - php7.4-xmlrpc \ - php7.4-xsl \ - php7.4-zip - -apt-fast install -y --no-install-recommends \ - php-amqp \ - php-apcu \ - php-igbinary \ - php-memcache \ - php-memcached \ - php-mongodb \ - php-redis \ - php-xdebug \ - php-yaml \ - php-zmq - -apt-get remove --purge -yq php7.2-dev - -apt-fast install -y --no-install-recommends snmp - -# Install composer -php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -php composer-setup.php -sudo mv composer.phar /usr/bin/composer -php -r "unlink('composer-setup.php');" - -# Update /etc/environment -prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin - -# Add composer bin folder to path -echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc - -#Create composer folder for user to preserve folder permissions -mkdir -p /etc/skel/.composer - -# Install phpunit (for PHP) -wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar -chmod +x phpunit -mv phpunit /usr/local/bin/phpunit - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in php php7.1 php7.2 php7.3 php7.4 composer phpunit; do - if ! command -v $cmd; then - echo "$cmd was not installed" - exit 1 - fi -done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" -DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" -DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" -DocumentInstalledItem "PHP 7.4 ($(php7.4 --version | head -n 1))" -DocumentInstalledItem "Composer ($(composer --version))" -DocumentInstalledItem "PHPUnit ($(phpunit --version))" 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/android.sh b/images/linux/scripts/installers/2004/android.sh new file mode 100644 index 000000000..8c863ab04 --- /dev/null +++ b/images/linux/scripts/installers/2004/android.sh @@ -0,0 +1,94 @@ +#!/bin/bash +################################################################################ +## File: android.sh +## Desc: Installs Android SDK +################################################################################ + +set -e + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/os.sh + +# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables) +ANDROID_ROOT=/usr/local/lib/android +ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk +echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# ANDROID_HOME is deprecated, but older versions of Gradle rely on it +echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# Create android sdk directory +mkdir -p ${ANDROID_SDK_ROOT} + +# Download the latest command line tools so that we can accept all of the licenses. +# See https://developer.android.com/studio/#command-tools +wget -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip +unzip android-sdk.zip -d ${ANDROID_SDK_ROOT} +rm -f android-sdk.zip + +# Add required permissions +chmod -R a+X ${ANDROID_SDK_ROOT} + +if isUbuntu20 ; then + # Sdk manager doesn't work with Java > 8, set version 8 explicitly + sed -i "2i export JAVA_HOME=${JAVA_HOME_8_X64}" /usr/local/lib/android/sdk/tools/bin/sdkmanager +fi + +# Check sdk manager installation +/usr/local/lib/android/sdk/tools/bin/sdkmanager --list 1>/dev/null +if [ $? -eq 0 ] +then + echo "Android SDK manager was installed" +else + echo "Android SDK manager was not installed" + exit 1 +fi + +# Install the following SDKs and build tools, passing in "y" to accept licenses. +echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \ + "ndk-bundle" \ + "platform-tools" \ + "platforms;android-29" \ + "platforms;android-28" \ + "platforms;android-27" \ + "build-tools;29.0.3" \ + "build-tools;29.0.2" \ + "build-tools;29.0.0" \ + "build-tools;28.0.3" \ + "build-tools;28.0.2" \ + "build-tools;28.0.1" \ + "build-tools;28.0.0" \ + "build-tools;27.0.3" \ + "build-tools;27.0.2" \ + "build-tools;27.0.1" \ + "build-tools;27.0.0" \ + "extras;android;m2repository" \ + "extras;google;m2repository" \ + "extras;google;google_play_services" \ + "cmake;3.10.2.4988404" \ + "patcher;v4" + +# Document what was added to the image +echo "Lastly, document what was added to the metadata file" +DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)" +DocumentInstalledItem "Android Support Repository 47.0.0" +DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Android SDK Platform 29" +DocumentInstalledItem "Android SDK Platform 28" +DocumentInstalledItem "Android SDK Platform 27" +DocumentInstalledItem "Android SDK Patch Applier v4" +DocumentInstalledItem "Android SDK Build-Tools 29.0.3" +DocumentInstalledItem "Android SDK Build-Tools 29.0.2" +DocumentInstalledItem "Android SDK Build-Tools 29.0.0" +DocumentInstalledItem "Android SDK Build-Tools 28.0.3" +DocumentInstalledItem "Android SDK Build-Tools 28.0.2" +DocumentInstalledItem "Android SDK Build-Tools 28.0.1" +DocumentInstalledItem "Android SDK Build-Tools 28.0.0" +DocumentInstalledItem "Android SDK Build-Tools 27.0.3" +DocumentInstalledItem "Android SDK Build-Tools 27.0.2" +DocumentInstalledItem "Android SDK Build-Tools 27.0.1" +DocumentInstalledItem "Android SDK Build-Tools 27.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/2004/containers.sh b/images/linux/scripts/installers/2004/containers.sh new file mode 100644 index 000000000..0ccf746ab --- /dev/null +++ b/images/linux/scripts/installers/2004/containers.sh @@ -0,0 +1,24 @@ +#!/bin/bash +################################################################################ +## File: containers.sh +## Desc: Installs container tools: podman, buildah and skopeo onto the image +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +source /etc/os-release +sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key +apt-key add - < Release.key +apt-get update -qq +apt-get -qq -y install podman buildah skopeo +mkdir -p /etc/containers +echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf + +## Add version information to the metadata file +echo "Documenting container tools version" +PODMAN_VERSION='podman --version' +BUILDAH_VERSION='buildah --version' +SKOPEO_VERSION='skopeo --version' +DocumentInstalledItem "Podman ($PODMAN_VERSION)\nBuildah ($BUILDAH_VERSION)\nSkopeo ($SKOPEO_VERSION)" diff --git a/images/linux/scripts/installers/ansible.sh b/images/linux/scripts/installers/ansible.sh index b4e8a4d7d..fcf039308 100644 --- a/images/linux/scripts/installers/ansible.sh +++ b/images/linux/scripts/installers/ansible.sh @@ -6,11 +6,15 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/os.sh -# Install Ansible PPA and latest Ansible -add-apt-repository ppa:ansible/ansible -apt-get update +# ppa:ansible/ansible doesn't contain packages for Ubuntu20.04 +if isUbuntu16 || isUbuntu18 ; then + add-apt-repository ppa:ansible/ansible + apt-get update +fi + +# Install latest Ansible apt-get install -y --no-install-recommends ansible # Run tests to determine that the software installed as expected diff --git a/images/linux/scripts/installers/azpowershell.sh b/images/linux/scripts/installers/azpowershell.sh index feef2d62b..9f43f85e1 100644 --- a/images/linux/scripts/installers/azpowershell.sh +++ b/images/linux/scripts/installers/azpowershell.sh @@ -6,6 +6,29 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/os.sh + +# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +if isUbuntu20 ; then + latestVersion=$(pwsh -Command '(Find-Module -Name Az).Version') + modulePath="/usr/share/az_$latestVersion" + echo "Save Az Module ($latestVersion) to $modulePath" + pwsh -Command "Save-Module -Name Az -LiteralPath $modulePath -RequiredVersion $latestVersion -Force" + + # Run tests to determine that the software installed as expected + echo "Testing to make sure that script performed as expected, and basic scenarios work" + if ! pwsh -Command "\$env:PSModulePath = '${modulePath}:' + \$env:PSModulePath + if ( -not (Get-Module -ListAvailable -Name Az.Accounts)) { + Write-Host 'Az Module was not installed' + exit 1 + }"; then + exit 1 + fi + + # Document what was added to the image + DocumentInstalledItem "Az Module ($latestVersion)" + exit 0 +fi # Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.0.0 -RequiredVersion 1.0.0 -Force' diff --git a/images/linux/scripts/installers/1804/basic.sh b/images/linux/scripts/installers/basic.sh similarity index 93% rename from images/linux/scripts/installers/1804/basic.sh rename to images/linux/scripts/installers/basic.sh index c16b53de7..542380522 100644 --- a/images/linux/scripts/installers/1804/basic.sh +++ b/images/linux/scripts/installers/basic.sh @@ -7,9 +7,15 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/os.sh set -e +if isUbuntu20 ; then + echo "Install python2" + apt-get install -y --no-install-recommends python-is-python2 +fi + echo "Install dnsutils" apt-get install -y --no-install-recommends dnsutils @@ -28,8 +34,16 @@ apt-get install -y --no-install-recommends iputils-ping echo "Install jq" apt-get install -y --no-install-recommends jq -echo "Install libcurl3" -apt-get install -y --no-install-recommends libcurl3 +echo "Install libcurl" +if isUbuntu18 ; then + libcurelVer="libcurl3" +fi + +if isUbuntu20 ; then + libcurelVer="libcurl4" +fi + +apt-get install -y --no-install-recommends $libcurelVer echo "Install libunwind8" apt-get install -y --no-install-recommends libunwind8 @@ -162,7 +176,7 @@ DocumentInstalledItemIndent "ftp" DocumentInstalledItemIndent "iproute2" DocumentInstalledItemIndent "iputils-ping" DocumentInstalledItemIndent "jq" -DocumentInstalledItemIndent "libcurl3" +DocumentInstalledItemIndent "$libcurelVer" DocumentInstalledItemIndent "libgbm-dev" DocumentInstalledItemIndent "libicu55" DocumentInstalledItemIndent "libunwind8" diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index 70d712e28..06323d0ef 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -6,10 +6,18 @@ source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/os.sh -LATEST_DOTNET_PACKAGES=("dotnet-sdk-3.0" "dotnet-sdk-3.1") +# Ubuntu 20 doesn't support EOL versions +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 -LSB_RELEASE=$(lsb_release -rs) +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 mksamples() { @@ -37,19 +45,13 @@ 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..." - #temporary avoid 3.1.102 installation due to https://github.com/dotnet/aspnetcore/issues/19133 - if [ $latest_package != "dotnet-sdk-3.1" ]; then - apt-get install $latest_package -y - else - apt-get install dotnet-sdk-3.1=3.1.101-1 -y - fi + 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}" diff --git a/images/linux/scripts/installers/go.sh b/images/linux/scripts/installers/go.sh index c454f59ff..617c406d8 100644 --- a/images/linux/scripts/installers/go.sh +++ b/images/linux/scripts/installers/go.sh @@ -46,7 +46,7 @@ function getFullGoVersion () { } # load golang_tags.json file -curl -s 'https://api.github.com/repos/golang/go/git/refs/tags' >> $golangTags +curl -s 'https://api.github.com/repos/golang/go/git/refs/tags' > $golangTags # Install Go versions for go in ${GO_VERSIONS}; do echo "Installing Go ${go}" diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index 1335c504e..af9facd1b 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,23 +15,24 @@ 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.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 +if isUbuntu20 ; then + ghcVersions="8.6.5 8.8.3 8.10.1" + cabalVersions="3.2" +fi + +if isUbuntu16 || isUbuntu18 ; then + # Install various versions of ghc and cabal + 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 + +for version in $ghcVersions; do + apt-get install -y ghc-$version +done + +for version in $cabalVersions; do + apt-get install -y cabal-install-$version +done # Install the latest stable release of haskell stack curl -sSL https://get.haskellstack.org/ | sh @@ -39,14 +40,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.2 8.6.3 8.6.4 8.6.5 8.8.1 8.8.2 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.0 2.2 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 @@ -59,10 +60,10 @@ fi # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" -for version in 2.0 2.2 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.2 8.6.3 8.6.4 8.6.5 8.8.1 8.8.2 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/scripts/installers/java-tools.sh b/images/linux/scripts/installers/java-tools.sh index c4586039b..ffc57f735 100644 --- a/images/linux/scripts/installers/java-tools.sh +++ b/images/linux/scripts/installers/java-tools.sh @@ -6,8 +6,7 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh - -DEFAULT_JDK_VERSION=8 +source $HELPER_SCRIPTS/os.sh set -e @@ -16,12 +15,24 @@ set -e apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 apt-add-repository "deb http://repos.azul.com/azure-only/zulu/apt stable main" apt-get -q update -apt-get -y install zulu-7-azure-jdk=\* + +if isUbuntu16 || isUbuntu18 ; then + apt-get -y install zulu-7-azure-jdk=\* + echo "JAVA_HOME_7_X64=/usr/lib/jvm/zulu-7-azure-amd64" | tee -a /etc/environment + DEFAULT_JDK_VERSION=8 + defaultLabel8="(default)" +fi + +if isUbuntu20 ; then + DEFAULT_JDK_VERSION=11 + defaultLabel11="(default)" +fi + apt-get -y install zulu-8-azure-jdk=\* apt-get -y install zulu-11-azure-jdk=\* apt-get -y install zulu-12-azure-jdk=\* update-java-alternatives -s /usr/lib/jvm/zulu-8-azure-amd64 -echo "JAVA_HOME_7_X64=/usr/lib/jvm/zulu-7-azure-amd64" | tee -a /etc/environment + echo "JAVA_HOME_8_X64=/usr/lib/jvm/zulu-8-azure-amd64" | tee -a /etc/environment echo "JAVA_HOME_11_X64=/usr/lib/jvm/zulu-11-azure-amd64" | tee -a /etc/environment echo "JAVA_HOME_12_X64=/usr/lib/jvm/zulu-12-azure-amd64" | tee -a /etc/environment @@ -69,9 +80,11 @@ done # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Azul Zulu OpenJDK:" +if isUbuntu16 || isUbuntu18 ; then DocumentInstalledItemIndent "7 ($(/usr/lib/jvm/zulu-7-azure-amd64/bin/java -showversion |& head -n 1))" -DocumentInstalledItemIndent "8 ($(/usr/lib/jvm/zulu-8-azure-amd64/bin/java -showversion |& head -n 1)) (default)" -DocumentInstalledItemIndent "11 ($(/usr/lib/jvm/zulu-11-azure-amd64/bin/java -showversion |& head -n 1))" +fi +DocumentInstalledItemIndent "8 ($(/usr/lib/jvm/zulu-8-azure-amd64/bin/java -showversion |& head -n 1)) $defaultLabel8" +DocumentInstalledItemIndent "11 ($(/usr/lib/jvm/zulu-11-azure-amd64/bin/java -showversion |& head -n 1)) $defaultLabel11" DocumentInstalledItemIndent "12 ($(/usr/lib/jvm/zulu-12-azure-amd64/bin/java -showversion |& head -n 1))" DocumentInstalledItem "Ant ($(ant -version))" DocumentInstalledItem "Gradle ${gradleVersion}" diff --git a/images/linux/scripts/installers/1604/mercurial.sh b/images/linux/scripts/installers/mercurial.sh similarity index 72% rename from images/linux/scripts/installers/1604/mercurial.sh rename to images/linux/scripts/installers/mercurial.sh index 584131fe0..77e5bc857 100644 --- a/images/linux/scripts/installers/1604/mercurial.sh +++ b/images/linux/scripts/installers/mercurial.sh @@ -7,11 +7,15 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/os.sh + +if isUbuntu16 ; then + # Install Mercurial from the mercurial-ppa/releases repository for the latest version for Ubuntu16. + # https://www.mercurial-scm.org/wiki/Download + add-apt-repository ppa:mercurial-ppa/releases -y + apt-get update +fi -# Install Mercurial from the mercurial-ppa/releases repository for the latest version. -# https://www.mercurial-scm.org/wiki/Download -add-apt-repository ppa:mercurial-ppa/releases -y -apt-get update apt-get install -y --no-install-recommends mercurial # Run tests to determine that the software installed as expected diff --git a/images/linux/scripts/installers/php.sh b/images/linux/scripts/installers/php.sh new file mode 100644 index 000000000..a63c4b717 --- /dev/null +++ b/images/linux/scripts/installers/php.sh @@ -0,0 +1,137 @@ +#!/bin/bash +################################################################################ +## File: php.sh +## Desc: Installs php +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/etc-environment.sh +source $HELPER_SCRIPTS/document.sh + +set -e + +# add repository +apt-add-repository ppa:ondrej/php -y +apt-get update + +# Install PHP +if isUbuntu16 ; then + php_versions="5.6 7.0 7.1 7.2 7.3 7.4" +fi + +if isUbuntu18 ; then + php_versions="7.1 7.2 7.3 7.4" +fi + +if isUbuntu20 ; then + php_versions="7.4" +fi + +for version in $php_versions; do + echo "Installing PHP $version" + apt-fast install -y --no-install-recommends \ + php$version \ + php$version-bcmath \ + php$version-bz2 \ + php$version-cgi \ + php$version-cli \ + php$version-common \ + php$version-curl \ + php$version-dba \ + php$version-dev \ + php$version-enchant \ + php$version-fpm \ + php$version-gd \ + php$version-gmp \ + php$version-imap \ + php$version-interbase \ + php$version-intl \ + php$version-json \ + php$version-ldap \ + php$version-mbstring \ + php$version-mysql \ + php$version-odbc \ + php$version-opcache \ + php$version-pgsql \ + php$version-phpdbg \ + php$version-pspell \ + php$version-readline \ + php$version-snmp \ + php$version-soap \ + php$version-sqlite3 \ + php$version-sybase \ + php$version-tidy \ + php$version-xml \ + php$version-xmlrpc \ + php$version-xsl \ + php$version-zip + + if [[ $version == "5.6" || $version == "7.0" || $version == "7.1" ]]; then + apt-fast install -y --no-install-recommends php$version-mcrypt php$version-recode + apt-get remove --purge -yq php$version-dev + fi + + if [[ $version == "7.2" || $version == "7.3" ]]; then + apt-fast install -y --no-install-recommends php$version-recode + fi +done + +apt-fast install -y --no-install-recommends \ + php-amqp \ + php-apcu \ + php-igbinary \ + php-memcache \ + php-memcached \ + php-mongodb \ + php-redis \ + php-xdebug \ + php-yaml \ + php-zmq + +apt-get remove --purge -yq php7.2-dev + +apt-fast install -y --no-install-recommends snmp + +# Install composer +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +php composer-setup.php +sudo mv composer.phar /usr/bin/composer +php -r "unlink('composer-setup.php');" + +# Update /etc/environment +prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin + +# Add composer bin folder to path +echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc + +#Create composer folder for user to preserve folder permissions +mkdir -p /etc/skel/.composer + +# Install phpunit (for PHP) +wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar +chmod +x phpunit +mv phpunit /usr/local/bin/phpunit + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in php $php_versions composer phpunit; do + if [[ $cmd =~ ^[0-9] ]]; then + cmd="php$cmd" + fi + + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" + +for version in $php_versions; do + DocumentInstalledItem "PHP $version ($(php$version --version | head -n 1))" +done; + +DocumentInstalledItem "Composer ($(composer --version))" +DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/powershellcore.sh b/images/linux/scripts/installers/powershellcore.sh index 5c615ae31..abd5d751d 100644 --- a/images/linux/scripts/installers/powershellcore.sh +++ b/images/linux/scripts/installers/powershellcore.sh @@ -6,9 +6,16 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/os.sh # Install Powershell -apt-get install -y powershell +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" 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 diff --git a/images/linux/scripts/installers/1604/preparemetadata.sh b/images/linux/scripts/installers/preparemetadata.sh similarity index 100% rename from images/linux/scripts/installers/1604/preparemetadata.sh rename to images/linux/scripts/installers/preparemetadata.sh diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index e23d7c0eb..7081c5e7d 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -6,9 +6,19 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/os.sh # Install Python, Python 3, pip, pip3 -apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip +if isUbuntu20 ; then + apt-get install -y --no-install-recommends python3 python3-dev python3-pip + + curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py + python2 get-pip.py +fi + +if isUbuntu16 || isUbuntu18 ; then + apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip +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" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 9ead9a30c..09e7083d8 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -102,7 +102,7 @@ { "type": "shell", "scripts":[ - "{{template_dir}}/scripts/installers/1604/preparemetadata.sh" + "{{template_dir}}/scripts/installers/preparemetadata.sh" ], "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", @@ -208,14 +208,14 @@ "{{template_dir}}/scripts/installers/kind.sh", "{{template_dir}}/scripts/installers/kubernetes-tools.sh", "{{template_dir}}/scripts/installers/leiningen.sh", - "{{template_dir}}/scripts/installers/1604/mercurial.sh", + "{{template_dir}}/scripts/installers/mercurial.sh", "{{template_dir}}/scripts/installers/miniconda.sh", "{{template_dir}}/scripts/installers/mono.sh", "{{template_dir}}/scripts/installers/mysql.sh", "{{template_dir}}/scripts/installers/nodejs.sh", "{{template_dir}}/scripts/installers/bazel.sh", "{{template_dir}}/scripts/installers/phantomjs.sh", - "{{template_dir}}/scripts/installers/1604/php.sh", + "{{template_dir}}/scripts/installers/php.sh", "{{template_dir}}/scripts/installers/pollinate.sh", "{{template_dir}}/scripts/installers/postgresql.sh", "{{template_dir}}/scripts/installers/powershellcore.sh", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 13d379907..d20432b57 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -105,7 +105,7 @@ { "type": "shell", "scripts":[ - "{{template_dir}}/scripts/installers/1804/preparemetadata.sh" + "{{template_dir}}/scripts/installers/preparemetadata.sh" ], "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", @@ -184,7 +184,7 @@ "{{template_dir}}/scripts/installers/azcopy.sh", "{{template_dir}}/scripts/installers/azure-cli.sh", "{{template_dir}}/scripts/installers/azure-devops-cli.sh", - "{{template_dir}}/scripts/installers/1804/basic.sh", + "{{template_dir}}/scripts/installers/basic.sh", "{{template_dir}}/scripts/installers/aliyun-cli.sh", "{{template_dir}}/scripts/installers/aws.sh", "{{template_dir}}/scripts/installers/build-essential.sh", @@ -211,7 +211,7 @@ "{{template_dir}}/scripts/installers/kind.sh", "{{template_dir}}/scripts/installers/kubernetes-tools.sh", "{{template_dir}}/scripts/installers/leiningen.sh", - "{{template_dir}}/scripts/installers/1804/mercurial.sh", + "{{template_dir}}/scripts/installers/mercurial.sh", "{{template_dir}}/scripts/installers/miniconda.sh", "{{template_dir}}/scripts/installers/mono.sh", "{{template_dir}}/scripts/installers/mysql.sh", @@ -219,7 +219,7 @@ "{{template_dir}}/scripts/installers/nodejs.sh", "{{template_dir}}/scripts/installers/bazel.sh", "{{template_dir}}/scripts/installers/phantomjs.sh", - "{{template_dir}}/scripts/installers/1804/php.sh", + "{{template_dir}}/scripts/installers/php.sh", "{{template_dir}}/scripts/installers/pollinate.sh", "{{template_dir}}/scripts/installers/postgresql.sh", "{{template_dir}}/scripts/installers/powershellcore.sh", diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json new file mode 100644 index 000000000..f8f61f841 --- /dev/null +++ b/images/linux/ubuntu2004.json @@ -0,0 +1,335 @@ +{ + "variables": { + "commit_url": "{{env `COMMIT_URL`}}", + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", + "tenant_id": "{{env `ARM_TENANT_ID`}}", + "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", + "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", + "temp_resource_group_name": "{{env `TEMP_RESOURCE_GROUP_NAME`}}", + "location": "{{env `ARM_RESOURCE_LOCATION`}}", + "virtual_network_name": "{{env `VNET_NAME`}}", + "virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}", + "virtual_network_subnet_name": "{{env `VNET_SUBNET`}}", + "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", + "image_folder": "/imagegeneration", + "commit_file": "/imagegeneration/commit.txt", + "imagedata_file": "/imagegeneration/imagedata.json", + "metadata_file": "/imagegeneration/metadatafile", + "installer_script_folder": "/imagegeneration/installers", + "helper_script_folder": "/imagegeneration/helpers", + "vm_size": "Standard_DS2_v2", + "capture_name_prefix": "packer", + "image_version": "dev", + "image_os": "ubuntu20", + "github_feed_token": null, + "run_validation_diskspace": "false", + "go_default": "1.14", + "go_versions": "1.14" + }, + "sensitive-variables": ["client_secret", "github_feed_token"], + "builders": [ + { + "type": "azure-arm", + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + "tenant_id": "{{user `tenant_id`}}", + + "location": "{{user `location`}}", + "vm_size": "{{user `vm_size`}}", + "resource_group_name": "{{user `resource_group`}}", + "storage_account": "{{user `storage_account`}}", + "temp_resource_group_name": "{{user `temp_resource_group_name`}}", + "capture_container_name": "images", + "capture_name_prefix": "{{user `capture_name_prefix`}}", + "virtual_network_name": "{{user `virtual_network_name`}}", + "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}", + "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}", + "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}", + "os_type": "Linux", + "image_publisher": "canonical", + "image_offer": "0001-com-ubuntu-server-focal", + "image_sku": "20_04-lts", + "os_disk_size_gb": "86" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ + "mkdir {{user `image_folder`}}", + "chmod 777 {{user `image_folder`}}", + "echo {{user `commit_url`}} > {{user `commit_file`}}", + "chmod +r {{user `commit_file`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/base/repos.sh" + ], + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "apt-get update", + "apt-get dist-upgrade -y", + "systemctl disable apt-daily.service", + "systemctl disable apt-daily.timer", + "systemctl disable apt-daily-upgrade.timer", + "systemctl disable apt-daily-upgrade.service", + "echo '* soft nofile 65536 \n* hard nofile 65536' >> /etc/security/limits.conf", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session-noninteractive", + "echo 'DefaultLimitNOFILE=65536' >> /etc/systemd/system.conf" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/helpers", + "destination": "{{user `helper_script_folder`}}" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/installers", + "destination": "{{user `installer_script_folder`}}" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/preparemetadata.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/preimagedata.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGEDATA_FILE={{user `imagedata_file`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/configure-environment.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGE_OS={{user `image_os`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/complete-snap-setup.sh" + ], + "environment_vars": [ + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "expect_disconnect": true, + "scripts": [ + "{{template_dir}}/scripts/base/reboot.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "pause_before": "30s", + "timeout": "10m", + "start_retry_timeout": "10s", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew-validate.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/7-zip.sh", + "{{template_dir}}/scripts/installers/ansible.sh", + "{{template_dir}}/scripts/installers/azcopy.sh", + "{{template_dir}}/scripts/installers/basic.sh", + "{{template_dir}}/scripts/installers/aliyun-cli.sh", + "{{template_dir}}/scripts/installers/aws.sh", + "{{template_dir}}/scripts/installers/build-essential.sh", + "{{template_dir}}/scripts/installers/clang.sh", + "{{template_dir}}/scripts/installers/swift.sh", + "{{template_dir}}/scripts/installers/cmake.sh", + "{{template_dir}}/scripts/installers/2004/containers.sh", + "{{template_dir}}/scripts/installers/docker-compose.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", + "{{template_dir}}/scripts/installers/gfortran.sh", + "{{template_dir}}/scripts/installers/git.sh", + "{{template_dir}}/scripts/installers/google-chrome.sh", + "{{template_dir}}/scripts/installers/google-cloud-sdk.sh", + "{{template_dir}}/scripts/installers/haskell.sh", + "{{template_dir}}/scripts/installers/heroku.sh", + "{{template_dir}}/scripts/installers/hhvm.sh", + "{{template_dir}}/scripts/installers/image-magick.sh", + "{{template_dir}}/scripts/installers/java-tools.sh", + "{{template_dir}}/scripts/installers/kind.sh", + "{{template_dir}}/scripts/installers/kubernetes-tools.sh", + "{{template_dir}}/scripts/installers/leiningen.sh", + "{{template_dir}}/scripts/installers/mercurial.sh", + "{{template_dir}}/scripts/installers/miniconda.sh", + "{{template_dir}}/scripts/installers/mono.sh", + "{{template_dir}}/scripts/installers/mysql.sh", + "{{template_dir}}/scripts/installers/nvm.sh", + "{{template_dir}}/scripts/installers/nodejs.sh", + "{{template_dir}}/scripts/installers/bazel.sh", + "{{template_dir}}/scripts/installers/phantomjs.sh", + "{{template_dir}}/scripts/installers/php.sh", + "{{template_dir}}/scripts/installers/pollinate.sh", + "{{template_dir}}/scripts/installers/postgresql.sh", + "{{template_dir}}/scripts/installers/powershellcore.sh", + "{{template_dir}}/scripts/installers/ruby.sh", + "{{template_dir}}/scripts/installers/rust.sh", + "{{template_dir}}/scripts/installers/julia.sh", + "{{template_dir}}/scripts/installers/selenium.sh", + "{{template_dir}}/scripts/installers/sphinx.sh", + "{{template_dir}}/scripts/installers/subversion.sh", + "{{template_dir}}/scripts/installers/terraform.sh", + "{{template_dir}}/scripts/installers/packer.sh", + "{{template_dir}}/scripts/installers/vcpkg.sh", + "{{template_dir}}/scripts/installers/zeit-now.sh", + "{{template_dir}}/scripts/installers/dpkg-config.sh", + "{{template_dir}}/scripts/installers/rndgenerator.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/aws-sam-cli.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/go.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "GO_VERSIONS={{user `go_versions`}}", + "GO_DEFAULT={{user `go_default`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/2004/android.sh", + "{{template_dir}}/scripts/installers/azpowershell.sh", + "{{template_dir}}/scripts/installers/python.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/cleanup.sh" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{user `metadata_file`}}", + "destination": "{{template_dir}}/Ubuntu2004-README.md", + "direction": "download" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/validate-disk-space.sh" + ], + "environment_vars": [ + "RUN_VALIDATION={{user `run_validation_diskspace`}}" + ] + }, + { + "type": "shell", + "inline": [ + "rm -rf {{user `helper_script_folder`}}", + "rm -rf {{user `installer_script_folder`}}", + "chmod 755 {{user `image_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/config/ubuntu2004.conf", + "destination": "/tmp/" + }, + { + "type": "shell", + "inline": [ + "mkdir -p /etc/vsts", + "cp /tmp/ubuntu2004.conf /etc/vsts/machine_instance.conf" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "sleep 30", + "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + } + ] +}