From 126aab8b690e9b6a5fc245d76cbc939bef863173 Mon Sep 17 00:00:00 2001 From: CI Date: Fri, 15 Jul 2022 19:40:48 +0000 Subject: [PATCH] Automated update of common script sources and hash --- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/docker-debian.sh | 22 ++++++ .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/docker-debian.sh | 22 ++++++ .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/docker-debian.sh | 22 ++++++ .../docker-in-docker-debian.sh | 75 ++++++++++++++++--- .../library-scripts/git-lfs-debian.sh | 16 +++- .../library-scripts/github-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/sshd-debian.sh | 7 ++ .../library-scripts/docker-debian.sh | 22 ++++++ .../library-scripts/docker-debian.sh | 22 ++++++ .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/docker-debian.sh | 22 ++++++ .../library-scripts/common-debian.sh | 2 +- .../library-scripts/docker-debian.sh | 22 ++++++ .../library-scripts/common-debian.sh | 2 +- .../docker-in-docker-debian.sh | 75 ++++++++++++++++--- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../.devcontainer/Dockerfile | 4 +- containers/elixir/.devcontainer/Dockerfile | 4 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/gradle-debian.sh | 0 .../library-scripts/java-debian.sh | 0 .../library-scripts/maven-debian.sh | 0 .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../docker-in-docker-debian.sh | 75 ++++++++++++++++--- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/docker-debian.sh | 22 ++++++ .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + .../library-scripts/common-debian.sh | 2 +- .../library-scripts/common-debian.sh | 2 +- .../library-scripts/node-debian.sh | 1 + 64 files changed, 437 insertions(+), 71 deletions(-) mode change 100644 => 100755 containers/java-8/.devcontainer/library-scripts/gradle-debian.sh mode change 100644 => 100755 containers/java-8/.devcontainer/library-scripts/java-debian.sh mode change 100644 => 100755 containers/java-8/.devcontainer/library-scripts/maven-debian.sh mode change 100644 => 100755 containers/java-8/.devcontainer/library-scripts/node-debian.sh diff --git a/containers/azure-ansible/.devcontainer/library-scripts/common-debian.sh b/containers/azure-ansible/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/azure-ansible/.devcontainer/library-scripts/common-debian.sh +++ b/containers/azure-ansible/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/azure-ansible/.devcontainer/library-scripts/docker-debian.sh b/containers/azure-ansible/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/azure-ansible/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/azure-ansible/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/azure-ansible/.devcontainer/library-scripts/node-debian.sh b/containers/azure-ansible/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/azure-ansible/.devcontainer/library-scripts/node-debian.sh +++ b/containers/azure-ansible/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/azure-bicep/.devcontainer/library-scripts/common-debian.sh b/containers/azure-bicep/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/azure-bicep/.devcontainer/library-scripts/common-debian.sh +++ b/containers/azure-bicep/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/azure-bicep/.devcontainer/library-scripts/node-debian.sh b/containers/azure-bicep/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/azure-bicep/.devcontainer/library-scripts/node-debian.sh +++ b/containers/azure-bicep/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/azure-cli/.devcontainer/library-scripts/common-debian.sh b/containers/azure-cli/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/azure-cli/.devcontainer/library-scripts/common-debian.sh +++ b/containers/azure-cli/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/azure-static-web-apps/.devcontainer/library-scripts/node-debian.sh b/containers/azure-static-web-apps/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/azure-static-web-apps/.devcontainer/library-scripts/node-debian.sh +++ b/containers/azure-static-web-apps/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/azure-terraform/.devcontainer/library-scripts/common-debian.sh b/containers/azure-terraform/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/azure-terraform/.devcontainer/library-scripts/common-debian.sh +++ b/containers/azure-terraform/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/azure-terraform/.devcontainer/library-scripts/docker-debian.sh b/containers/azure-terraform/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/azure-terraform/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/azure-terraform/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/azure-terraform/.devcontainer/library-scripts/node-debian.sh b/containers/azure-terraform/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/azure-terraform/.devcontainer/library-scripts/node-debian.sh +++ b/containers/azure-terraform/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/bazel/.devcontainer/library-scripts/common-debian.sh b/containers/bazel/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/bazel/.devcontainer/library-scripts/common-debian.sh +++ b/containers/bazel/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/codespaces-linux/.devcontainer/library-scripts/common-debian.sh b/containers/codespaces-linux/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/codespaces-linux/.devcontainer/library-scripts/common-debian.sh +++ b/containers/codespaces-linux/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/codespaces-linux/.devcontainer/library-scripts/docker-debian.sh b/containers/codespaces-linux/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/codespaces-linux/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/codespaces-linux/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/codespaces-linux/.devcontainer/library-scripts/docker-in-docker-debian.sh b/containers/codespaces-linux/.devcontainer/library-scripts/docker-in-docker-debian.sh index 2d37efc302..a525203b1a 100755 --- a/containers/codespaces-linux/.devcontainer/library-scripts/docker-in-docker-debian.sh +++ b/containers/codespaces-linux/.devcontainer/library-scripts/docker-in-docker-debian.sh @@ -15,14 +15,27 @@ USE_MOBY=${3:-"true"} DOCKER_VERSION=${4:-"latest"} # The Docker/Moby Engine + CLI should match in version DOCKER_DASH_COMPOSE_VERSION=${5:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" +# Default: Exit on any failure. set -e +# Setup STDERR. +err() { + echo "(!) $*" >&2 +} + if [ "$(id -u)" -ne 0 ]; then - echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' + err 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' exit 1 fi +################### +# Helper Functions +# See: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/shared/utils.sh +################### + # Determine the appropriate non-root user if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" @@ -97,20 +110,50 @@ find_version_from_git_tags() { declare -g ${variable_name}="$(echo "${version_list}" | head -n 1)" else set +e - declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" + declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" set -e fi fi if [ -z "${!variable_name}" ] || ! echo "${version_list}" | grep "^${!variable_name//./\\.}$" > /dev/null 2>&1; then - echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 + err "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 exit 1 fi echo "${variable_name}=${!variable_name}" } +########################################### +# Start docker-in-docker installation +########################################### + # Ensure apt is in non-interactive to avoid prompts export DEBIAN_FRONTEND=noninteractive + +# Source /etc/os-release to get OS info +. /etc/os-release +# Fetch host/container arch. +architecture="$(dpkg --print-architecture)" + +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Install dependencies check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr if ! type git > /dev/null 2>&1; then @@ -124,10 +167,7 @@ if type iptables-legacy > /dev/null 2>&1; then update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy fi -# Source /etc/os-release to get OS info -. /etc/os-release -# Fetch host/container arch. -architecture="$(dpkg --print-architecture)" + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then @@ -165,11 +205,11 @@ else # Regex needs to handle debian package version number format: https://www.systutorials.com/docs/linux/man/5-deb-version/ docker_version_regex="^(.+:)?${docker_version_dot_plus_escaped}([\\.\\+ ~:-]|$)" set +e # Don't exit if finding version fails - will handle gracefully - cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" - engine_version_suffix="=$(apt-cache madison ${engine_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" + cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" + engine_version_suffix="=$(apt-cache madison ${engine_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" set -e if [ -z "${engine_version_suffix}" ] || [ "${engine_version_suffix}" = "=" ] || [ -z "${cli_version_suffix}" ] || [ "${cli_version_suffix}" = "=" ] ; then - echo "(!) No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" + err "No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+' exit 1 fi @@ -182,8 +222,17 @@ if type docker > /dev/null 2>&1 && type dockerd > /dev/null 2>&1; then echo "Docker / Moby CLI and Engine already installed." else if [ "${USE_MOBY}" = "true" ]; then - apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx moby-engine${engine_version_suffix} - apt-get -y install --no-install-recommends moby-compose || echo "(*) Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." + # Install engine + set +e # Handle error gracefully + apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx moby-engine${engine_version_suffix} + if [ $? -ne 0 ]; then + err "Packages for moby not available in OS ${ID} ${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-20.04')." + exit 1 + fi + set -e + + # Install compose + apt-get -y install --no-install-recommends moby-compose || err "Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." else apt-get -y install --no-install-recommends docker-ce-cli${cli_version_suffix} docker-ce${engine_version_suffix} fi @@ -344,3 +393,5 @@ EOF chmod +x /usr/local/share/docker-init.sh chown ${USERNAME}:root /usr/local/share/docker-init.sh + +echo 'docker-in-docker-debian script has completed!' \ No newline at end of file diff --git a/containers/codespaces-linux/.devcontainer/library-scripts/git-lfs-debian.sh b/containers/codespaces-linux/.devcontainer/library-scripts/git-lfs-debian.sh index dd9e702206..e8d7a06af7 100755 --- a/containers/codespaces-linux/.devcontainer/library-scripts/git-lfs-debian.sh +++ b/containers/codespaces-linux/.devcontainer/library-scripts/git-lfs-debian.sh @@ -140,6 +140,7 @@ install_using_apt() { if ! (apt-get update && apt-get install -yq git-lfs${version_suffix}); then rm -f /etc/apt/sources.list.d/git-lfs.list + echo "Could not fetch git-lfs from apt" return 1 fi @@ -152,6 +153,7 @@ install_using_github() { cd /tmp/git-lfs find_version_from_git_tags GIT_LFS_VERSION "https://github.com/git-lfs/git-lfs" git_lfs_filename="git-lfs-linux-${architecture}-v${GIT_LFS_VERSION}.tar.gz" + echo "Looking for release artfact: ${git_lfs_filename}" curl -sSL -o "${git_lfs_filename}" "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/${git_lfs_filename}" # Verify file curl -sSL -o "sha256sums.asc" "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/sha256sums.asc" @@ -159,8 +161,20 @@ install_using_github() { gpg -q --decrypt "sha256sums.asc" > sha256sums sha256sum --ignore-missing -c "sha256sums" # Extract and install + echo "Validated release artifact integrity." + echo "Starting to extract..." tar xf "${git_lfs_filename}" -C . - ./install.sh + echo "Installing..." + if [ -f "./install.sh" ]; then + ./install.sh + else + # Starting around v3.2.0, the release + # artifact file structure changed slightly + enclosed_folder="git-lfs-${GIT_LFS_VERSION}" + cd ${enclosed_folder} + ./install.sh + cd ../ + fi rm -rf /tmp/git-lfs /tmp/tmp-gnupg } diff --git a/containers/codespaces-linux/.devcontainer/library-scripts/github-debian.sh b/containers/codespaces-linux/.devcontainer/library-scripts/github-debian.sh index 978cc709c3..01ad4d493b 100755 --- a/containers/codespaces-linux/.devcontainer/library-scripts/github-debian.sh +++ b/containers/codespaces-linux/.devcontainer/library-scripts/github-debian.sh @@ -181,7 +181,7 @@ echo "Downloading github CLI..." # Import key safely (new method rather than deprecated apt-key approach) and install . /etc/os-release receive_gpg_keys GITHUB_CLI_ARCHIVE_GPG_KEY /usr/share/keyrings/githubcli-archive-keyring.gpg -echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/github-cli.list +echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list apt-get update apt-get -y install "gh${version_suffix}" rm -rf "/tmp/gh/gnupg" diff --git a/containers/codespaces-linux/.devcontainer/library-scripts/node-debian.sh b/containers/codespaces-linux/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/codespaces-linux/.devcontainer/library-scripts/node-debian.sh +++ b/containers/codespaces-linux/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/codespaces-linux/.devcontainer/library-scripts/sshd-debian.sh b/containers/codespaces-linux/.devcontainer/library-scripts/sshd-debian.sh index eb33a09d61..24fcbfac5f 100755 --- a/containers/codespaces-linux/.devcontainer/library-scripts/sshd-debian.sh +++ b/containers/codespaces-linux/.devcontainer/library-scripts/sshd-debian.sh @@ -75,6 +75,13 @@ elif [ "${NEW_PASSWORD}" != "skip" ]; then echo "${USERNAME}:${NEW_PASSWORD}" | chpasswd fi +if [ $(getent group ssh) ]; then + echo "'ssh' group already exists." +else + echo "adding 'ssh' group, as it does not already exist." + groupadd ssh +fi + # Add user to ssh group if [ "${USERNAME}" != "root" ]; then usermod -aG ssh ${USERNAME} diff --git a/containers/dapr-dotnet/.devcontainer/library-scripts/docker-debian.sh b/containers/dapr-dotnet/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/dapr-dotnet/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/dapr-dotnet/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/dapr-javascript-node/.devcontainer/library-scripts/docker-debian.sh b/containers/dapr-javascript-node/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/dapr-javascript-node/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/dapr-javascript-node/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/dart/.devcontainer/library-scripts/common-debian.sh b/containers/dart/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/dart/.devcontainer/library-scripts/common-debian.sh +++ b/containers/dart/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/debian/.devcontainer/library-scripts/common-debian.sh b/containers/debian/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/debian/.devcontainer/library-scripts/common-debian.sh +++ b/containers/debian/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/docker-from-docker-compose/.devcontainer/library-scripts/common-debian.sh b/containers/docker-from-docker-compose/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/docker-from-docker-compose/.devcontainer/library-scripts/common-debian.sh +++ b/containers/docker-from-docker-compose/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/docker-from-docker-compose/.devcontainer/library-scripts/docker-debian.sh b/containers/docker-from-docker-compose/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/docker-from-docker-compose/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/docker-from-docker-compose/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/docker-from-docker/.devcontainer/library-scripts/common-debian.sh b/containers/docker-from-docker/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/docker-from-docker/.devcontainer/library-scripts/common-debian.sh +++ b/containers/docker-from-docker/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/docker-from-docker/.devcontainer/library-scripts/docker-debian.sh b/containers/docker-from-docker/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/docker-from-docker/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/docker-from-docker/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/docker-in-docker/.devcontainer/library-scripts/common-debian.sh b/containers/docker-in-docker/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/docker-in-docker/.devcontainer/library-scripts/common-debian.sh +++ b/containers/docker-in-docker/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/docker-in-docker/.devcontainer/library-scripts/docker-in-docker-debian.sh b/containers/docker-in-docker/.devcontainer/library-scripts/docker-in-docker-debian.sh index 2d37efc302..a525203b1a 100755 --- a/containers/docker-in-docker/.devcontainer/library-scripts/docker-in-docker-debian.sh +++ b/containers/docker-in-docker/.devcontainer/library-scripts/docker-in-docker-debian.sh @@ -15,14 +15,27 @@ USE_MOBY=${3:-"true"} DOCKER_VERSION=${4:-"latest"} # The Docker/Moby Engine + CLI should match in version DOCKER_DASH_COMPOSE_VERSION=${5:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" +# Default: Exit on any failure. set -e +# Setup STDERR. +err() { + echo "(!) $*" >&2 +} + if [ "$(id -u)" -ne 0 ]; then - echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' + err 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' exit 1 fi +################### +# Helper Functions +# See: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/shared/utils.sh +################### + # Determine the appropriate non-root user if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" @@ -97,20 +110,50 @@ find_version_from_git_tags() { declare -g ${variable_name}="$(echo "${version_list}" | head -n 1)" else set +e - declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" + declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" set -e fi fi if [ -z "${!variable_name}" ] || ! echo "${version_list}" | grep "^${!variable_name//./\\.}$" > /dev/null 2>&1; then - echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 + err "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 exit 1 fi echo "${variable_name}=${!variable_name}" } +########################################### +# Start docker-in-docker installation +########################################### + # Ensure apt is in non-interactive to avoid prompts export DEBIAN_FRONTEND=noninteractive + +# Source /etc/os-release to get OS info +. /etc/os-release +# Fetch host/container arch. +architecture="$(dpkg --print-architecture)" + +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Install dependencies check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr if ! type git > /dev/null 2>&1; then @@ -124,10 +167,7 @@ if type iptables-legacy > /dev/null 2>&1; then update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy fi -# Source /etc/os-release to get OS info -. /etc/os-release -# Fetch host/container arch. -architecture="$(dpkg --print-architecture)" + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then @@ -165,11 +205,11 @@ else # Regex needs to handle debian package version number format: https://www.systutorials.com/docs/linux/man/5-deb-version/ docker_version_regex="^(.+:)?${docker_version_dot_plus_escaped}([\\.\\+ ~:-]|$)" set +e # Don't exit if finding version fails - will handle gracefully - cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" - engine_version_suffix="=$(apt-cache madison ${engine_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" + cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" + engine_version_suffix="=$(apt-cache madison ${engine_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" set -e if [ -z "${engine_version_suffix}" ] || [ "${engine_version_suffix}" = "=" ] || [ -z "${cli_version_suffix}" ] || [ "${cli_version_suffix}" = "=" ] ; then - echo "(!) No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" + err "No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+' exit 1 fi @@ -182,8 +222,17 @@ if type docker > /dev/null 2>&1 && type dockerd > /dev/null 2>&1; then echo "Docker / Moby CLI and Engine already installed." else if [ "${USE_MOBY}" = "true" ]; then - apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx moby-engine${engine_version_suffix} - apt-get -y install --no-install-recommends moby-compose || echo "(*) Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." + # Install engine + set +e # Handle error gracefully + apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx moby-engine${engine_version_suffix} + if [ $? -ne 0 ]; then + err "Packages for moby not available in OS ${ID} ${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-20.04')." + exit 1 + fi + set -e + + # Install compose + apt-get -y install --no-install-recommends moby-compose || err "Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." else apt-get -y install --no-install-recommends docker-ce-cli${cli_version_suffix} docker-ce${engine_version_suffix} fi @@ -344,3 +393,5 @@ EOF chmod +x /usr/local/share/docker-init.sh chown ${USERNAME}:root /usr/local/share/docker-init.sh + +echo 'docker-in-docker-debian script has completed!' \ No newline at end of file diff --git a/containers/dotnet/.devcontainer/library-scripts/common-debian.sh b/containers/dotnet/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/dotnet/.devcontainer/library-scripts/common-debian.sh +++ b/containers/dotnet/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/dotnet/.devcontainer/library-scripts/node-debian.sh b/containers/dotnet/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/dotnet/.devcontainer/library-scripts/node-debian.sh +++ b/containers/dotnet/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/elixir-phoenix-postgres/.devcontainer/Dockerfile b/containers/elixir-phoenix-postgres/.devcontainer/Dockerfile index 27ab034937..0b1a4aa88e 100644 --- a/containers/elixir-phoenix-postgres/.devcontainer/Dockerfile +++ b/containers/elixir-phoenix-postgres/.devcontainer/Dockerfile @@ -11,8 +11,8 @@ ARG USER_GID=$USER_UID # Options for common package install script ARG INSTALL_ZSH="true" ARG UPGRADE_PACKAGES="true" -ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-debian.sh" -ARG COMMON_SCRIPT_SHA="dev-mode" +ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.243.0/script-library/common-debian.sh" +ARG COMMON_SCRIPT_SHA="ab4609258940b032d02ed08d4c776e9e66e1a2a21dd2f3313a8fc1c4fee607d0" # Optional Settings for Phoenix ARG PHOENIX_VERSION="1.6.2" diff --git a/containers/elixir/.devcontainer/Dockerfile b/containers/elixir/.devcontainer/Dockerfile index cb63d6ea2e..f2af279965 100644 --- a/containers/elixir/.devcontainer/Dockerfile +++ b/containers/elixir/.devcontainer/Dockerfile @@ -11,8 +11,8 @@ ARG USER_GID=$USER_UID # Options for common package install script ARG INSTALL_ZSH="true" ARG UPGRADE_PACKAGES="true" -ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-debian.sh" -ARG COMMON_SCRIPT_SHA="dev-mode" +ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.243.0/script-library/common-debian.sh" +ARG COMMON_SCRIPT_SHA="ab4609258940b032d02ed08d4c776e9e66e1a2a21dd2f3313a8fc1c4fee607d0" # Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. RUN apt-get update \ diff --git a/containers/go/.devcontainer/library-scripts/common-debian.sh b/containers/go/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/go/.devcontainer/library-scripts/common-debian.sh +++ b/containers/go/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/go/.devcontainer/library-scripts/node-debian.sh b/containers/go/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/go/.devcontainer/library-scripts/node-debian.sh +++ b/containers/go/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/haskell/.devcontainer/library-scripts/common-debian.sh b/containers/haskell/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/haskell/.devcontainer/library-scripts/common-debian.sh +++ b/containers/haskell/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/java-8/.devcontainer/library-scripts/gradle-debian.sh b/containers/java-8/.devcontainer/library-scripts/gradle-debian.sh old mode 100644 new mode 100755 diff --git a/containers/java-8/.devcontainer/library-scripts/java-debian.sh b/containers/java-8/.devcontainer/library-scripts/java-debian.sh old mode 100644 new mode 100755 diff --git a/containers/java-8/.devcontainer/library-scripts/maven-debian.sh b/containers/java-8/.devcontainer/library-scripts/maven-debian.sh old mode 100644 new mode 100755 diff --git a/containers/java-8/.devcontainer/library-scripts/node-debian.sh b/containers/java-8/.devcontainer/library-scripts/node-debian.sh old mode 100644 new mode 100755 index c3551689c9..f782961880 --- a/containers/java-8/.devcontainer/library-scripts/node-debian.sh +++ b/containers/java-8/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/java/.devcontainer/library-scripts/common-debian.sh b/containers/java/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/java/.devcontainer/library-scripts/common-debian.sh +++ b/containers/java/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/java/.devcontainer/library-scripts/node-debian.sh b/containers/java/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/java/.devcontainer/library-scripts/node-debian.sh +++ b/containers/java/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/javascript-node/.devcontainer/library-scripts/common-debian.sh b/containers/javascript-node/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/javascript-node/.devcontainer/library-scripts/common-debian.sh +++ b/containers/javascript-node/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/javascript-node/.devcontainer/library-scripts/node-debian.sh b/containers/javascript-node/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/javascript-node/.devcontainer/library-scripts/node-debian.sh +++ b/containers/javascript-node/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/jupyter-datascience-notebooks/.devcontainer/library-scripts/common-debian.sh b/containers/jupyter-datascience-notebooks/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/jupyter-datascience-notebooks/.devcontainer/library-scripts/common-debian.sh +++ b/containers/jupyter-datascience-notebooks/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/common-debian.sh b/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/common-debian.sh +++ b/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/docker-in-docker-debian.sh b/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/docker-in-docker-debian.sh index 2d37efc302..a525203b1a 100755 --- a/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/docker-in-docker-debian.sh +++ b/containers/kubernetes-helm-minikube/.devcontainer/library-scripts/docker-in-docker-debian.sh @@ -15,14 +15,27 @@ USE_MOBY=${3:-"true"} DOCKER_VERSION=${4:-"latest"} # The Docker/Moby Engine + CLI should match in version DOCKER_DASH_COMPOSE_VERSION=${5:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" +# Default: Exit on any failure. set -e +# Setup STDERR. +err() { + echo "(!) $*" >&2 +} + if [ "$(id -u)" -ne 0 ]; then - echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' + err 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' exit 1 fi +################### +# Helper Functions +# See: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/shared/utils.sh +################### + # Determine the appropriate non-root user if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" @@ -97,20 +110,50 @@ find_version_from_git_tags() { declare -g ${variable_name}="$(echo "${version_list}" | head -n 1)" else set +e - declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" + declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" set -e fi fi if [ -z "${!variable_name}" ] || ! echo "${version_list}" | grep "^${!variable_name//./\\.}$" > /dev/null 2>&1; then - echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 + err "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 exit 1 fi echo "${variable_name}=${!variable_name}" } +########################################### +# Start docker-in-docker installation +########################################### + # Ensure apt is in non-interactive to avoid prompts export DEBIAN_FRONTEND=noninteractive + +# Source /etc/os-release to get OS info +. /etc/os-release +# Fetch host/container arch. +architecture="$(dpkg --print-architecture)" + +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Install dependencies check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr if ! type git > /dev/null 2>&1; then @@ -124,10 +167,7 @@ if type iptables-legacy > /dev/null 2>&1; then update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy fi -# Source /etc/os-release to get OS info -. /etc/os-release -# Fetch host/container arch. -architecture="$(dpkg --print-architecture)" + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then @@ -165,11 +205,11 @@ else # Regex needs to handle debian package version number format: https://www.systutorials.com/docs/linux/man/5-deb-version/ docker_version_regex="^(.+:)?${docker_version_dot_plus_escaped}([\\.\\+ ~:-]|$)" set +e # Don't exit if finding version fails - will handle gracefully - cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" - engine_version_suffix="=$(apt-cache madison ${engine_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" + cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" + engine_version_suffix="=$(apt-cache madison ${engine_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" set -e if [ -z "${engine_version_suffix}" ] || [ "${engine_version_suffix}" = "=" ] || [ -z "${cli_version_suffix}" ] || [ "${cli_version_suffix}" = "=" ] ; then - echo "(!) No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" + err "No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+' exit 1 fi @@ -182,8 +222,17 @@ if type docker > /dev/null 2>&1 && type dockerd > /dev/null 2>&1; then echo "Docker / Moby CLI and Engine already installed." else if [ "${USE_MOBY}" = "true" ]; then - apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx moby-engine${engine_version_suffix} - apt-get -y install --no-install-recommends moby-compose || echo "(*) Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." + # Install engine + set +e # Handle error gracefully + apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx moby-engine${engine_version_suffix} + if [ $? -ne 0 ]; then + err "Packages for moby not available in OS ${ID} ${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-20.04')." + exit 1 + fi + set -e + + # Install compose + apt-get -y install --no-install-recommends moby-compose || err "Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." else apt-get -y install --no-install-recommends docker-ce-cli${cli_version_suffix} docker-ce${engine_version_suffix} fi @@ -344,3 +393,5 @@ EOF chmod +x /usr/local/share/docker-init.sh chown ${USERNAME}:root /usr/local/share/docker-init.sh + +echo 'docker-in-docker-debian script has completed!' \ No newline at end of file diff --git a/containers/kubernetes-helm/.devcontainer/library-scripts/common-debian.sh b/containers/kubernetes-helm/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/kubernetes-helm/.devcontainer/library-scripts/common-debian.sh +++ b/containers/kubernetes-helm/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/kubernetes-helm/.devcontainer/library-scripts/docker-debian.sh b/containers/kubernetes-helm/.devcontainer/library-scripts/docker-debian.sh index 8b9316aded..1102ae99c5 100755 --- a/containers/kubernetes-helm/.devcontainer/library-scripts/docker-debian.sh +++ b/containers/kubernetes-helm/.devcontainer/library-scripts/docker-debian.sh @@ -17,6 +17,8 @@ USE_MOBY=${5:-"true"} DOCKER_VERSION=${6:-"latest"} DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" +DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" set -e @@ -125,6 +127,26 @@ fi # Fetch host/container arch. architecture="$(dpkg --print-architecture)" +# Check if distro is suppported +if [ "${USE_MOBY}" = "true" ]; then + # 'get_common_setting' allows attribute to be updated remotely + get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" +else + get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES + if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" + err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + exit 1 + fi + echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" +fi + # Set up the necessary apt repos (either Microsoft's or Docker's) if [ "${USE_MOBY}" = "true" ]; then diff --git a/containers/mit-scheme/.devcontainer/library-scripts/common-debian.sh b/containers/mit-scheme/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/mit-scheme/.devcontainer/library-scripts/common-debian.sh +++ b/containers/mit-scheme/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/perl/.devcontainer/library-scripts/common-debian.sh b/containers/perl/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/perl/.devcontainer/library-scripts/common-debian.sh +++ b/containers/perl/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/php/.devcontainer/library-scripts/common-debian.sh b/containers/php/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/php/.devcontainer/library-scripts/common-debian.sh +++ b/containers/php/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/php/.devcontainer/library-scripts/node-debian.sh b/containers/php/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/php/.devcontainer/library-scripts/node-debian.sh +++ b/containers/php/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/powershell/.devcontainer/library-scripts/common-debian.sh b/containers/powershell/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/powershell/.devcontainer/library-scripts/common-debian.sh +++ b/containers/powershell/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/python-3-anaconda/.devcontainer/library-scripts/node-debian.sh b/containers/python-3-anaconda/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/python-3-anaconda/.devcontainer/library-scripts/node-debian.sh +++ b/containers/python-3-anaconda/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/python-3-miniconda/.devcontainer/library-scripts/node-debian.sh b/containers/python-3-miniconda/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/python-3-miniconda/.devcontainer/library-scripts/node-debian.sh +++ b/containers/python-3-miniconda/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/python-3-pypy/.devcontainer/library-scripts/common-debian.sh b/containers/python-3-pypy/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/python-3-pypy/.devcontainer/library-scripts/common-debian.sh +++ b/containers/python-3-pypy/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/python-3/.devcontainer/library-scripts/common-debian.sh b/containers/python-3/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/python-3/.devcontainer/library-scripts/common-debian.sh +++ b/containers/python-3/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/python-3/.devcontainer/library-scripts/node-debian.sh b/containers/python-3/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/python-3/.devcontainer/library-scripts/node-debian.sh +++ b/containers/python-3/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/r/.devcontainer/library-scripts/common-debian.sh b/containers/r/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/r/.devcontainer/library-scripts/common-debian.sh +++ b/containers/r/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/ruby/.devcontainer/library-scripts/common-debian.sh b/containers/ruby/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/ruby/.devcontainer/library-scripts/common-debian.sh +++ b/containers/ruby/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/ruby/.devcontainer/library-scripts/node-debian.sh b/containers/ruby/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/ruby/.devcontainer/library-scripts/node-debian.sh +++ b/containers/ruby/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then diff --git a/containers/rust/.devcontainer/library-scripts/common-debian.sh b/containers/rust/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/rust/.devcontainer/library-scripts/common-debian.sh +++ b/containers/rust/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/swift/.devcontainer/library-scripts/common-debian.sh b/containers/swift/.devcontainer/library-scripts/common-debian.sh index af4facc8f6..2962684886 100755 --- a/containers/swift/.devcontainer/library-scripts/common-debian.sh +++ b/containers/swift/.devcontainer/library-scripts/common-debian.sh @@ -102,7 +102,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then libkrb5-3 \ libgssapi-krb5-2 \ libicu[0-9][0-9] \ - liblttng-ust0 \ + liblttng-ust[0-9] \ libstdc++6 \ zlib1g \ locales \ diff --git a/containers/swift/.devcontainer/library-scripts/node-debian.sh b/containers/swift/.devcontainer/library-scripts/node-debian.sh index c3551689c9..f782961880 100755 --- a/containers/swift/.devcontainer/library-scripts/node-debian.sh +++ b/containers/swift/.devcontainer/library-scripts/node-debian.sh @@ -126,6 +126,7 @@ su ${USERNAME} -c "$(cat << EOF umask 0002 # Do not update profile - we'll do this manually export PROFILE=/dev/null + ls -lah /home/${USERNAME}/.nvs || : curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash source ${NVM_DIR}/nvm.sh if [ "${NODE_VERSION}" != "" ]; then