From 4456abd0f58937b165aadbe637ead3a296374a0d Mon Sep 17 00:00:00 2001 From: bryan hunt Date: Tue, 31 Mar 2026 20:45:27 +0100 Subject: [PATCH 1/4] fork and enable workflows --- .github/workflows/test.yaml | 6 +- README.md | 60 +--------------- src/direnv/install.sh | 64 ++++++++--------- src/easy-container-hooks/README.md | 29 -------- .../devcontainer-feature.json | 43 ------------ src/easy-container-hooks/install.sh | 37 ---------- src/easy-container-hooks/run-hook.sh.tmpl | 11 --- src/mcfly/README.md | 28 -------- src/mcfly/devcontainer-feature.json | 52 -------------- src/mcfly/install.sh | 61 ---------------- src/minio-client/README.md | 26 ------- src/minio-client/devcontainer-feature.json | 38 ---------- src/minio-client/install.sh | 69 ------------------- .../easy-container-hooks/changed_hooks_dir.sh | 29 -------- .../changed_oncreatehook_dir.sh | 31 --------- .../changed_postcreatehook_dir.sh | 31 --------- test/easy-container-hooks/lib.sh | 34 --------- test/easy-container-hooks/scenarios.json | 26 ------- test/easy-container-hooks/test.sh | 29 -------- test/mcfly/test.sh | 32 --------- test/minio-client/test.sh | 31 --------- 21 files changed, 34 insertions(+), 733 deletions(-) delete mode 100644 src/easy-container-hooks/README.md delete mode 100644 src/easy-container-hooks/devcontainer-feature.json delete mode 100644 src/easy-container-hooks/install.sh delete mode 100644 src/easy-container-hooks/run-hook.sh.tmpl delete mode 100644 src/mcfly/README.md delete mode 100644 src/mcfly/devcontainer-feature.json delete mode 100755 src/mcfly/install.sh delete mode 100644 src/minio-client/README.md delete mode 100644 src/minio-client/devcontainer-feature.json delete mode 100644 src/minio-client/install.sh delete mode 100644 test/easy-container-hooks/changed_hooks_dir.sh delete mode 100644 test/easy-container-hooks/changed_oncreatehook_dir.sh delete mode 100644 test/easy-container-hooks/changed_postcreatehook_dir.sh delete mode 100644 test/easy-container-hooks/lib.sh delete mode 100644 test/easy-container-hooks/scenarios.json delete mode 100755 test/easy-container-hooks/test.sh delete mode 100644 test/mcfly/test.sh delete mode 100644 test/minio-client/test.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e3e98e3..d458992 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,10 +12,10 @@ jobs: continue-on-error: true strategy: matrix: - features: ["easy-container-hooks", "direnv", "mcfly", "minio-client"] baseImage: - debian:latest - ubuntu:latest + - alpine:latest - mcr.microsoft.com/devcontainers/base:ubuntu steps: - uses: actions/checkout@v4 @@ -23,8 +23,8 @@ jobs: - name: "Install latest devcontainer CLI" run: npm install -g @devcontainers/cli - - name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'" - run: devcontainer features test -f ${{ matrix.features }} -i ${{ matrix.baseImage }} . + - name: "Generating tests for 'direnv' against '${{ matrix.baseImage }}'" + run: devcontainer features test -f direnv -i ${{ matrix.baseImage }} . test-global: runs-on: ubuntu-latest diff --git a/README.md b/README.md index eda12b0..fb9f898 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,12 @@ # devcontainer features - - - - - -
- A cool icon would be nice here. - - - Devcontainer 'features'
- Simple, reusable features curated by @ChristopherMacGown -
-
+> **Fork notice:** This is a fork of [ChristopherMacGown/devcontainer-features](https://github.com/ChristopherMacGown/devcontainer-features). +> It retains only the `direnv` feature, which has been updated to support Alpine Linux images in addition to Debian/Ubuntu. -This repository contains a _collection_ of features curated by @ChristopherMacGown. +This repository contains the `direnv` devcontainer feature. ## Collected Features -### mcfly - -[mcfly](https://github.com/cantino/mcfly) is a replacement for your default -`ctrl+r` shell history search that uses an intelligent search engine to prioritize -in real-time from your current working directory and recently used commands to -return history suggestions relevant to what you're working on right now. - -#### usage -```json -"features": { - "ghcr.io/ChristopherMacGown/devcontainer-features/mcfly:1": {} -} -``` - -Additional options can be found in the [feature documentation](src/mcfly/README.md). - ### direnv [direnv](https://github.com/direnv/direnv) augments shells to load and unload @@ -46,30 +19,3 @@ environment variables based on the current working directory. } ``` Additional options can be found in the [feature documentation](src/direnv/README.md). - - -### easy-container-hooks -This is a cross-distribution devcontainer feature that installs static script runners to /usr/local/bin that will execute scripts located in your devcontainer's local hooks directory. - -#### usage -```json -"features": { - "ghcr.io/ChristopherMacGown/devcontainer-feautres/easy-container-hooks:1":{} -} -``` -Additional options can be found in the [feature documentation](src/easy-container-hooks/README.md). - - -### minio-client - -[minio-client](https://min.io/docs/minio/linux/reference/minio-mc.html) is an AWS S3 -compatible client for S3 and Minio. - -#### usage -```json -"features": { - "ghcr.io/ChristopherMacGown/devcontainer-features/minio-client:1": {} -} -``` - -Additional options can be found in the [feature documentation](src/minio-client/README.md). \ No newline at end of file diff --git a/src/direnv/install.sh b/src/direnv/install.sh index 40e2478..f549c1f 100644 --- a/src/direnv/install.sh +++ b/src/direnv/install.sh @@ -1,59 +1,51 @@ #!/bin/bash -# Checks if apt lists exist and generates them if not. -apt_get_update() { - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - apt-get update -y - fi -} - -# Checks if packages are installed and installs them if not -check_packages() { - if ! dpkg -s "$@" >/dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends "$@" - fi -} - set -e -# Ensure apt is in non-interactive to avoid prompts -export DEBIAN_FRONTEND=noninteractive - -check_packages apt-transport-https curl ca-certificates tar - -echo "Activating package 'direnv'". - -RELEASES="https://github.com/direnv/direnv/releases" -LATEST="${RELEASES}/latest" - ARCH=${ARCHITECTURE:-"amd64"} AUTO_ENABLE=${AUTOENABLE:-true} VERSION=${VERSION:-"latest"} INSTALL_PATH=${INSTALLPATH:-"/usr/local/bin/direnv"} -if [ "${VERSION}" = "latest" ]; then - VERSION=$(curl -si "${LATEST}" | awk '/location: /{ n=split($2,t,"/"); print t[n] }' | tr -d "\r\n") + +# Install required packages using whichever package manager is available +if command -v apk >/dev/null 2>&1; then + apk add --no-cache curl ca-certificates +elif command -v apt-get >/dev/null 2>&1; then + export DEBIAN_FRONTEND=noninteractive + if [ "$(find /var/lib/apt/lists/* 2>/dev/null | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi + apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates tar +else + echo "Unsupported package manager: neither apk nor apt-get found" + exit 1 fi -set -x +RELEASES="https://github.com/direnv/direnv/releases" + +if [ "${VERSION}" = "latest" ]; then + VERSION=$(curl -si "${RELEASES}/latest" | awk '/location: /{ n=split($2,t,"/"); print t[n] }' | tr -d "\r\n") +fi RELEASE_FILE="direnv.linux-${ARCH}" RELEASE_URL="${RELEASES}/download/${VERSION}/${RELEASE_FILE}" -curl -o ${INSTALL_PATH} -fL "${RELEASE_URL}" -chmod +x ${INSTALL_PATH} +echo "Downloading direnv ${VERSION} for ${ARCH}..." +curl -o "${INSTALL_PATH}" -fL "${RELEASE_URL}" +chmod +x "${INSTALL_PATH}" if [ "${AUTO_ENABLE}" = "true" ]; then BASHRC="${_REMOTE_USER_HOME}/.bashrc" ZSHRC="${_REMOTE_USER_HOME}/.zshrc" - echo "Adding mcfly to ${BASHRC} and ${ZSHRC}" - if [ -z "$(grep _direnv_hook ${BASHRC})" ]; then - direnv hook bash >>${BASHRC} + if [ -f "${BASHRC}" ] && [ -z "$(grep _direnv_hook "${BASHRC}" 2>/dev/null)" ]; then + echo "Adding direnv hook to ${BASHRC}" + direnv hook bash >> "${BASHRC}" fi - if [ -z "$(grep _direnv_hook ${ZSHRC})"]; then - direnv hook zsh >>${ZSHRC} + if [ -f "${ZSHRC}" ] && [ -z "$(grep _direnv_hook "${ZSHRC}" 2>/dev/null)" ]; then + echo "Adding direnv hook to ${ZSHRC}" + direnv hook zsh >> "${ZSHRC}" fi fi diff --git a/src/easy-container-hooks/README.md b/src/easy-container-hooks/README.md deleted file mode 100644 index 31fdd9b..0000000 --- a/src/easy-container-hooks/README.md +++ /dev/null @@ -1,29 +0,0 @@ - -# easy-container-hooks (easy-container-hooks) - -Shell runner that executes hooks in your .devcontainer/hooks/ directory. - -## Example Usage - -```json -"features": { - "ghcr.io/ChristopherMacGown/devcontainer-features/easy-container-hooks:1": {} -} -``` - -## Options - -| Options Id | Description | Type | Default Value | -|-----|-----|-----|-----| -| hooksDir | - | string | .devcontainer/hooks | -| onCreateHookPath | - | string | on-create | -| postAttachHookPath | - | string | post-attach | -| postCreateHookPath | - | string | post-create | -| postStartHookPath | - | string | post-start | -| updateContentHookPath | - | string | update-content | - - - ---- - -_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/ChristopherMacGown/devcontainer-features/blob/main/src/easy-container-hooks/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ diff --git a/src/easy-container-hooks/devcontainer-feature.json b/src/easy-container-hooks/devcontainer-feature.json deleted file mode 100644 index 616d6e0..0000000 --- a/src/easy-container-hooks/devcontainer-feature.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "easy-container-hooks", - "id": "easy-container-hooks", - "version": "1.0.0", - "description": "Shell runner that executes hooks in your .devcontainer/hooks/ directory.", - "options": { - "hooksDir": { - "description": "", - "type": "string", - "default": ".devcontainer/hooks" - }, - "onCreateHookPath": { - "description": "", - "type": "string", - "default": "on-create" - }, - "postAttachHookPath": { - "description": "", - "type": "string", - "default": "post-attach" - }, - "postCreateHookPath": { - "description": "", - "type": "string", - "default": "post-create" - }, - "postStartHookPath": { - "description": "", - "type": "string", - "default": "post-start" - }, - "updateContentHookPath": { - "description": "", - "type": "string", - "default": "update-content" - } - }, - "onCreateCommand" : ["/usr/local/bin/ezdc_onCreate.sh"], - "postCreateCommand": ["/usr/local/bin/ezdc_postCreate.sh"], - "postStartCommand": ["/usr/local/bin/ezdc_postStart.sh"], - "postAttachCommand": ["/usr/local/bin/ezdc_postAttach.sh"], - "updateContentCommand": ["/usr/local/bin/ezdc_updateContent.sh"] -} \ No newline at end of file diff --git a/src/easy-container-hooks/install.sh b/src/easy-container-hooks/install.sh deleted file mode 100644 index b9327f1..0000000 --- a/src/easy-container-hooks/install.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env sh - -set -exu - -get_hook_dir() { - case $1 in - onCreate) - echo ${ONCREATEHOOKPATH} - ;; - postAttach) - echo ${POSTATTACHHOOKPATH} - ;; - postCreate) - echo ${POSTCREATEHOOKPATH} - ;; - postStart) - echo ${POSTSTARTHOOKPATH} - ;; - updateContent) - echo ${UPDATECONTENTHOOKPATH} - ;; - *) - echo "UNKNOWN HOOK: $1"; - exit 1 - esac -} - -emit_hook() { - local HOOK_DIR=$(realpath --relative-to=. -m $1); - - cat ./run-hook.sh.tmpl | sed "s@#####REPLACE######@${HOOK_DIR}@"; -} - -for hook in "onCreate" "postAttach" "postCreate" "postStart" "updateContent"; do - emit_hook "${HOOKSDIR}/$(get_hook_dir ${hook})" > /usr/local/bin/ezdc_${hook}.sh; - chmod +x /usr/local/bin/ezdc_${hook}.sh; -done \ No newline at end of file diff --git a/src/easy-container-hooks/run-hook.sh.tmpl b/src/easy-container-hooks/run-hook.sh.tmpl deleted file mode 100644 index a1caa6d..0000000 --- a/src/easy-container-hooks/run-hook.sh.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -HOOKS=#####REPLACE###### -WORKSPACE_DIR=$(pwd); -WORKSPACE_HOOKS=${WORKSPACE_DIR}/${HOOKS}; -for HOOK in $(ls ${WORKSPACE_HOOKS}); do - env WORKSPACE_DIR=${WORKSPACE_DIR} bash "${WORKSPACE_HOOKS}/${HOOK}" -done - diff --git a/src/mcfly/README.md b/src/mcfly/README.md deleted file mode 100644 index 7a7b3a1..0000000 --- a/src/mcfly/README.md +++ /dev/null @@ -1,28 +0,0 @@ - -# mcfly (mcfly) - -Installs mcfly, which replaces your shell history with an intelligent search engine. - -## Example Usage - -```json -"features": { - "ghcr.io/ChristopherMacGown/devcontainer-features/mcfly:1": {} -} -``` - -## Options - -| Options Id | Description | Type | Default Value | -|-----|-----|-----|-----| -| architecture | The CPU architecture for the mcfly release. | string | x86_64 | -| autoEnable | Automatically enable mcfly for bash, zsh, and fish shells. | boolean | true | -| installPath | The path where mcfly will be installed. | string | /usr/local/bin/mcfly | -| libc | The GLIBC of the mcfly binary. | string | musl | -| version | Either the latest version or a specific release. | string | latest | - - - ---- - -_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/ChristopherMacGown/devcontainer-features/blob/main/src/mcfly/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ diff --git a/src/mcfly/devcontainer-feature.json b/src/mcfly/devcontainer-feature.json deleted file mode 100644 index 6dba05c..0000000 --- a/src/mcfly/devcontainer-feature.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "mcfly", - "id": "mcfly", - "version": "1.0.2", - "description": "Installs mcfly, which replaces your shell history with an intelligent search engine.", - "options": { - "architecture": { - "type": "string", - "proposals": [ - "aarch64", - "arm", - "arm7", - "i686", - "x86_64" - ], - "default": "x86_64", - "description": "The CPU architecture for the mcfly release." - }, - "autoEnable": { - "type": "boolean", - "default": true, - "description": "Automatically enable mcfly for bash, zsh, and fish shells." - }, - "installPath": { - "type": "string", - "default": "/usr/local/bin/mcfly", - "description": "The path where mcfly will be installed." - }, - "libc": { - "type": "string", - "proposals": [ - "gnu", - "gnueabi", - "gnueabihf", - "musl" - ], - "default": "musl", - "description": "The GLIBC of the mcfly binary." - }, - "version": { - "type": "string", - "proposals": [ - "latest" - ], - "default": "latest", - "description": "Either the latest version or a specific release." - } - }, - "installsAfter": [ - "ghcr.io/devcontainers/features/common-utils" - ] -} \ No newline at end of file diff --git a/src/mcfly/install.sh b/src/mcfly/install.sh deleted file mode 100755 index a0a6a5d..0000000 --- a/src/mcfly/install.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Checks if apt lists exist and generates them if not. -apt_get_update() { - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - apt-get update -y - fi -} - -# Checks if packages are installed and installs them if not -check_packages() { - if ! dpkg -s "$@" >/dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends "$@" - fi -} - -set -e - -# Ensure apt is in non-interactive to avoid prompts -export DEBIAN_FRONTEND=noninteractive - -check_packages apt-transport-https curl ca-certificates tar - -echo "Activating feature 'mcfly'" - -export MCFLY_PATH=${INSTALLPATH:-"/usr/local/bin/mcfly"} - -RELEASES="https://github.com/cantino/mcfly/releases" -LATEST="${RELEASES}/latest" -ARCH=${ARCHITECTURE:-"x86_64"} -ARCH_TUPLE="${ARCH}-unknown-linux" -AUTO_ENABLE=${AUTOENABLE:-true} -LIBC=${LIBC:-"musl"} -VERSION=${VERSION:-"latest"} -if [ "${VERSION}" = "latest" ]; then - VERSION=$(curl -si "${LATEST}" | awk '/location: /{ n=split($2,t,"/"); print t[n] }' | tr -d "\r\n") -fi - -RELEASE_FILE="mcfly-${VERSION}-${ARCH_TUPLE}-${LIBC}.tar.gz" -RELEASE_URL="${RELEASES}/download/${VERSION}/${RELEASE_FILE}" - -curl -L "${RELEASE_URL}" | tar xz && mv mcfly ${MCFLY_PATH} -chmod +x ${MCFLY_PATH} - -if [ "${AUTO_ENABLE}" = "true" ]; then - BASHRC="${_REMOTE_USER_HOME}/.bashrc" - ZSHRC="${_REMOTE_USER_HOME}/.zshrc" - - echo "Adding mcfly to ${BASHRC} and ${ZSHRC}" - if [ -z "$(grep \"mcfly init bash\" ${BASHRC})" ]; then - echo -e "export MCFLY_HISTFILE=\"\${HISTFILE:-\$HOME/.bash_history}\"" >>${BASHRC} - echo -e "source <(mcfly init bash)" >>${BASHRC} - fi - - if [ -z "$(grep \"mcfly init zsh\" ${ZSHRC})"]; then - echo -e "export MCFLY_HISTFILE=\"\${HISTFILE:-\$HOME/.zsh_history}\"" >>${ZSHRC} - echo -e "source <(mcfly init zsh)" >>${ZSHRC} - fi -fi diff --git a/src/minio-client/README.md b/src/minio-client/README.md deleted file mode 100644 index e15eaf2..0000000 --- a/src/minio-client/README.md +++ /dev/null @@ -1,26 +0,0 @@ - -# minio-client (minio-client) - -Installs the minio client - -## Example Usage - -```json -"features": { - "ghcr.io/ChristopherMacGown/devcontainer-features/minio-client:1": {} -} -``` - -## Options - -| Options Id | Description | Type | Default Value | -|-----|-----|-----|-----| -| installPath | The path where minio will be installed. | string | /usr/local/bin/mc | -| vendor | The OS vendor of the devcontainer | string | linux | -| architecture | The CPU architecture of the devcontainer | string | - | - - - ---- - -_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/ChristopherMacGown/devcontainer-features/blob/main/src/minio-client/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ diff --git a/src/minio-client/devcontainer-feature.json b/src/minio-client/devcontainer-feature.json deleted file mode 100644 index a82fd77..0000000 --- a/src/minio-client/devcontainer-feature.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "minio-client", - "id": "minio-client", - "version": "1.0.1", - "description": "Installs the minio client", - "options": { - "installPath": { - "type": "string", - "default": "/usr/local/bin/mc", - "description": "The path where minio will be installed." - }, - "vendor": { - "type": "string", - "default": "linux", - "description": "The OS vendor of the devcontainer", - "proposals": [ - "linux", - "darwin", - "windows" - ] - }, - "architecture": { - "type": "string", - "default": "", - "description": "The CPU architecture of the devcontainer", - "proposals": [ - "amd64", - "arm", - "arm64" - ] - }, - "version": { - "type": "string", - "default": "", - "description": "The version to the minio client, e.g. RELEASE.2025-08-13T08-35-41Z. Find at https://github.com/minio/mc/releases" - } - } -} diff --git a/src/minio-client/install.sh b/src/minio-client/install.sh deleted file mode 100644 index e034f27..0000000 --- a/src/minio-client/install.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# Checks if apt lists exist and generates them if not. -apt_get_update() { - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - apt-get update -y - fi -} - -# Checks if packages are installed and installs them if not -check_packages() { - if ! dpkg -s "$@" >/dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends "$@" - fi -} - -set -e - -if [[ -n "${ARCHITECTURE}" ]]; then - MINIO_ARCH=${ARCHITECTURE} -else - case `uname -m` in - aarch64) - MINIO_ARCH=arm64;; - x86_64) - MINIO_ARCH=amd64;; - *) - MINIO_ARCH=`uname -m`;; - esac -fi - -if [[ -z "${VERSION}" ]]; then - MINIO_DL_BINARY="mc" -else - MINIO_DL_BINARY="mc.RELEASE.${VERSION}" - echo "Version is ${VERSION}" -fi - -export MINIO_PATH=${INSTALLPATH:-"/usr/local/bin/mc"} -export MINIO_VENDOR=${VENDOR:-"linux"} -export MINIO_ARCH -export MINIO_DL_BINARY - -export DOWNLOAD_PATH="https://dl.min.io/client/mc/release/${MINIO_VENDOR}-${MINIO_ARCH}/" - -# Ensure apt is in non-interactive to avoid prompts -export DEBIAN_FRONTEND=noninteractive - -echo "Activating feature 'minio-client'" -check_packages apt-transport-https curl ca-certificates - -RELEASE_HASH=$(curl -sL "${DOWNLOAD_PATH}/${MINIO_DL_BINARY}.sha256sum") -RELEASE_FILE=${RELEASE_HASH#* } - - -sleep 10 - -curl -sLO "${DOWNLOAD_PATH}/${RELEASE_FILE}" -if [[ $(sha256sum --check <<< "${RELEASE_HASH}") = "${RELEASE_FILE}: OK" ]]; then - chmod a+x ${RELEASE_FILE} - mv ${RELEASE_FILE} ${MINIO_PATH} - exit 0 -fi - -echo "Invalid checksum for ${RELEASE_FILE}" -rm ${RELEASE_FILE} -exit -1 \ No newline at end of file diff --git a/test/easy-container-hooks/changed_hooks_dir.sh b/test/easy-container-hooks/changed_hooks_dir.sh deleted file mode 100644 index 8608902..0000000 --- a/test/easy-container-hooks/changed_hooks_dir.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# This test file will be executed against an auto-generated devcontainer.json that -# includes the "easy-container-hooks" feature with no options. -# -# -# This test can be run with the following command: -# -# devcontainer features test \ -# --features easy-container-hooks \ -# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \ -# . - -set -e - -source dev-container-features-test-lib -source ./lib.sh - -for HOOK in "on-create" "post-attach" "post-create" "post-start" "update-content"; do - HOOK_DIR=".devcontainer/skooh/${HOOK}"; - - ensure_hook_dir ${HOOK_DIR} - write_test_hook ${HOOK_DIR} - test_hook ${HOOK_DIR} ${HOOK} -done - -# Report results -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults \ No newline at end of file diff --git a/test/easy-container-hooks/changed_oncreatehook_dir.sh b/test/easy-container-hooks/changed_oncreatehook_dir.sh deleted file mode 100644 index 2c07f6e..0000000 --- a/test/easy-container-hooks/changed_oncreatehook_dir.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# This test file will be executed against an auto-generated devcontainer.json that -# includes the "easy-container-hooks" feature with no options. -# -# -# This test can be run with the following command: -# -# devcontainer features test \ -# --features easy-container-hooks \ -# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \ -# . - -set -e - -source dev-container-features-test-lib -source ./lib.sh - -for HOOK in "on-create" "post-attach" "post-create" "post-start" "update-content"; do - HOOK_DIR=".devcontainer/hooks/$HOOK"; - if [[ ${HOOK} = "on-create" ]]; then - HOOK_DIR=".devcontainer/hooks/create-on"; - fi - ensure_hook_dir ${HOOK_DIR} - write_test_hook ${HOOK_DIR} ${HOOK} - test_hook ${HOOK_DIR} ${HOOK} -done - -# Report results -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults \ No newline at end of file diff --git a/test/easy-container-hooks/changed_postcreatehook_dir.sh b/test/easy-container-hooks/changed_postcreatehook_dir.sh deleted file mode 100644 index 403d4b1..0000000 --- a/test/easy-container-hooks/changed_postcreatehook_dir.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# This test file will be executed against an auto-generated devcontainer.json that -# includes the "easy-container-hooks" feature with no options. -# -# -# This test can be run with the following command: -# -# devcontainer features test \ -# --features easy-container-hooks \ -# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \ -# . - -set -e - -source dev-container-features-test-lib -source ./lib.sh - -for HOOK in "on-create" "post-attach" "post-create" "post-start" "update-content"; do - HOOK_DIR=".devcontainer/hooks/$HOOK"; - if [[ ${HOOK} = "post-create" ]]; then - HOOK_DIR=".devcontainer/hooks/create-post"; - fi - ensure_hook_dir ${HOOK_DIR} - write_test_hook ${HOOK_DIR} ${HOOK} - test_hook ${HOOK_DIR} ${HOOK} -done - -# Report results -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults \ No newline at end of file diff --git a/test/easy-container-hooks/lib.sh b/test/easy-container-hooks/lib.sh deleted file mode 100644 index 82d2c36..0000000 --- a/test/easy-container-hooks/lib.sh +++ /dev/null @@ -1,34 +0,0 @@ -function ensure_hook_dir() { - mkdir -p $1; -} - -function write_test_hook() { - OUTPUT=${2:-$(basename $1)}; - cat < "$1/test_${OUTPUT}.sh" -#!/usr/bin/env bash - -set -e - -echo ${OUTPUT} -HOOK -} - -function get_hook_runner() { - case $1 in - on-create) echo "/usr/local/bin/ezdc_onCreate.sh";; - post-attach) echo "/usr/local/bin/ezdc_postAttach.sh";; - post-create) echo "/usr/local/bin/ezdc_postCreate.sh";; - post-start) echo "/usr/local/bin/ezdc_postStart.sh";; - update-content) echo "/usr/local/bin/ezdc_updateContent.sh";; - esac -} - -function test_hook() { - EXPECTATION=$1 - HOOK=$2 - - cat $(get_hook_runner $HOOK) - - check "runner-installed $HOOK" bash -c "cat $(get_hook_runner $HOOK) | grep HOOKS=${EXPECTATION}" - check "runner-runs-hooks $HOOK" bash -c "$(get_hook_runner $HOOK) | grep $HOOK" -} \ No newline at end of file diff --git a/test/easy-container-hooks/scenarios.json b/test/easy-container-hooks/scenarios.json deleted file mode 100644 index ca4474c..0000000 --- a/test/easy-container-hooks/scenarios.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "changed_hooks_dir": { - "image": "mcr.microsoft.com/devcontainers/base:alpine", - "features": { - "easy-container-hooks": { - "hooksDir": ".devcontainer/skooh/" - } - } - }, - "changed_oncreatehook_dir": { - "image": "mcr.microsoft.com/devcontainers/base:alpine", - "features": { - "easy-container-hooks": { - "onCreateHookPath": "create-on" - } - } - }, - "changed_postcreatehook_dir": { - "image": "mcr.microsoft.com/devcontainers/base:alpine", - "features": { - "easy-container-hooks": { - "postCreateHookPath": "create-post" - } - } - } -} \ No newline at end of file diff --git a/test/easy-container-hooks/test.sh b/test/easy-container-hooks/test.sh deleted file mode 100755 index 121d0c9..0000000 --- a/test/easy-container-hooks/test.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# This test file will be executed against an auto-generated devcontainer.json that -# includes the "easy-container-hooks" feature with no options. -# -# -# This test can be run with the following command: -# -# devcontainer features test \ -# --features easy-container-hooks \ -# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \ -# . - -set -e - -source dev-container-features-test-lib -source ./lib.sh - -for HOOK in "on-create" "post-attach" "post-create" "post-start" "update-content"; do - HOOK_DIR=".devcontainer/hooks/${HOOK}"; - - ensure_hook_dir ${HOOK_DIR} - write_test_hook ${HOOK_DIR} - test_hook ${HOOK_DIR} ${HOOK} -done - -# Report results -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults \ No newline at end of file diff --git a/test/mcfly/test.sh b/test/mcfly/test.sh deleted file mode 100644 index 15f0937..0000000 --- a/test/mcfly/test.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# This test file will be executed against an auto-generated devcontainer.json that -# includes the 'mcfly' feature with no options. -# -# Eg: -# { -# "image": "<..some-base-image...>", -# "features": { -# "mcfly": {} -# } -# } -# -# This test can be run with the following command (from the root of this repo) -# devcontainer features test \ -# --features mcfly\ -# --base-image mcr.microsoft.com/devcontainers/base:ubuntu . - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -source dev-container-features-test-lib - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "version" bash -c "mcfly -V | grep -i mcfly" -check "bash-integration" bash -c "cat ~/.bashrc | grep 'source <(mcfly init bash)'" -check "zsh-integration" bash -c "cat ~/.zshrc | grep 'source <(mcfly init zsh)'" - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/minio-client/test.sh b/test/minio-client/test.sh deleted file mode 100644 index 0b6103b..0000000 --- a/test/minio-client/test.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# This test file will be executed against an auto-generated devcontainer.json that -# includes the 'mcfly' feature with no options. -# -# Eg: -# { -# "image": "<..some-base-image...>", -# "features": { -# "minio-client": {} -# } -# } -# -# This test can be run with the following command (from the root of this repo) -# devcontainer features test \ -# --features minio-client \ -# --base-image mcr.microsoft.com/devcontainers/base:ubuntu . - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -source dev-container-features-test-lib - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "version" bash -c "mc -v | grep -i \"mc version\"" -check "architecture" bash -c "mc -v | grep -i \"Runtime:\"" - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults From b33c137109a0ac2009a73bbe8638a6d3d29ad53f Mon Sep 17 00:00:00 2001 From: bryan hunt Date: Tue, 31 Mar 2026 20:49:38 +0100 Subject: [PATCH 2/4] attempt 2 --- .gitignore | 1 + src/direnv/install.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e451751 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +fail.txt diff --git a/src/direnv/install.sh b/src/direnv/install.sh index f549c1f..f1f7e14 100644 --- a/src/direnv/install.sh +++ b/src/direnv/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e From b96656f47685b5f4fb75d7a91a858c5761f45c81 Mon Sep 17 00:00:00 2001 From: bryan hunt Date: Tue, 31 Mar 2026 20:53:29 +0100 Subject: [PATCH 3/4] 3 --- src/direnv/install.sh | 6 +++--- test/direnv/test.sh | 23 +++++++---------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/direnv/install.sh b/src/direnv/install.sh index f1f7e14..a29617f 100644 --- a/src/direnv/install.sh +++ b/src/direnv/install.sh @@ -9,7 +9,7 @@ INSTALL_PATH=${INSTALLPATH:-"/usr/local/bin/direnv"} # Install required packages using whichever package manager is available if command -v apk >/dev/null 2>&1; then - apk add --no-cache curl ca-certificates + apk add --no-cache bash curl ca-certificates elif command -v apt-get >/dev/null 2>&1; then export DEBIAN_FRONTEND=noninteractive if [ "$(find /var/lib/apt/lists/* 2>/dev/null | wc -l)" = "0" ]; then @@ -39,12 +39,12 @@ if [ "${AUTO_ENABLE}" = "true" ]; then BASHRC="${_REMOTE_USER_HOME}/.bashrc" ZSHRC="${_REMOTE_USER_HOME}/.zshrc" - if [ -f "${BASHRC}" ] && [ -z "$(grep _direnv_hook "${BASHRC}" 2>/dev/null)" ]; then + if ! grep -q "_direnv_hook" "${BASHRC}" 2>/dev/null; then echo "Adding direnv hook to ${BASHRC}" direnv hook bash >> "${BASHRC}" fi - if [ -f "${ZSHRC}" ] && [ -z "$(grep _direnv_hook "${ZSHRC}" 2>/dev/null)" ]; then + if command -v zsh >/dev/null 2>&1 && ! grep -q "_direnv_hook" "${ZSHRC}" 2>/dev/null; then echo "Adding direnv hook to ${ZSHRC}" direnv hook zsh >> "${ZSHRC}" fi diff --git a/test/direnv/test.sh b/test/direnv/test.sh index 9bcbf72..f40b5bc 100644 --- a/test/direnv/test.sh +++ b/test/direnv/test.sh @@ -3,14 +3,6 @@ # This test file will be executed against an auto-generated devcontainer.json that # includes the 'direnv' feature with no options. # -# Eg: -# { -# "image": "<..some-base-image...>", -# "features": { -# "direnv": {} -# } -# } -# # This test can be run with the following command (from the root of this repo) # devcontainer features test \ # --features direnv\ @@ -18,15 +10,14 @@ set -e -# Optional: Import test library bundled with the devcontainer CLI source dev-container-features-test-lib -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "version" bash -c "direnv help | grep direnv | head -1" -check "bash-integration" bash -c "cat ~/.bashrc | grep _direnv_hook\(\)" -check "zsh-integration" bash -c "cat ~/.zshrc | grep _direnv_hook\(\)" +check "version" direnv version +check "bash-integration" grep "_direnv_hook" ~/.bashrc + +# zsh integration is only present when zsh is installed +if command -v zsh >/dev/null 2>&1; then + check "zsh-integration" grep "_direnv_hook" ~/.zshrc +fi -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. reportResults From 0143a30dffa9b8e12e55ee7b9cd1002c657eb059 Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 31 Mar 2026 19:54:52 +0000 Subject: [PATCH 4/4] Automated documentation update [skip ci] --- src/direnv/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/direnv/README.md b/src/direnv/README.md index 220876f..3582e59 100644 --- a/src/direnv/README.md +++ b/src/direnv/README.md @@ -7,7 +7,7 @@ Installs direnv, which augments shells to load an unload environment variables d ```json "features": { - "ghcr.io/ChristopherMacGown/devcontainer-features/direnv:1": {} + "ghcr.io/brycircle/devcontainer-features/direnv:1": {} } ``` @@ -24,4 +24,4 @@ Installs direnv, which augments shells to load an unload environment variables d --- -_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/ChristopherMacGown/devcontainer-features/blob/main/src/direnv/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ +_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/brycircle/devcontainer-features/blob/main/src/direnv/devcontainer-feature.json). Add additional notes to a `NOTES.md`._