Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into node_nvm_fallback_imp…
Browse files Browse the repository at this point in the history
…lement_zsh_bash
  • Loading branch information
gauravsaini04 committed Jun 24, 2024
2 parents ffaa440 + 414d345 commit ad65b40
Show file tree
Hide file tree
Showing 23 changed files with 74 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/dotnet/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "dotnet",
"version": "2.1.0",
"version": "2.1.1",
"name": "Dotnet CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
"description": "This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.",
Expand Down
6 changes: 6 additions & 0 deletions src/dotnet/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ if [ ${#workloads[@]} -ne 0 ]; then
install_workloads "${workloads[@]}"
fi

# Create a symbolic link '/usr/bin/dotnet', to make dotnet available to 'sudo'
# This is necessary because 'sudo' resets the PATH variable, so it won't search the DOTNET_ROOT directory
if [ ! -e /usr/bin/dotnet ]; then
ln --symbolic "$DOTNET_ROOT/dotnet" /usr/bin/dotnet
fi

# Clean up
rm -rf /var/lib/apt/lists/*
rm -rf scripts
Expand Down
9 changes: 4 additions & 5 deletions src/dotnet/scripts/dotnet-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# Maintainer: The Dev Container spec maintainers
DOTNET_SCRIPTS=$(dirname "${BASH_SOURCE[0]}")
DOTNET_INSTALL_SCRIPT="$DOTNET_SCRIPTS/vendor/dotnet-install.sh"
DOTNET_INSTALL_DIR='/usr/share/dotnet'

# Prints the latest dotnet version in the specified channel
# Usage: fetch_latest_version_in_channel <channel> [<runtime>]
Expand Down Expand Up @@ -75,11 +74,11 @@ install_sdk() {
fi

# Currently this script does not make it possible to qualify the version, 'GA' is always implied
echo "Executing $DOTNET_INSTALL_SCRIPT --version $version --channel $channel --install-dir $DOTNET_INSTALL_DIR"
echo "Executing $DOTNET_INSTALL_SCRIPT --version $version --channel $channel --install-dir $DOTNET_ROOT"
"$DOTNET_INSTALL_SCRIPT" \
--version "$version" \
--channel "$channel" \
--install-dir "$DOTNET_INSTALL_DIR"
--install-dir "$DOTNET_ROOT"
}

# Installs a version of the .NET Runtime
Expand Down Expand Up @@ -107,12 +106,12 @@ install_runtime() {
version="$inputVersion"
fi

echo "Executing $DOTNET_INSTALL_SCRIPT --runtime $runtime --version $version --channel $channel --install-dir $DOTNET_INSTALL_DIR --no-path"
echo "Executing $DOTNET_INSTALL_SCRIPT --runtime $runtime --version $version --channel $channel --install-dir $DOTNET_ROOT --no-path"
"$DOTNET_INSTALL_SCRIPT" \
--runtime "$runtime" \
--version "$version" \
--channel "$channel" \
--install-dir "$DOTNET_INSTALL_DIR" \
--install-dir "$DOTNET_ROOT" \
--no-path
}

Expand Down
2 changes: 1 addition & 1 deletion src/git-lfs/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "git-lfs",
"version": "1.2.0",
"version": "1.2.1",
"name": "Git Large File Support (LFS)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git-lfs",
"description": "Installs Git Large File Support (Git LFS) along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like git and curl.",
Expand Down
2 changes: 1 addition & 1 deletion src/git-lfs/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down
2 changes: 1 addition & 1 deletion src/git/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "git",
"version": "1.2.0",
"version": "1.2.1",
"name": "Git (from source)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git",
"description": "Install an up-to-date version of Git, built from source as needed. Useful for when you want the latest and greatest features. Auto-detects latest stable version and installs needed dependencies.",
Expand Down
2 changes: 1 addition & 1 deletion src/git/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down
2 changes: 1 addition & 1 deletion src/github-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "github-cli",
"version": "1.0.11",
"version": "1.0.12",
"name": "GitHub CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/github-cli",
"description": "Installs the GitHub CLI. Auto-detects latest version and installs needed dependencies.",
Expand Down
2 changes: 1 addition & 1 deletion src/github-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down
1 change: 1 addition & 0 deletions src/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Installs Node.js, nvm, yarn, pnpm, and needed dependencies.
| nodeGypDependencies | Install dependencies to compile native node modules (node-gyp)? | boolean | true |
| nvmInstallPath | The path where NVM will be installed. | string | /usr/local/share/nvm |
| nvmVersion | Version of NVM to install. | string | latest |
| installYarnUsingApt | On Debian and Ubuntu systems, you have the option to install Yarn globally via APT. If you choose not to use this option, Yarn will be set up using Corepack instead. This choice is specific to Debian and Ubuntu; for other Linux distributions, Yarn is always installed using Corepack, with a fallback to installation via NPM if an error occurs. | boolean | true |

## Customizations

Expand Down
7 changes: 6 additions & 1 deletion src/node/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "node",
"version": "1.4.2",
"version": "1.5.0",
"name": "Node.js (via nvm), yarn and pnpm",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/node",
"description": "Installs Node.js, nvm, yarn, pnpm, and needed dependencies.",
Expand Down Expand Up @@ -36,6 +36,11 @@
],
"default": "latest",
"description": "Version of NVM to install."
},
"installYarnUsingApt": {
"type": "boolean",
"default": true,
"description": "On Debian and Ubuntu systems, you have the option to install Yarn globally via APT. If you choose not to use this option, Yarn will be set up using Corepack instead. This choice is specific to Debian and Ubuntu; for other Linux distributions, Yarn is always installed using Corepack, with a fallback to installation via NPM if an error occurs."
}
},
"customizations": {
Expand Down
8 changes: 5 additions & 3 deletions src/node/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export NODE_VERSION="${VERSION:-"lts"}"
export NVM_VERSION="${NVMVERSION:-"latest"}"
export NVM_DIR="${NVMINSTALLPATH:-"/usr/local/share/nvm"}"
INSTALL_TOOLS_FOR_NODE_GYP="${NODEGYPDEPENDENCIES:-true}"
export INSTALL_YARN_USING_APT="${INSTALLYARNUSINGAPT:-true}" # only concerns Debian-based systems

# Comma-separated list of node versions to be installed (with nvm)
# alongside NODE_VERSION, but not set as default.
Expand Down Expand Up @@ -159,7 +160,7 @@ check_packages() {
}

install_yarn() {
if [ "${ADJUSTED_ID}" = "debian" ]; then
if [ "${ADJUSTED_ID}" = "debian" ] && [ "${INSTALL_YARN_USING_APT}" = "true" ]; then
# for backward compatiblity with existing devcontainer features, install yarn
# via apt-get on Debian systems
if ! type yarn >/dev/null 2>&1; then
Expand All @@ -173,8 +174,9 @@ install_yarn() {
fi
else
local _ver=${1:-node}
# on non-debian systems, prefer corepack, fallback to npm based installation of yarn...
# Try to leverage corepack if possible
# on non-debian systems or if user opted not to use APT, prefer corepack
# Fallback to npm based installation of yarn.
# But try to leverage corepack if possible
# From https://yarnpkg.com:
# The preferred way to manage Yarn is by-project and through Corepack, a tool
# shipped by default with Node.js. Modern releases of Yarn aren't meant to be
Expand Down
2 changes: 1 addition & 1 deletion src/python/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "python",
"version": "1.6.1",
"version": "1.6.2",
"name": "Python",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/python",
"description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.",
Expand Down
4 changes: 2 additions & 2 deletions src/python/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down Expand Up @@ -202,7 +202,7 @@ receive_gpg_keys_centos7() {
fi
done
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down
2 changes: 1 addition & 1 deletion src/ruby/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "ruby",
"version": "1.2.1",
"version": "1.2.2",
"name": "Ruby (via rvm)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/ruby",
"description": "Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.",
Expand Down
2 changes: 1 addition & 1 deletion src/ruby/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down
2 changes: 1 addition & 1 deletion src/terraform/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "terraform",
"version": "1.3.6",
"version": "1.3.7",
"name": "Terraform, tflint, and TFGrunt",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/terraform",
"description": "Installs the Terraform CLI and optionally TFLint and Terragrunt. Auto-detects latest version and installs needed dependencies.",
Expand Down
4 changes: 2 additions & 2 deletions src/terraform/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand All @@ -90,7 +90,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys --keyserver ${keyserver_ip_address}) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down
6 changes: 6 additions & 0 deletions test/dotnet/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ source dev-container-features-test-lib
source dotnet_env.sh
source dotnet_helpers.sh

check "dotnet is installed in DOTNET_ROOT and execute permission is granted" \
test -x "$DOTNET_ROOT/dotnet"

check "dotnet is symlinked correctly in /usr/bin" \
test -L /usr/bin/dotnet -a "$(readlink -f /usr/bin/dotnet)" = "$DOTNET_ROOT/dotnet"

expected=$(fetch_latest_version)

check "Latest .NET SDK version installed" \
Expand Down
20 changes: 20 additions & 0 deletions test/node/debian_yarn_from_corepack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
YARN_VERSION="4.3.0"

# Corepack provides shims for package managers like yarn. The first time yarn is invoked via the "yarn"
# command, corepack will interactively request permission to download the yarn binary. To
# avoid this interactive mode and download the binary automatically, we explicitly call "corepack use yarn"
# instead (doesn't require user input). Once that command completes, "yarn" can be used in a non-interactive mode.
check "yarn shim location" bash -c ". /usr/local/share/nvm/nvm.sh && type yarn &> /dev/null"
check "download yarn" bash -c ". /usr/local/share/nvm/nvm.sh && corepack use yarn@${YARN_VERSION}"
check "yarn version" bash -c ". /usr/local/share/nvm/nvm.sh && yarn --version | grep ${YARN_VERSION}"

# Report result
reportResults
8 changes: 8 additions & 0 deletions test/node/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,13 @@
"version": "lts"
}
}
},
"debian_yarn_from_corepack": {
"image": "debian:11",
"features": {
"node": {
"installYarnUsingApt": false
}
}
}
}
4 changes: 2 additions & 2 deletions test/python/install_cpython_fallback_prev_version_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down Expand Up @@ -165,7 +165,7 @@ receive_gpg_keys_centos7() {
fi
done
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down
2 changes: 1 addition & 1 deletion test/ruby/ruby_fallback_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ receive_gpg_keys() {
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
echo "(*) Failed getting key, retrying in 10s..."
(( retry_count++ ))
sleep 10s
fi
Expand Down

0 comments on commit ad65b40

Please sign in to comment.