From 88253ef4ce3827c381ff1a1e6c37d47396bc3232 Mon Sep 17 00:00:00 2001 From: Prathamesh Zarkar <159782310+prathameshzarkar9@users.noreply.github.com> Date: Fri, 18 Oct 2024 03:32:07 +0530 Subject: [PATCH 1/2] common-utils zshrc issue fix (#1111) * common-utils zshrc issue fix * bump feature patch version * test added to validate the changes of zshrc fix * user vscode added * User env added --- src/common-utils/devcontainer-feature.json | 2 +- src/common-utils/main.sh | 4 +++- test/common-utils/devcontainer-ruby-zshrc.sh | 12 ++++++++++++ .../devcontainer-ruby-zshrc/Dockerfile | 6 ++++++ test/common-utils/scenarios.json | 18 ++++++++++++++++++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 test/common-utils/devcontainer-ruby-zshrc.sh create mode 100644 test/common-utils/devcontainer-ruby-zshrc/Dockerfile diff --git a/src/common-utils/devcontainer-feature.json b/src/common-utils/devcontainer-feature.json index 968cbfb77..3fa6487df 100644 --- a/src/common-utils/devcontainer-feature.json +++ b/src/common-utils/devcontainer-feature.json @@ -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.", diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index 7658c4850..b5fe11f57 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -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 diff --git a/test/common-utils/devcontainer-ruby-zshrc.sh b/test/common-utils/devcontainer-ruby-zshrc.sh new file mode 100644 index 000000000..9e7b26e4c --- /dev/null +++ b/test/common-utils/devcontainer-ruby-zshrc.sh @@ -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 diff --git a/test/common-utils/devcontainer-ruby-zshrc/Dockerfile b/test/common-utils/devcontainer-ruby-zshrc/Dockerfile new file mode 100644 index 000000000..c5e7c69c4 --- /dev/null +++ b/test/common-utils/devcontainer-ruby-zshrc/Dockerfile @@ -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 + diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json index e5529ea04..a929f534a 100644 --- a/test/common-utils/scenarios.json +++ b/test/common-utils/scenarios.json @@ -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", From 125f6b0071597a59f3ccbefaf9145b5867528ae3 Mon Sep 17 00:00:00 2001 From: Prathamesh Zarkar <159782310+prathameshzarkar9@users.noreply.github.com> Date: Fri, 18 Oct 2024 03:34:12 +0530 Subject: [PATCH 2/2] latest jdk 23 is introduced accordingly changed the source code (#1152) * latest jdk 23 is introduced accordingly changed the source code * java version bumped --- src/java/devcontainer-feature.json | 2 +- src/java/install.sh | 2 +- test/java/install_latest_version.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java/devcontainer-feature.json b/src/java/devcontainer-feature.json index 7a9caa924..4e4b6c5d3 100644 --- a/src/java/devcontainer-feature.json +++ b/src/java/devcontainer-feature.json @@ -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.", diff --git a/src/java/install.sh b/src/java/install.sh index 47f0e8559..ef3d1913a 100644 --- a/src/java/install.sh +++ b/src/java/install.sh @@ -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 diff --git a/test/java/install_latest_version.sh b/test/java/install_latest_version.sh index a45d5e0b0..af8a621ce 100644 --- a/test/java/install_latest_version.sh +++ b/test/java/install_latest_version.sh @@ -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