Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Hawthorne001 authored Nov 12, 2024
2 parents 4a74855 + 2951f04 commit 27a982f
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/common-utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "common-utils",
"version": "2.5.1",
"version": "2.5.2",
"name": "Common Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
Expand Down
4 changes: 3 additions & 1 deletion src/common-utils/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,9 @@ if [ "${INSTALL_ZSH}" = "true" ]; then

# Add devcontainer .zshrc template
if [ "$INSTALL_OH_MY_ZSH_CONFIG" = "true" ]; then
echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" > ${user_rc_file}
if ! [ -f "${template_path}" ] || ! grep -qF "$(head -n 1 "${template_path}")" "${user_rc_file}"; then
echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" > ${user_rc_file}
fi
sed -i -e 's/ZSH_THEME=.*/ZSH_THEME="devcontainers"/g' ${user_rc_file}
fi

Expand Down
2 changes: 1 addition & 1 deletion src/java/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "java",
"version": "1.6.1",
"version": "1.6.2",
"name": "Java (via SDKMAN!)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/java",
"description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.",
Expand Down
2 changes: 1 addition & 1 deletion src/java/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ find_version_list() {
fi

if [ "${JDK_DISTRO}" = "ms" ]; then
if [ "${major_version}" = "8" ] || [ "${major_version}" = "18" ] || [ "${major_version}" = "22" ]; then
if [ "${major_version}" = "8" ] || [ "${major_version}" = "18" ] || [ "${major_version}" = "22" ] || [ "${major_version}" = "23" ]; then
JDK_DISTRO="tem"
fi
fi
Expand Down
2 changes: 1 addition & 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.6.0",
"version": "1.6.1",
"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
4 changes: 2 additions & 2 deletions src/node/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ install_yarn() {
# Yum/DNF want to install nodejs dependencies, we'll use NPM to install yarn
su ${USERNAME} -c "umask 0002 && . '${NVM_DIR}/nvm.sh' && nvm use ${_ver} && npm install --global yarn"
fi
else
else
echo "Yarn already installed."
fi
fi
Expand Down Expand Up @@ -309,7 +309,7 @@ curl -so- "https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.
curl -so- "https://raw.githubusercontent.com/nvm-sh/nvm/\${PREV_NVM_VERSION}/install.sh" | bash
NVM_VERSION="\${PREV_NVM_VERSION}"
}
source "${NVM_DIR}/nvm.sh"
[ -s "${NVM_DIR}/nvm.sh" ] && source "${NVM_DIR}/nvm.sh"
if [ "${NODE_VERSION}" != "" ]; then
nvm alias default "${NODE_VERSION}"
fi
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.4",
"version": "1.6.5",
"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
36 changes: 19 additions & 17 deletions src/python/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -465,16 +465,18 @@ install_prev_vers_cpython() {
install_cpython() {
VERSION=$1
INSTALL_PATH="${PYTHON_INSTALL_PATH}/${VERSION}"

# Check if the specified Python version is already installed
if [ -d "${INSTALL_PATH}" ]; then
echo "(!) Python version ${VERSION} already exists."
exit 1
else
mkdir -p /tmp/python-src ${INSTALL_PATH}
cd /tmp/python-src
cpython_tgz_filename="Python-${VERSION}.tgz"
cpython_tgz_url="https://www.python.org/ftp/python/${VERSION}/${cpython_tgz_filename}"
echo "Downloading ${cpython_tgz_filename}..."
curl -sSL -o "/tmp/python-src/${cpython_tgz_filename}" "${cpython_tgz_url}"
fi
mkdir -p /tmp/python-src ${INSTALL_PATH}
cd /tmp/python-src
cpython_tgz_filename="Python-${VERSION}.tgz"
cpython_tgz_url="https://www.python.org/ftp/python/${VERSION}/${cpython_tgz_filename}"
echo "Downloading ${cpython_tgz_filename}..."
curl -sSL -o "/tmp/python-src/${cpython_tgz_filename}" "${cpython_tgz_url}"
}

install_from_source() {
Expand Down Expand Up @@ -560,20 +562,20 @@ install_using_oryx() {
VERSION=$1
INSTALL_PATH="${PYTHON_INSTALL_PATH}/${VERSION}"

# Check if the specified Python version is already installed
if [ -d "${INSTALL_PATH}" ]; then
echo "(!) Python version ${VERSION} already exists."
exit 1
fi

# The python install root path may not exist, so create it
mkdir -p "${PYTHON_INSTALL_PATH}"
oryx_install "python" "${VERSION}" "${INSTALL_PATH}" "lib" || return 1
else
# The python install root path may not exist, so create it
mkdir -p "${PYTHON_INSTALL_PATH}"
oryx_install "python" "${VERSION}" "${INSTALL_PATH}" "lib" || return 1

ln -s "${INSTALL_PATH}/bin/idle3" "${INSTALL_PATH}/bin/idle"
ln -s "${INSTALL_PATH}/bin/pydoc3" "${INSTALL_PATH}/bin/pydoc"
ln -s "${INSTALL_PATH}/bin/python3-config" "${INSTALL_PATH}/bin/python-config"
ln -s "${INSTALL_PATH}/bin/idle3" "${INSTALL_PATH}/bin/idle"
ln -s "${INSTALL_PATH}/bin/pydoc3" "${INSTALL_PATH}/bin/pydoc"
ln -s "${INSTALL_PATH}/bin/python3-config" "${INSTALL_PATH}/bin/python-config"

add_symlink
add_symlink
fi
}

sudo_if() {
Expand Down
12 changes: 12 additions & 0 deletions test/common-utils/devcontainer-ruby-zshrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

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

# Definition specific tests
check "configure-zshrc-without-overwrite" bash -c "grep 'rbenv init -' ~/.zshrc"

# Report result
reportResults
6 changes: 6 additions & 0 deletions test/common-utils/devcontainer-ruby-zshrc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM mcr.microsoft.com/devcontainers/ruby:3.2

USER vscode
ENV USER=vscode
RUN echo 'eval "$(rbenv init -)"' >> /home/$USER/.zshrc

18 changes: 18 additions & 0 deletions test/common-utils/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,24 @@
}
}
},
"devcontainer-ruby-zshrc": {
"build": {
"dockerfile": "Dockerfile"
},
"remoteUser": "vscode",
"features": {
"common-utils": {
"installZsh": true,
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": true,
"installOhMyZsh": true,
"installOhMyZshConfig": true,
"configureZshAsDefaultShell": true
}
}
},
"alpine-base-zsh-default": {
"image": "mcr.microsoft.com/devcontainers/base:alpine",
"remoteUser": "vscode",
Expand Down
2 changes: 1 addition & 1 deletion test/java/install_latest_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo 'public class HelloWorld { public static void main(String[] args) { System.
javac HelloWorld.java

check "hello world" /bin/bash -c "java HelloWorld | grep "Hello, World!""
check "java version latest installed" grep "22.0.2" <(java --version)
check "java version latest installed" grep "23" <(java --version)

# Report result
reportResults

0 comments on commit 27a982f

Please sign in to comment.