From 28ca71a147402fb0189c688bf0abb9843da4b435 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Thu, 15 Aug 2024 09:29:12 -0700 Subject: [PATCH] Revert "common-utils overwrites .zshrc coming from image built" (#1094) * Revert "common-utils overwrites .zshrc coming from image built (#1069)" This reverts commit 56233fda3b8dfad16dfc1bf1bcc11350eaf772d0. * Update devcontainer-feature.json --- 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 | 4 ---- .../devcontainer-ruby-zshrc/meta.env | 8 -------- test/common-utils/scenarios.json | 18 ------------------ 6 files changed, 3 insertions(+), 45 deletions(-) delete mode 100755 test/common-utils/devcontainer-ruby-zshrc.sh delete mode 100644 test/common-utils/devcontainer-ruby-zshrc/Dockerfile delete mode 100644 test/common-utils/devcontainer-ruby-zshrc/meta.env diff --git a/src/common-utils/devcontainer-feature.json b/src/common-utils/devcontainer-feature.json index 3ae86cd3e..c403c2644 100644 --- a/src/common-utils/devcontainer-feature.json +++ b/src/common-utils/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "common-utils", - "version": "2.4.6", + "version": "2.4.7", "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 91cfc4d3b..8f82dcdf9 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -491,6 +491,7 @@ if [ "${INSTALL_ZSH}" = "true" ]; then echo 'source $HOME/.profile' >> "${user_home}/.zprofile" # TODO: Reconsider adding '.profile' to '.zprofile' chown ${USERNAME}:${group_name} "${user_home}/.zprofile" fi + if [ "${ZSH_ALREADY_INSTALLED}" != "true" ]; then if [ "${ADJUSTED_ID}" = "rhel" ]; then global_rc_path="/etc/zshrc" @@ -542,8 +543,7 @@ if [ "${INSTALL_ZSH}" = "true" ]; then # Add devcontainer .zshrc template if [ "$INSTALL_OH_MY_ZSH_CONFIG" = "true" ]; then - template_code="$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" - echo -e "$([ -f "${user_rc_file}" ] && cat "${user_rc_file}")\n${template_code}" > "${user_rc_file}" + echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" > ${user_rc_file} 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 deleted file mode 100755 index 9e7b26e4c..000000000 --- a/test/common-utils/devcontainer-ruby-zshrc.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/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 deleted file mode 100644 index 67cabf907..000000000 --- a/test/common-utils/devcontainer-ruby-zshrc/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM mcr.microsoft.com/devcontainers/ruby:3.2 - -RUN echo 'eval "$(rbenv init -)"' >> /home/vscode/.zshrc - diff --git a/test/common-utils/devcontainer-ruby-zshrc/meta.env b/test/common-utils/devcontainer-ruby-zshrc/meta.env deleted file mode 100644 index dfc61d31c..000000000 --- a/test/common-utils/devcontainer-ruby-zshrc/meta.env +++ /dev/null @@ -1,8 +0,0 @@ -VERSION='test-version' -DEFINITION_ID='test-id' -VARIANT='test-variant' -GIT_REPOSITORY='test-repository' -GIT_REPOSITORY_RELEASE='test-release' -GIT_REPOSITORY_REVISION='test-revision' -BUILD_TIMESTAMP='test-time' -CONTENTS_URL='test-url' diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json index 0151d9d1f..744f16dc1 100644 --- a/test/common-utils/scenarios.json +++ b/test/common-utils/scenarios.json @@ -235,24 +235,6 @@ } } }, - "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",