diff --git a/src/elixir-asdf/devcontainer-feature.json b/src/elixir-asdf/devcontainer-feature.json index 8237bcbaf..bbd86ff3a 100644 --- a/src/elixir-asdf/devcontainer-feature.json +++ b/src/elixir-asdf/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "elixir-asdf", - "version": "2.0.18", + "version": "2.0.19", "name": "Elixir (via asdf)", "documentationURL": "http://github.com/devcontainers-contrib/features/tree/main/src/elixir-asdf", "description": "Elixir is a functional, concurrent, general-purpose programming language that runs on the BEAM virtual machine which is also used to implement the Erlang programming language.", diff --git a/src/elixir-asdf/install.sh b/src/elixir-asdf/install.sh index 4782118d0..1914c51d6 100755 --- a/src/elixir-asdf/install.sh +++ b/src/elixir-asdf/install.sh @@ -1,22 +1,21 @@ -#!/bin/bash -i set -e -source ./library_scripts.sh +. ./library_scripts.sh # nanolayer is a cli utility which keeps container layers as small as possible # source code: https://github.com/devcontainers-contrib/nanolayer # `ensure_nanolayer` is a bash function that will find any existing nanolayer installations, # and if missing - will download a temporary copy that automatically get deleted at the end # of the script -ensure_nanolayer nanolayer_location "v0.4.45" +ensure_nanolayer nanolayer_location "v0.5.5" $nanolayer_location \ install \ devcontainer-feature \ - "ghcr.io/devcontainers-contrib/features/apt-get-packages:1.0.4" \ - --option packages='build-essential,autoconf,m4,libncurses5-dev,libwxgtk3.0-gtk3-dev,libwxgtk-webview3.0-gtk3-dev,libgl1-mesa-dev,libglu1-mesa-dev,libpng-dev,libssh-dev,unixodbc-dev,xsltproc,fop,libxml2-utils,libncurses-dev,openjdk-11-jdk,procps' + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1.0.6" \ + --option packages='build-essential,autoconf,m4,libncurses5-dev,libwxgtk3.*-dev,libwxgtk-webview3.*-dev,libgl1-mesa-dev,libglu1-mesa-dev,libpng-dev,libssh-dev,unixodbc-dev,xsltproc,fop,libxml2-utils,libncurses-dev,openjdk-1*-jdk,procps' diff --git a/src/elixir-asdf/library_scripts.sh b/src/elixir-asdf/library_scripts.sh index 8f9bd9a0e..0d7f34d4b 100644 --- a/src/elixir-asdf/library_scripts.sh +++ b/src/elixir-asdf/library_scripts.sh @@ -1,4 +1,3 @@ -#!/bin/bash -i clean_download() { @@ -10,13 +9,13 @@ clean_download() { # The above steps will minimize the leftovers being created while installing the downloader # Supported distros: # debian/ubuntu/alpine - + url=$1 output_location=$2 tempdir=$(mktemp -d) downloader_installed="" - function _apt_get_install() { + _apt_get_install() { tempdir=$1 # copy current state of apt list - in order to revert back later (minimize contianer layer size) @@ -25,7 +24,7 @@ clean_download() { apt-get -y install --no-install-recommends wget ca-certificates } - function _apt_get_cleanup() { + _apt_get_cleanup() { tempdir=$1 echo "removing wget" @@ -36,7 +35,7 @@ clean_download() { rm -r /var/lib/apt/lists && mv $tempdir/lists /var/lib/apt/lists } - function _apk_install() { + _apk_install() { tempdir=$1 # copy current state of apk cache - in order to revert back later (minimize contianer layer size) cp -p -R /var/cache/apk $tempdir @@ -44,7 +43,7 @@ clean_download() { apk add --no-cache wget } - function _apk_cleanup() { + _apk_cleanup() { tempdir=$1 echo "removing wget" @@ -100,45 +99,39 @@ ensure_nanolayer() { local variable_name=$1 local required_version=$2 - # normalize version - if ! [[ $required_version == v* ]]; then - required_version=v$required_version - fi - local nanolayer_location="" + local __nanolayer_location="" # If possible - try to use an already installed nanolayer - if [[ -z "${NANOLAYER_FORCE_CLI_INSTALLATION}" ]]; then - if [[ -z "${NANOLAYER_CLI_LOCATION}" ]]; then + if [ -z "${NANOLAYER_FORCE_CLI_INSTALLATION}" ]; then + if [ -z "${NANOLAYER_CLI_LOCATION}" ]; then if type nanolayer >/dev/null 2>&1; then echo "Found a pre-existing nanolayer in PATH" - nanolayer_location=nanolayer + __nanolayer_location=nanolayer fi elif [ -f "${NANOLAYER_CLI_LOCATION}" ] && [ -x "${NANOLAYER_CLI_LOCATION}" ] ; then - nanolayer_location=${NANOLAYER_CLI_LOCATION} - echo "Found a pre-existing nanolayer which were given in env variable: $nanolayer_location" + __nanolayer_location=${NANOLAYER_CLI_LOCATION} + echo "Found a pre-existing nanolayer which were given in env variable: $__nanolayer_location" fi # make sure its of the required version - if ! [[ -z "${nanolayer_location}" ]]; then + if ! [ -z "${__nanolayer_location}" ]; then local current_version - current_version=$($nanolayer_location --version) - if ! [[ $current_version == v* ]]; then - current_version=v$current_version - fi + current_version=$($__nanolayer_location --version) + if ! [ $current_version == $required_version ]; then echo "skipping usage of pre-existing nanolayer. (required version $required_version does not match existing version $current_version)" - nanolayer_location="" + __nanolayer_location="" fi fi fi # If not previuse installation found, download it temporarly and delete at the end of the script - if [[ -z "${nanolayer_location}" ]]; then + if [ -z "${__nanolayer_location}" ]; then - if [ "$(uname -sm)" == "Linux x86_64" ] || [ "$(uname -sm)" == "Linux aarch64" ]; then + if [ "$(uname -sm)" = 'Linux x86_64' ] || [ "$(uname -sm)" = "Linux aarch64" ]; then tmp_dir=$(mktemp -d -t nanolayer-XXXXXXXXXX) clean_up () { @@ -162,7 +155,7 @@ ensure_nanolayer() { tar xfzv $tmp_dir/$tar_filename -C "$tmp_dir" chmod a+x $tmp_dir/nanolayer - nanolayer_location=$tmp_dir/nanolayer + __nanolayer_location=$tmp_dir/nanolayer else @@ -172,7 +165,7 @@ ensure_nanolayer() { fi # Expose outside the resolved location - declare -g ${variable_name}=$nanolayer_location + export ${variable_name}=$__nanolayer_location } diff --git a/src/erlang-asdf/devcontainer-feature.json b/src/erlang-asdf/devcontainer-feature.json index 6aa9f8d15..a5ca243c9 100644 --- a/src/erlang-asdf/devcontainer-feature.json +++ b/src/erlang-asdf/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "erlang-asdf", - "version": "2.0.17", + "version": "2.0.18", "name": "Erlang (via asdf)", "documentationURL": "http://github.com/devcontainers-contrib/features/tree/main/src/erlang-asdf", "description": "Erlang is a general-purpose, concurrent, functional programming language, and a garbage-collected runtime system.", diff --git a/src/erlang-asdf/install.sh b/src/erlang-asdf/install.sh index 73f1072e8..afc941415 100755 --- a/src/erlang-asdf/install.sh +++ b/src/erlang-asdf/install.sh @@ -1,22 +1,21 @@ -#!/bin/bash -i set -e -source ./library_scripts.sh +. ./library_scripts.sh # nanolayer is a cli utility which keeps container layers as small as possible # source code: https://github.com/devcontainers-contrib/nanolayer # `ensure_nanolayer` is a bash function that will find any existing nanolayer installations, # and if missing - will download a temporary copy that automatically get deleted at the end # of the script -ensure_nanolayer nanolayer_location "v0.4.45" +ensure_nanolayer nanolayer_location "v0.5.5" $nanolayer_location \ install \ devcontainer-feature \ - "ghcr.io/devcontainers-contrib/features/apt-get-packages:1.0.4" \ - --option packages='build-essential,autoconf,m4,libncurses5-dev,libwxgtk3.0-gtk3-dev,libwxgtk-webview3.0-gtk3-dev,libgl1-mesa-dev,libglu1-mesa-dev,libpng-dev,libssh-dev,unixodbc-dev,xsltproc,fop,libxml2-utils,libncurses-dev,openjdk-11-jdk,procps' + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1.0.6" \ + --option packages='build-essential,autoconf,m4,libncurses5-dev,libwxgtk3.*-dev,libwxgtk-webview3.*-dev,libgl1-mesa-dev,libglu1-mesa-dev,libpng-dev,libssh-dev,unixodbc-dev,xsltproc,fop,libxml2-utils,libncurses-dev,openjdk-1*-jdk,procps' diff --git a/src/erlang-asdf/library_scripts.sh b/src/erlang-asdf/library_scripts.sh index 8f9bd9a0e..0d7f34d4b 100644 --- a/src/erlang-asdf/library_scripts.sh +++ b/src/erlang-asdf/library_scripts.sh @@ -1,4 +1,3 @@ -#!/bin/bash -i clean_download() { @@ -10,13 +9,13 @@ clean_download() { # The above steps will minimize the leftovers being created while installing the downloader # Supported distros: # debian/ubuntu/alpine - + url=$1 output_location=$2 tempdir=$(mktemp -d) downloader_installed="" - function _apt_get_install() { + _apt_get_install() { tempdir=$1 # copy current state of apt list - in order to revert back later (minimize contianer layer size) @@ -25,7 +24,7 @@ clean_download() { apt-get -y install --no-install-recommends wget ca-certificates } - function _apt_get_cleanup() { + _apt_get_cleanup() { tempdir=$1 echo "removing wget" @@ -36,7 +35,7 @@ clean_download() { rm -r /var/lib/apt/lists && mv $tempdir/lists /var/lib/apt/lists } - function _apk_install() { + _apk_install() { tempdir=$1 # copy current state of apk cache - in order to revert back later (minimize contianer layer size) cp -p -R /var/cache/apk $tempdir @@ -44,7 +43,7 @@ clean_download() { apk add --no-cache wget } - function _apk_cleanup() { + _apk_cleanup() { tempdir=$1 echo "removing wget" @@ -100,45 +99,39 @@ ensure_nanolayer() { local variable_name=$1 local required_version=$2 - # normalize version - if ! [[ $required_version == v* ]]; then - required_version=v$required_version - fi - local nanolayer_location="" + local __nanolayer_location="" # If possible - try to use an already installed nanolayer - if [[ -z "${NANOLAYER_FORCE_CLI_INSTALLATION}" ]]; then - if [[ -z "${NANOLAYER_CLI_LOCATION}" ]]; then + if [ -z "${NANOLAYER_FORCE_CLI_INSTALLATION}" ]; then + if [ -z "${NANOLAYER_CLI_LOCATION}" ]; then if type nanolayer >/dev/null 2>&1; then echo "Found a pre-existing nanolayer in PATH" - nanolayer_location=nanolayer + __nanolayer_location=nanolayer fi elif [ -f "${NANOLAYER_CLI_LOCATION}" ] && [ -x "${NANOLAYER_CLI_LOCATION}" ] ; then - nanolayer_location=${NANOLAYER_CLI_LOCATION} - echo "Found a pre-existing nanolayer which were given in env variable: $nanolayer_location" + __nanolayer_location=${NANOLAYER_CLI_LOCATION} + echo "Found a pre-existing nanolayer which were given in env variable: $__nanolayer_location" fi # make sure its of the required version - if ! [[ -z "${nanolayer_location}" ]]; then + if ! [ -z "${__nanolayer_location}" ]; then local current_version - current_version=$($nanolayer_location --version) - if ! [[ $current_version == v* ]]; then - current_version=v$current_version - fi + current_version=$($__nanolayer_location --version) + if ! [ $current_version == $required_version ]; then echo "skipping usage of pre-existing nanolayer. (required version $required_version does not match existing version $current_version)" - nanolayer_location="" + __nanolayer_location="" fi fi fi # If not previuse installation found, download it temporarly and delete at the end of the script - if [[ -z "${nanolayer_location}" ]]; then + if [ -z "${__nanolayer_location}" ]; then - if [ "$(uname -sm)" == "Linux x86_64" ] || [ "$(uname -sm)" == "Linux aarch64" ]; then + if [ "$(uname -sm)" = 'Linux x86_64' ] || [ "$(uname -sm)" = "Linux aarch64" ]; then tmp_dir=$(mktemp -d -t nanolayer-XXXXXXXXXX) clean_up () { @@ -162,7 +155,7 @@ ensure_nanolayer() { tar xfzv $tmp_dir/$tar_filename -C "$tmp_dir" chmod a+x $tmp_dir/nanolayer - nanolayer_location=$tmp_dir/nanolayer + __nanolayer_location=$tmp_dir/nanolayer else @@ -172,7 +165,7 @@ ensure_nanolayer() { fi # Expose outside the resolved location - declare -g ${variable_name}=$nanolayer_location + export ${variable_name}=$__nanolayer_location } diff --git a/test/elixir-asdf/scenarios.json b/test/elixir-asdf/scenarios.json index 94d72df43..a002ed79d 100644 --- a/test/elixir-asdf/scenarios.json +++ b/test/elixir-asdf/scenarios.json @@ -1,6 +1,24 @@ { - "test": { - "image": "mcr.microsoft.com/devcontainers/base:debian", + "test_debian_11": { + "image": "mcr.microsoft.com/devcontainers/base:debian-11", + "features": { + "elixir-asdf": {} + } + }, + "test_debian_12": { + "image": "mcr.microsoft.com/devcontainers/base:debian-12", + "features": { + "elixir-asdf": {} + } + }, + "test_ubuntu_2004": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04", + "features": { + "elixir-asdf": {} + } + }, + "test_ubuntu_2204": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04", "features": { "elixir-asdf": {} } diff --git a/test/elixir-asdf/test.sh b/test/elixir-asdf/test_debian_11.sh similarity index 100% rename from test/elixir-asdf/test.sh rename to test/elixir-asdf/test_debian_11.sh diff --git a/test/elixir-asdf/test_debian_12.sh b/test/elixir-asdf/test_debian_12.sh new file mode 100755 index 000000000..7187b5e5a --- /dev/null +++ b/test/elixir-asdf/test_debian_12.sh @@ -0,0 +1,9 @@ +#!/bin/bash -i + +set -e + +source dev-container-features-test-lib + +check "elixir --version" elixir --version + +reportResults diff --git a/test/elixir-asdf/test_ubuntu_2004.sh b/test/elixir-asdf/test_ubuntu_2004.sh new file mode 100755 index 000000000..7187b5e5a --- /dev/null +++ b/test/elixir-asdf/test_ubuntu_2004.sh @@ -0,0 +1,9 @@ +#!/bin/bash -i + +set -e + +source dev-container-features-test-lib + +check "elixir --version" elixir --version + +reportResults diff --git a/test/elixir-asdf/test_ubuntu_2204.sh b/test/elixir-asdf/test_ubuntu_2204.sh new file mode 100755 index 000000000..7187b5e5a --- /dev/null +++ b/test/elixir-asdf/test_ubuntu_2204.sh @@ -0,0 +1,9 @@ +#!/bin/bash -i + +set -e + +source dev-container-features-test-lib + +check "elixir --version" elixir --version + +reportResults diff --git a/test/erlang-asdf/scenarios.json b/test/erlang-asdf/scenarios.json index 5bb4cd126..5ba2815d5 100644 --- a/test/erlang-asdf/scenarios.json +++ b/test/erlang-asdf/scenarios.json @@ -1,8 +1,14 @@ { - "test": { + "test_debian_bullseye": { "image": "debian:bullseye", "features": { "erlang-asdf": {} } + }, + "test_ubuntu": { + "image": "ubuntu", + "features": { + "erlang-asdf": {} + } } } \ No newline at end of file diff --git a/test/erlang-asdf/test_debian_bullseye.sh b/test/erlang-asdf/test_debian_bullseye.sh new file mode 100755 index 000000000..8563f1607 --- /dev/null +++ b/test/erlang-asdf/test_debian_bullseye.sh @@ -0,0 +1,9 @@ +#!/bin/bash -i + +set -e + +source dev-container-features-test-lib + +check "erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell" erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell + +reportResults diff --git a/test/erlang-asdf/test_ubuntu.sh b/test/erlang-asdf/test_ubuntu.sh new file mode 100755 index 000000000..8563f1607 --- /dev/null +++ b/test/erlang-asdf/test_ubuntu.sh @@ -0,0 +1,9 @@ +#!/bin/bash -i + +set -e + +source dev-container-features-test-lib + +check "erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell" erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell + +reportResults