From 7c16cf00eca91ae0a4a16b274f4087a11adb1869 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 8 Jul 2026 11:23:40 -0700 Subject: [PATCH] use devcontainers/features/git again and remove vendored git feature --- features/src/git/NOTES.md | 7 - features/src/git/README.md | 32 -- features/src/git/common/etc/bash.bash_env | 37 -- .../etc/skel/.config/clangd/config.yaml | 63 ---- .../git/common/find-version-from-git-tags.sh | 129 ------- features/src/git/common/install.sh | 64 ---- features/src/git/common/utilities.sh | 186 ---------- features/src/git/devcontainer-feature.json | 38 --- features/src/git/install.sh | 321 ------------------ .../test/git/install_git_from_ppa_bionic.sh | 16 - .../test/git/install_git_from_ppa_jammy.sh | 17 - .../test/git/install_git_from_ppa_noble.sh | 17 - .../test/git/install_git_from_ppa_resolute.sh | 17 - features/test/git/install_git_from_src.sh | 25 -- .../test/git/install_git_from_src_alma-8.sh | 16 - .../test/git/install_git_from_src_alma-9.sh | 16 - .../test/git/install_git_from_src_alpine.sh | 16 - .../test/git/install_git_from_src_bionic.sh | 17 - .../test/git/install_git_from_src_bullseye.sh | 17 - .../test/git/install_git_from_src_buster.sh | 17 - .../test/git/install_git_from_src_centos-7.sh | 16 - .../test/git/install_git_from_src_fedora.sh | 16 - .../test/git/install_git_from_src_jammy.sh | 17 - .../test/git/install_git_from_src_mariner.sh | 16 - .../test/git/install_git_from_src_noble.sh | 18 - .../test/git/install_git_from_src_resolute.sh | 17 - .../test/git/install_git_from_src_rocky-8.sh | 16 - .../test/git/install_git_from_src_rocky-9.sh | 16 - .../git/install_git_from_system_alma-8.sh | 16 - .../git/install_git_from_system_alma-9.sh | 16 - .../git/install_git_from_system_alpine.sh | 15 - .../git/install_git_from_system_centos-7.sh | 16 - .../git/install_git_from_system_fedora.sh | 16 - .../git/install_git_from_system_mariner.sh | 15 - .../git/install_git_from_system_rocky-8.sh | 16 - .../git/install_git_from_system_rocky-9.sh | 16 - features/test/git/scenarios.json | 218 ------------ features/test/git/test.sh | 12 - image/.devcontainer/devcontainer.json | 4 +- 39 files changed, 2 insertions(+), 1558 deletions(-) delete mode 100644 features/src/git/NOTES.md delete mode 100644 features/src/git/README.md delete mode 100755 features/src/git/common/etc/bash.bash_env delete mode 100644 features/src/git/common/etc/skel/.config/clangd/config.yaml delete mode 100755 features/src/git/common/find-version-from-git-tags.sh delete mode 100755 features/src/git/common/install.sh delete mode 100644 features/src/git/common/utilities.sh delete mode 100644 features/src/git/devcontainer-feature.json delete mode 100644 features/src/git/install.sh delete mode 100644 features/test/git/install_git_from_ppa_bionic.sh delete mode 100644 features/test/git/install_git_from_ppa_jammy.sh delete mode 100644 features/test/git/install_git_from_ppa_noble.sh delete mode 100644 features/test/git/install_git_from_ppa_resolute.sh delete mode 100644 features/test/git/install_git_from_src.sh delete mode 100644 features/test/git/install_git_from_src_alma-8.sh delete mode 100644 features/test/git/install_git_from_src_alma-9.sh delete mode 100644 features/test/git/install_git_from_src_alpine.sh delete mode 100644 features/test/git/install_git_from_src_bionic.sh delete mode 100644 features/test/git/install_git_from_src_bullseye.sh delete mode 100644 features/test/git/install_git_from_src_buster.sh delete mode 100644 features/test/git/install_git_from_src_centos-7.sh delete mode 100644 features/test/git/install_git_from_src_fedora.sh delete mode 100644 features/test/git/install_git_from_src_jammy.sh delete mode 100644 features/test/git/install_git_from_src_mariner.sh delete mode 100644 features/test/git/install_git_from_src_noble.sh delete mode 100644 features/test/git/install_git_from_src_resolute.sh delete mode 100644 features/test/git/install_git_from_src_rocky-8.sh delete mode 100644 features/test/git/install_git_from_src_rocky-9.sh delete mode 100644 features/test/git/install_git_from_system_alma-8.sh delete mode 100644 features/test/git/install_git_from_system_alma-9.sh delete mode 100644 features/test/git/install_git_from_system_alpine.sh delete mode 100644 features/test/git/install_git_from_system_centos-7.sh delete mode 100644 features/test/git/install_git_from_system_fedora.sh delete mode 100644 features/test/git/install_git_from_system_mariner.sh delete mode 100644 features/test/git/install_git_from_system_rocky-8.sh delete mode 100644 features/test/git/install_git_from_system_rocky-9.sh delete mode 100644 features/test/git/scenarios.json delete mode 100644 features/test/git/test.sh diff --git a/features/src/git/NOTES.md b/features/src/git/NOTES.md deleted file mode 100644 index 507ba8e8..00000000 --- a/features/src/git/NOTES.md +++ /dev/null @@ -1,7 +0,0 @@ - - -## OS Support - -This Feature should work on recent versions of Alpine, Debian/Ubuntu, RedHat Enterprise Linux, Fedora, Alma, and RockyLinux distributions with the `apk`, `apt`, `yum`, `dnf`, or `microdnf` package manager installed. - -`bash` is required to execute the `install.sh` script. diff --git a/features/src/git/README.md b/features/src/git/README.md deleted file mode 100644 index e750bbed..00000000 --- a/features/src/git/README.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Git (from source) (git) - -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. - -## Example Usage - -```json -"features": { - "ghcr.io/devcontainers/features/git:1": {} -} -``` - -## Options - -| Options Id | Description | Type | Default Value | -|-----|-----|-----|-----| -| version | Select or enter a Git version. | string | os-provided | -| ppa | Install from PPA if available (only supported for Ubuntu distributions) | boolean | true | - - - -## OS Support - -This Feature should work on recent versions of Alpine, Debian/Ubuntu, RedHat Enterprise Linux, Fedora, Alma, and RockyLinux distributions with the `apk`, `apt`, `yum`, `dnf`, or `microdnf` package manager installed. - -`bash` is required to execute the `install.sh` script. - - ---- - -_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/git/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ diff --git a/features/src/git/common/etc/bash.bash_env b/features/src/git/common/etc/bash.bash_env deleted file mode 100755 index 0005efeb..00000000 --- a/features/src/git/common/etc/bash.bash_env +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/env bash - -# Respect --noprofile and --norc -if [[ ! $(ps -o args= -p $$) =~ (--noprofile) ]]; then - # Otherwise, initialize non-login shells like login shells - if ! shopt -q login_shell; then - if [ -f /etc/profile ]; then - . /etc/profile - fi - for x in "$HOME"/.{bash_profile,bash_login,profile}; do - if [ -f "$x" ]; then - . "$x" - break - fi - done - fi -elif [[ ! $(ps -o args= -p $$) =~ (--norc|--rcfile|--init-file) ]]; then - if [ -f /etc/bash.bashrc ]; then - . /etc/bash.bashrc - fi - for x in "$HOME"/.bashrc; do - if [ -f "$x" ]; then - . "$x" - break - fi - done -fi - -export BASH_ENV=/etc/bash.bash_env - -if [ -n "${BASH_ENV_ETC_PROFILE:-}" ]; then - if [ -f "$BASH_ENV_ETC_PROFILE" ] \ - && [ "$BASH_ENV_ETC_PROFILE" != "$BASH_ENV" ]; \ - then - . "$BASH_ENV_ETC_PROFILE" - fi -fi diff --git a/features/src/git/common/etc/skel/.config/clangd/config.yaml b/features/src/git/common/etc/skel/.config/clangd/config.yaml deleted file mode 100644 index 52c36cb9..00000000 --- a/features/src/git/common/etc/skel/.config/clangd/config.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# https://clangd.llvm.org/config - -# Apply a config conditionally to all C files -If: - PathMatch: .*\.(c|h)$ - ---- - -# Apply a config conditionally to all C++ files -If: - PathMatch: .*\.(c|h)pp - ---- - -# Apply a config conditionally to all CUDA files -If: - PathMatch: .*\.cuh? -CompileFlags: - Add: - - "-x" - - "cuda" - # No error on unknown CUDA versions - - "-Wno-unknown-cuda-version" - # Allow variadic CUDA functions - - "-Xclang=-fcuda-allow-variadic-functions" - ---- - -# Tweak the clangd parse settings for all files -CompileFlags: - Add: - # report all errors - - "-ferror-limit=0" - - "-fmacro-backtrace-limit=0" - - "-ftemplate-backtrace-limit=0" - # Skip the CUDA version check - - "--no-cuda-version-check" - Remove: - # remove gcc's -fcoroutines - - -fcoroutines - # remove nvc++ flags unknown to clang - - "-gpu=*" - - "-stdpar*" - # remove nvcc flags unknown to clang - - "-arch*" - - "-gencode*" - - "--generate-code*" - - "-ccbin*" - - "-t=*" - - "--threads*" - - "-Xptxas*" - - "-Xcudafe*" - - "-Xfatbin*" - - "-Xcompiler*" - - "--diag-suppress*" - - "--diag_suppress*" - - "--compiler-options*" - - "--expt-extended-lambda" - - "--expt-relaxed-constexpr" - - "-forward-unknown-to-host-compiler" - - "-Werror=cross-execution-space-call" - - "--compress-mode*" - - "-static-global-template-stub*" diff --git a/features/src/git/common/find-version-from-git-tags.sh b/features/src/git/common/find-version-from-git-tags.sh deleted file mode 100755 index b959c131..00000000 --- a/features/src/git/common/find-version-from-git-tags.sh +++ /dev/null @@ -1,129 +0,0 @@ -#! /usr/bin/env bash - -# Assign variable one scope above the caller -# Usage: local "$1" && _upvar $1 "value(s)" -# Param: $1 Variable name to assign value to -# Param: $* Value(s) to assign. If multiple values, an array is -# assigned, otherwise a single value is assigned. -# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference -_upvar() { - if unset -v "$1"; then - if (( $# == 2 )); then - eval $1=\"\$2\"; - else - eval $1=\(\"\${@:2}\"\); - fi; - fi -} - -declare -Ag _find_version_from_git_tags_cache=(); - -# Figure out correct version of a three part version number is not passed -_find_version_from_git_tags() { - local variable_name="$1" - local requested_version="${!variable_name}" - if [ "${requested_version}" = "none" ]; then return; fi - local repository="$2" - local prefix="${3:-"tags/v"}" - local separator="${4:-"."}" - local suffix="${5:-}" - local last_part_optional="${6:-"false"}" - local after_version="${7:-""}" - if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then - local escaped_separator="${separator//./\\.}" - local last_part="" - if [ "${last_part_optional}" = "true" ]; then - last_part+="(${escaped_separator}[0-9]+)?" - last_part+="(${escaped_separator}[0-9]+)?" - if [ -n "${suffix:+x}" ]; then - last_part+="(${suffix})?" - fi - else - last_part+="${escaped_separator}[0-9]+" - last_part+="${escaped_separator}[0-9]+" - if [ -n "${suffix:+x}" ]; then - last_part+="(${suffix})" - fi - fi - local regex="${prefix}\\K[0-9]+${last_part}$" - - if ! test -v _find_version_from_git_tags_cache["$variable_name"]; then - local remote_upstream_fetch="$(git --no-pager config get remote.upstream.fetch)" - if test -n "${remote_upstream_fetch:+x}"; then - git config unset --global remote.upstream.fetch || true - fi - readarray -t version_list < <( - git ls-remote --tags "${repository}" \ - | grep -oP "${regex}" \ - | tr -d ' ' \ - | tr "${separator}" "." \ - | sort -rV - ) - if test -n "${remote_upstream_fetch:+x}"; then - git config set --global remote.upstream.fetch "${remote_upstream_fetch}" - fi - _upvar _find_version_from_git_tags_cache["$variable_name"] "${version_list[*]}" - else - readarray -d' ' -t version_list <<< "${_find_version_from_git_tags_cache["$variable_name"]}" - fi - local version_list="$(IFS=$'\n'; echo "${version_list[*]}")" - if [ "${requested_version}" = "latest" ] || [ "${requested_version}" = "current" ] || [ "${requested_version}" = "lts" ]; then - requested_version="$(head -n 1 <<< "${version_list}")" - elif test -n "${after_version:+x}"; then - set +e - requested_version="$(grep -A 1 -m 1 "${after_version}" <<< "${version_list}" | tail -n 1)" - set -e - else - set +e - requested_version="$(grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)" <<< "${version_list}")" - set -e - fi - fi - if [ ! -n "${requested_version:+x}" ] || ! grep "^${requested_version//./\\.}$" <<< "${version_list}" > /dev/null 2>&1; then - echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 - return 1 - fi - _upvar "${variable_name}" "${requested_version}" - echo "${variable_name}=${requested_version}" -} - -# Use semver logic to decrement a version number then look for the closest match -_find_prev_version_from_git_tags() { - local variable_name="$1" - local current_version="${!variable_name}" - local repository="$2" - # Normally a "v" is used before the version number, but support alternate cases - local prefix="${3:-"tags/v"}" - # Some repositories use "_" instead of "." for version number part separation, support that - local separator="${4:-"."}" - # Some repositories may have tags that include a suffix (e.g. actions/node-versions) - local version_suffix_regex="${5:-}" - # Some tools release versions that omit the last digit (e.g. go) - local last_part_optional="${6:-"false"}" - # Try one break fix version number less if we get a failure. Use "set +e" since "set -e" can cause failures in valid scenarios. - set +e - local major="$(echo "${current_version}" | grep -oE '^[0-9]+' || echo '')" - local minor="$(echo "${current_version}" | grep -oP '^[0-9]+\.\K[0-9]+' || echo '')" - local breakfix="$(echo "${current_version}" | grep -oP '^[0-9]+\.[0-9]+\.\K[0-9]+' 2>/dev/null || echo '')" - - if [ "${minor}" = "0" ] && [ "${breakfix}" = "0" ]; then - ((major=major-1)) - _upvar "${variable_name}" "${major}" - # Look for latest version from previous major release - _find_version_from_git_tags "${variable_name}" "${repository}" "${prefix}" "${separator}" "${version_suffix_regex}" "${last_part_optional}" - # Handle situations like Go's odd version pattern where "0" releases omit the last part - elif [ "${breakfix}" = "" ] || [ "${breakfix}" = "0" ]; then - ((minor=minor-1)) - _upvar "${variable_name}" "${major}.${minor}" - # Look for latest version from previous minor release - _find_version_from_git_tags "${variable_name}" "${repository}" "${prefix}" "${separator}" "${version_suffix_regex}" "${last_part_optional}" - else - ((breakfix=breakfix-1)) - if [ "${breakfix}" = "0" ] && [ "${last_part_optional}" = "true" ]; then - _upvar "${variable_name}" "${major}.${minor}" - else - _upvar "${variable_name}" "${major}.${minor}.${breakfix}" - fi - fi - set -e -} diff --git a/features/src/git/common/install.sh b/features/src/git/common/install.sh deleted file mode 100755 index 62c7cf81..00000000 --- a/features/src/git/common/install.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /usr/bin/env bash -set -e - -if [ "$(id -u)" -ne 0 ]; then - echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' - exit 1 -fi - -src="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# export bash utility functions -# shellcheck disable=SC1091 -source "$src/utilities.sh"; - -rm -f /etc/profile.d/00-restore-env.sh; - -# install /etc/skel -cp -r "$src/etc/skel" /etc/; -# install /etc/bash.bash_env -cp "$src/etc/bash.bash_env" /etc/; -chown root:root /etc/bash.bash_env; -chmod u+rwx,g+rwx,o+rx /etc/bash.bash_env; - -unset src; - -# Store and reset BASH_ENV in /etc/profile so lmod doesn't steal it from us. -# Our `/etc/bash.bash_env` will source lmod's $BASH_ENV at the end. -append_to_etc_profile "$(cat <> /etc/environment; -fi - -# Remove unnecessary "$HOME/.local/bin" at the end of the path -# shellcheck disable=SC2016 -if grep -qxF 'if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.local/bin"; fi' /etc/bash.bashrc; then - grep -vxF \ - 'if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.local/bin"; fi' \ - /etc/bash.bashrc \ - > /etc/bash.bashrc.new \ - && mv /etc/bash.bashrc{.new,}; -fi - -cp /etc/skel/.profile /root/.profile; -echo 'mesg n 2> /dev/null || true' >> /root/.profile; - -for_each_user_profile "$(cat <<"EOF" -sed -i 's@if \[ -d "$HOME/bin" \]@if [ -n "${PATH##*"$HOME/bin"*}" ] \&\& [ -d "$HOME/bin" ]@' $0; -sed -i 's@if \[ -d "$HOME/.local/bin" \]@if [ -n "${PATH##*"$HOME/.local/bin"*}" ] \&\& [ -d "$HOME/.local/bin" ]@' $0; -EOF -)"; - -# Fix the devcontainers/features/common-utils __bash_prompt fn -# shellcheck disable=SC2016 -for_each_user_bashrc ' -if [[ "$(grep -qE "^__bash_prompt\(\) \{$" "$0"; echo $?)" == 0 ]]; then - sed -i "s/\${BRANCH}/\${BRANCH:-}/g" "$0"; - sed -i "s/\${GITHUB_USER}/\${GITHUB_USER:-}/g" "$0"; -fi -'; diff --git a/features/src/git/common/utilities.sh b/features/src/git/common/utilities.sh deleted file mode 100644 index 49a044b9..00000000 --- a/features/src/git/common/utilities.sh +++ /dev/null @@ -1,186 +0,0 @@ -#! /usr/bin/env bash - -# Define common shell functions - -# Assign variable one scope above the caller -# Usage: local "$1" && _upvar $1 "value(s)" -# Param: $1 Variable name to assign value to -# Param: $* Value(s) to assign. If multiple values, an array is -# assigned, otherwise a single value is assigned. -# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference -_upvar() { - if unset -v "$1"; then - if (( $# == 2 )); then - eval $1=\"\$2\"; - else - eval $1=\(\"\${@:2}\"\); - fi; - fi -} - -# Run apt update if apt lists aren't populated -apt_get_update() { - if [ "$(find /var/lib/apt/lists -mindepth 1 | head -n1 | wc -l)" = "0" ]; then - echo "Running apt-get update..."; - apt-get update -y; - fi -} - -export -f apt_get_update; - -# Checks if packages are installed and installs them if not -check_packages() { - if ! dpkg -s "$@" > /dev/null 2>&1; then - apt_get_update; - echo "Installing packages: $*"; - DEBIAN_FRONTEND=noninteractive \ - apt-get -y install --no-install-recommends "$@"; - fi -} - -export -f check_packages; - -for_each_user_bashrc() { - # Update all bashrc files - # shellcheck disable=SC2086 - find / /etc /home ${_REMOTE_USER_HOME} ${_CONTAINER_USER_HOME} -maxdepth 2 -type f -name .bashrc \ - | sort | uniq | xargs -r -d'\n' -n1 bash -c "${@}"; -} - -export -f for_each_user_bashrc; - -for_each_user_profile() { - # Update all .profile files - # shellcheck disable=SC2086 - find / /etc /home ${_REMOTE_USER_HOME} ${_CONTAINER_USER_HOME} -maxdepth 2 -type f -name .profile \ - | sort | uniq | xargs -r -d'\n' -n1 bash -c "${@}"; -} - -export -f for_each_user_profile; - -append_to_all_bashrcs() { - # Update all bashrc files - # shellcheck disable=SC2086 - for bashrc in $(find / /etc /home ${_REMOTE_USER_HOME} ${_CONTAINER_USER_HOME} -maxdepth 2 -type f -name .bashrc | sort | uniq); do - if [[ "$(cat "$bashrc")" != *"$1"* ]]; then - echo "Appending to $bashrc..."; - echo -e "$1" >> "$bashrc"; - fi - done -} - -export -f append_to_all_bashrcs; - -prepend_to_all_bashrcs() { - # Update all bashrc files - # shellcheck disable=SC2086 - for bashrc in $(find / /etc /home ${_REMOTE_USER_HOME} ${_CONTAINER_USER_HOME} -maxdepth 2 -type f -name .bashrc | sort | uniq); do - if [[ "$(cat "$bashrc")" != *"$1"* ]]; then - echo "Prepending to $bashrc..."; - echo -e "$1\n$(cat "$bashrc")" > "$bashrc"; - fi - done -} - -export -f prepend_to_all_bashrcs; - -append_to_etc_profile() { - if [[ "$(cat /etc/profile)" != *"$1"* ]]; then - echo "Appending to /etc/profile..."; - echo -e "$1" >> /etc/profile; - fi -} - -export -f append_to_etc_profile; - -prepend_to_etc_profile() { - if [[ "$(cat /etc/profile)" != *"$1"* ]]; then - echo "Prepending to /etc/profile..."; - echo -e "$1\n$(cat /etc/profile)" > /etc/profile; - fi -} - -export -f prepend_to_etc_profile; - -append_to_etc_bashrc() { - if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then - echo "Appending to /etc/bash.bashrc..."; - echo -e "$1" >> /etc/bash.bashrc; - fi -} - -export -f append_to_etc_bashrc; - -prepend_to_etc_bashrc() { - if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then - echo "Prepending to /etc/bash.bashrc..."; - echo -e "$1\n$(cat /etc/bash.bashrc)" > /etc/bash.bashrc; - fi -} - -export -f prepend_to_etc_bashrc; - -append_etc_zshrc() { - if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then - echo "Appending to /etc/zsh/zshrc..."; - echo -e "$1" >> /etc/zsh/zshrc; - fi -} - -export -f append_etc_zshrc; - -prepend_to_etc_zshrc() { - if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then - echo "Prepending to /etc/zsh/zshrc..."; - echo -e "$1\n$(cat /etc/zsh/zshrc)" > /etc/zsh/zshrc; - fi -} - -export -f prepend_to_etc_zshrc; - -add_etc_profile_d_script() { - # shellcheck disable=SC2012 - local name="$(($(ls -1q /etc/profile.d/*.sh | wc -l) + 20))-${1}.sh"; - echo -e "#! /usr/bin/env bash\n${*:2}" > "/etc/profile.d/${name}"; - chmod +x "/etc/profile.d/${name}"; -} - -export -f add_etc_profile_d_script; - -# Determine the appropriate non-root user -find_non_root_user() { - USERNAME="${USERNAME:-"${_REMOTE_USER:-"auto"}"}"; - if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then - USERNAME="" - POSSIBLE_USERS=("vscode" "node" "codespace" "coder" "$(awk -v val=1001 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do - if id -u "${CURRENT_USER}" > /dev/null 2>&1; then - USERNAME=${CURRENT_USER} - break - fi - done - elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" > /dev/null 2>&1; then - USERNAME=root - fi - if [ "${USERNAME}" = "" ]; then - USERNAME=root - fi -} - -export -f find_non_root_user; - -# shellcheck disable=SC1091 -. "$(dirname "$(realpath -m "${BASH_SOURCE[0]}")")/find-version-from-git-tags.sh"; - -find_version_from_git_tags() { - check_packages git; - _find_version_from_git_tags "$@"; -} - -export -f find_version_from_git_tags; - -find_prev_version_from_git_tags() { - _find_prev_version_from_git_tags "$@"; -} - -export -f find_prev_version_from_git_tags; diff --git a/features/src/git/devcontainer-feature.json b/features/src/git/devcontainer-feature.json deleted file mode 100644 index 93ea7b06..00000000 --- a/features/src/git/devcontainer-feature.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "id": "git", - "version": "1.3.6", - "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.", - "options": { - "version": { - "type": "string", - "proposals": [ - "latest", - "system", - "os-provided" - ], - "default": "os-provided", - "description": "Select or enter a Git version." - }, - "ppa": { - "type": "boolean", - "default": true, - "description": "Install from PPA if available (only supported for Ubuntu distributions)" - } - }, - "customizations": { - "vscode": { - "settings": { - "github.copilot.chat.codeGeneration.instructions": [ - { - "text": "This dev container includes an up-to-date version of Git, built from source as needed, pre-installed and available on the `PATH`." - } - ] - } - } - }, - "installsAfter": [ - "ghcr.io/devcontainers/features/common-utils" - ] -} diff --git a/features/src/git/install.sh b/features/src/git/install.sh deleted file mode 100644 index 6fa72887..00000000 --- a/features/src/git/install.sh +++ /dev/null @@ -1,321 +0,0 @@ -#!/usr/bin/env bash -#------------------------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. -#------------------------------------------------------------------------------------------------------------- -# -# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/git-from-src.md -# Maintainer: The VS Code and Codespaces Teams - -# Ensure we're in this feature's directory during build -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; - -# install global/common scripts -. ./common/find-version-from-git-tags.sh; - -GIT_VERSION=${VERSION} # 'system' checks the base image first, else installs 'latest' -USE_PPA_IF_AVAILABLE=${PPA} - -GIT_CORE_PPA_ARCHIVE_GPG_KEY=F911AB184317630C59970973E363C90F8F1B6217 - -if [ "$(id -u)" -ne 0 ]; then - echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' - exit 1 -fi - -# Bring in ID, ID_LIKE, VERSION_ID, VERSION_CODENAME -. /etc/os-release -# Get an adjusted ID independent of distro variants -if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then - ADJUSTED_ID="debian" -elif [ "${ID}" = "alpine" ]; then - ADJUSTED_ID="alpine" -elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then - ADJUSTED_ID="rhel" - VERSION_CODENAME="${ID}${VERSION_ID}" -else - echo "Linux distro ${ID} not supported." - exit 1 -fi - -if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then - # As of 1 July 2024, mirrorlist.centos.org no longer exists. - # Update the repo files to reference vault.centos.org. - sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo - sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo - sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo -fi - -if type apt-get > /dev/null 2>&1; then - INSTALL_CMD=apt-get -elif type apk > /dev/null 2>&1; then - INSTALL_CMD=apk -elif type microdnf > /dev/null 2>&1; then - INSTALL_CMD=microdnf -elif type dnf > /dev/null 2>&1; then - INSTALL_CMD=dnf -elif type yum > /dev/null 2>&1; then - INSTALL_CMD=yum -else - echo "(Error) Unable to find a supported package manager." - exit 1 -fi - -# Clean up -clean_up() { - case $ADJUSTED_ID in - debian) - rm -rf /var/lib/apt/lists/* - ;; - alpine) - rm -rf /var/cache/apk/* - ;; - rhel) - rm -rf /var/cache/dnf/* - rm -rf /var/cache/yum/* - ;; - esac -} -clean_up - -# Get the list of GPG key servers that are reachable -get_gpg_key_servers() { - local curl_args="" - local keyserver_reachable=false # Flag to indicate if any keyserver is reachable - - if [ ! -z "${KEYSERVER_PROXY}" ]; then - curl_args="--proxy ${KEYSERVER_PROXY}" - fi - - test_keyserver() { - local keyserver="$1" - local keyserver_curl_url="$2" - if curl -s ${curl_args} --max-time 5 "${keyserver_curl_url}" > /dev/null; then - echo "keyserver ${keyserver}" - keyserver_reachable=true - else - echo "(*) Keyserver ${keyserver} is not reachable." >&2 - fi - } - - # Explicitly test these in order because Bash v4.4.20 (Ubuntu Bionic) - # enumerates associative array keys in a different order than Bash v5 - test_keyserver "hkp://keyserver.ubuntu.com" "http://keyserver.ubuntu.com:11371" - test_keyserver "hkp://keyserver.ubuntu.com:80" "http://keyserver.ubuntu.com" - test_keyserver "hkp://keyserver.pgp.com" "http://keyserver.pgp.com:11371" - # Test this server last because keys.openpgp.org strips user IDs from keys unless - # the owner gives permission, which causes gpg in Ubuntu Bionic to reject the key - # (https://github.com/devcontainers/features/issues/1055) - test_keyserver "hkps://keys.openpgp.org" "https://keys.openpgp.org" - - if ! $keyserver_reachable; then - echo "(!) No keyserver is reachable." >&2 - exit 1 - fi -} - -# Import the specified key in a variable name passed in as -receive_gpg_keys() { - local -a keys="(${!1})" - mkdir -p "$(dirname "$2")" - - # Install curl - if ! type curl > /dev/null 2>&1; then - check_packages curl - fi - - # Use a temporary location for gpg keys to avoid polluting image - export GNUPGHOME="/tmp/tmp-gnupg" - mkdir -p ${GNUPGHOME} - chmod 700 ${GNUPGHOME} - echo -e "disable-ipv6\n$(get_gpg_key_servers)" > ${GNUPGHOME}/dirmngr.conf - # GPG key download sometimes fails for some reason and retrying fixes it. - local retry_count=0 - local gpg_ok="false" - set +e - until [ "${gpg_ok}" = "true" ] || [ "${retry_count}" -eq "5" ]; - do - for key in "${keys[@]}"; do - echo "(*) Downloading GPG key '${key}'..." - gpg --recv-keys "${key}" \ - && gpg --export "${key}" | gpg --dearmor --yes -o "$2" \ - && gpg_ok="true" - if [ "${gpg_ok}" != "true" ]; then - echo "(*) Failed getting key, retrying in 10s..." - (( retry_count++ )) - sleep 10s - fi - done - done - set -e - if [ "${gpg_ok}" = "false" ]; then - echo "(!) Failed to get gpg key." - exit 1 - fi -} - -pkg_mgr_update() { - if [ ${INSTALL_CMD} = "apt-get" ]; then - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - ${INSTALL_CMD} update -y - fi - elif [ ${INSTALL_CMD} = "apk" ]; then - if [ "$(find /var/cache/apk/* | wc -l)" = "0" ]; then - echo "Running apk update..." - ${INSTALL_CMD} update - fi - elif [ ${INSTALL_CMD} = "dnf" ] || [ ${INSTALL_CMD} = "yum" ]; then - if [ "$(find /var/cache/${INSTALL_CMD}/* | wc -l)" = "0" ]; then - echo "Running ${INSTALL_CMD} check-update ..." - ${INSTALL_CMD} check-update - fi - fi -} - - -# Checks if packages are installed and installs them if not -check_packages() { - if [ ${INSTALL_CMD} = "apt-get" ]; then - if ! dpkg -s "$@" > /dev/null 2>&1; then - pkg_mgr_update - ${INSTALL_CMD} -y install --no-install-recommends "$@" - fi - elif [ ${INSTALL_CMD} = "apk" ]; then - ${INSTALL_CMD} add \ - --no-cache \ - "$@" - elif [ ${INSTALL_CMD} = "dnf" ] || [ ${INSTALL_CMD} = "yum" ]; then - _num_pkgs=$(echo "$@" | tr ' ' \\012 | wc -l) - _num_installed=$(${INSTALL_CMD} -C list installed "$@" | sed '1,/^Installed/d' | wc -l) - if [ ${_num_pkgs} != ${_num_installed} ]; then - pkg_mgr_update - ${INSTALL_CMD} -y install "$@" - fi - elif [ ${INSTALL_CMD} = "microdnf" ]; then - ${INSTALL_CMD} -y install \ - --refresh \ - --best \ - --nodocs \ - --noplugins \ - --setopt=install_weak_deps=0 \ - "$@" - else - echo "Linux distro ${ID} not supported." - exit 1 - fi -} - -export DEBIAN_FRONTEND=noninteractive - -# Debian / Ubuntu packages - -# If the os provided version is "good enough", just install that. -if [ ${GIT_VERSION} = "os-provided" ] || [ ${GIT_VERSION} = "system" ]; then - if type git > /dev/null 2>&1; then - echo "Detected existing system install: $(git version)" - # Clean up - clean_up - exit 0 - fi - - if [ "$INSTALL_CMD" = "apt-get" ]; then - echo "Installing git from OS apt repository" - elif [ "$INSTALL_CMD" = "apk" ]; then - echo "Installing git from OS apk repository" - else - echo "Installing git from OS yum/dnf repository" - fi - if [ $ID = "mariner" ]; then - check_packages ca-certificates - fi - check_packages git - # Clean up - clean_up - exit 0 -fi - -# If ubuntu, PPAs allowed, and latest - install from there -if ([ "${GIT_VERSION}" = "latest" ] || [ "${GIT_VERSION}" = "lts" ] || [ "${GIT_VERSION}" = "current" ]) && [ "${ID}" = "ubuntu" ] && [ "${USE_PPA_IF_AVAILABLE}" = "true" ]; then - echo "Using PPA to install latest git..." - check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr - receive_gpg_keys GIT_CORE_PPA_ARCHIVE_GPG_KEY /usr/share/keyrings/gitcoreppa-archive-keyring.gpg - cat < /etc/apt/sources.list.d/git-core-ppa.list -deb [arch=$(uname -m | sed -e 's/x86_/amd/' -e 's/aarch/arm/') signed-by=/usr/share/keyrings/gitcoreppa-archive-keyring.gpg] http://ppa.launchpad.net/git-core/ppa/ubuntu ${VERSION_CODENAME} main -deb-src [arch=$(uname -m | sed -e 's/x86_/amd/' -e 's/aarch/arm/') signed-by=/usr/share/keyrings/gitcoreppa-archive-keyring.gpg] http://ppa.launchpad.net/git-core/ppa/ubuntu ${VERSION_CODENAME} main -EOF - ${INSTALL_CMD} update - ${INSTALL_CMD} -y install --no-install-recommends git - rm -rf "/tmp/tmp-gnupg" - rm -rf /var/lib/apt/lists/* - exit 0 -fi - -# Install required packages to build if missing -if [ "${ADJUSTED_ID}" = "debian" ]; then - - check_packages build-essential curl ca-certificates tar gettext libssl-dev zlib1g-dev libcurl?-openssl-dev libexpat1-dev - - check_packages libpcre2-dev - - if [ "${VERSION_CODENAME}" = "focal" ] || [ "${VERSION_CODENAME}" = "bullseye" ]; then - check_packages libpcre2-posix2 - elif [ "${VERSION_CODENAME}" = "bionic" ] || [ "${VERSION_CODENAME}" = "buster" ]; then - check_packages libpcre2-posix0 - else - check_packages libpcre2-posix3 - fi - -elif [ "${ADJUSTED_ID}" = "alpine" ]; then - - # update build dependencies - ${INSTALL_CMD} add --no-cache --update curl grep make zlib-dev - - # ref. - check_packages asciidoc curl-dev expat-dev g++ gcc openssl-dev pcre2-dev perl-dev perl-error python3-dev tcl tk xmlto - -elif [ "${ADJUSTED_ID}" = "rhel" ]; then - check_packages gcc libcurl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel cmake pcre2-devel tar gzip ca-certificates - if ! type curl > /dev/null 2>&1; then - check_packages curl - fi - if ! type cmp > /dev/null 2>&1; then - check_packages diffutils - fi - if ! type awk > /dev/null 2>&1; then - check_packages gawk - fi - if [ $ID = "mariner" ]; then - check_packages glibc-devel kernel-headers binutils - fi - -else - echo "Linux distro ${ID} not supported." - exit 1 -fi - -# Partial version matching -if [ "$(echo "${GIT_VERSION}" | grep -o '\.' | wc -l)" != "2" ]; then - check_packages git - _find_version_from_git_tags GIT_VERSION https://github.com/git/git; -fi - -echo "Downloading source for ${GIT_VERSION}..." -curl -sL https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz | tar -xzC /tmp 2>&1 -echo "Building..." -cd /tmp/git-${GIT_VERSION} -git_options=("prefix=/usr/local") -git_options+=("sysconfdir=/etc") -if ! command -V cargo >/dev/null 2>&1; then - git_options+=("NO_RUST=YesPlease") -fi -git_options+=("USE_LIBPCRE=YesPlease") -if [ "${ADJUSTED_ID}" = "alpine" ]; then - # ref. - git_options+=("NO_REGEX=YesPlease") - git_options+=("NO_GETTEXT=YesPlease") -fi -make -s "${git_options[@]}" all && make -s "${git_options[@]}" install 2>&1 -rm -rf /tmp/git-${GIT_VERSION} -clean_up -echo "Done!" diff --git a/features/test/git/install_git_from_ppa_bionic.sh b/features/test/git/install_git_from_ppa_bionic.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_ppa_bionic.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_ppa_jammy.sh b/features/test/git/install_git_from_ppa_jammy.sh deleted file mode 100644 index 45e4a20b..00000000 --- a/features/test/git/install_git_from_ppa_jammy.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults - diff --git a/features/test/git/install_git_from_ppa_noble.sh b/features/test/git/install_git_from_ppa_noble.sh deleted file mode 100644 index 45e4a20b..00000000 --- a/features/test/git/install_git_from_ppa_noble.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults - diff --git a/features/test/git/install_git_from_ppa_resolute.sh b/features/test/git/install_git_from_ppa_resolute.sh deleted file mode 100644 index 45e4a20b..00000000 --- a/features/test/git/install_git_from_ppa_resolute.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults - diff --git a/features/test/git/install_git_from_src.sh b/features/test/git/install_git_from_src.sh deleted file mode 100644 index d0ebaa28..00000000 --- a/features/test/git/install_git_from_src.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version -check "gettext" dpkg-query -l gettext - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -check "git-location" bash -c "which git | grep /usr/local/bin/git" - -check "set-git-config-user-name" bash -c "git config --system user.name devcontainers" -check "gitconfig-file-location" bash -c "ls /etc/gitconfig" -check "gitconfig-contains-name" bash -c "cat /etc/gitconfig | grep 'name = devcontainers'" - -check "usr-local-etc-config-does-not-exist" test ! -f "/usr/local/etc/gitconfig" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_alma-8.sh b/features/test/git/install_git_from_src_alma-8.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_src_alma-8.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_alma-9.sh b/features/test/git/install_git_from_src_alma-9.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_src_alma-9.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_alpine.sh b/features/test/git/install_git_from_src_alpine.sh deleted file mode 100644 index 2a26beec..00000000 --- a/features/test/git/install_git_from_src_alpine.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_bionic.sh b/features/test/git/install_git_from_src_bionic.sh deleted file mode 100644 index 6a1f639c..00000000 --- a/features/test/git/install_git_from_src_bionic.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version -check "gettext" dpkg-query -l gettext - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_bullseye.sh b/features/test/git/install_git_from_src_bullseye.sh deleted file mode 100644 index 6a1f639c..00000000 --- a/features/test/git/install_git_from_src_bullseye.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version -check "gettext" dpkg-query -l gettext - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_buster.sh b/features/test/git/install_git_from_src_buster.sh deleted file mode 100644 index 6a1f639c..00000000 --- a/features/test/git/install_git_from_src_buster.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version -check "gettext" dpkg-query -l gettext - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_centos-7.sh b/features/test/git/install_git_from_src_centos-7.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_src_centos-7.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_fedora.sh b/features/test/git/install_git_from_src_fedora.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_src_fedora.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_jammy.sh b/features/test/git/install_git_from_src_jammy.sh deleted file mode 100644 index 6a1f639c..00000000 --- a/features/test/git/install_git_from_src_jammy.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version -check "gettext" dpkg-query -l gettext - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_mariner.sh b/features/test/git/install_git_from_src_mariner.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_src_mariner.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_noble.sh b/features/test/git/install_git_from_src_noble.sh deleted file mode 100644 index 337226fd..00000000 --- a/features/test/git/install_git_from_src_noble.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version -check "gettext" dpkg-query -l gettext - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults - diff --git a/features/test/git/install_git_from_src_resolute.sh b/features/test/git/install_git_from_src_resolute.sh deleted file mode 100644 index 6a1f639c..00000000 --- a/features/test/git/install_git_from_src_resolute.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version -check "gettext" dpkg-query -l gettext - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_rocky-8.sh b/features/test/git/install_git_from_src_rocky-8.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_src_rocky-8.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_src_rocky-9.sh b/features/test/git/install_git_from_src_rocky-9.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_src_rocky-9.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_alma-8.sh b/features/test/git/install_git_from_system_alma-8.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_system_alma-8.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_alma-9.sh b/features/test/git/install_git_from_system_alma-9.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_system_alma-9.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_alpine.sh b/features/test/git/install_git_from_system_alpine.sh deleted file mode 100644 index 972976a4..00000000 --- a/features/test/git/install_git_from_system_alpine.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_centos-7.sh b/features/test/git/install_git_from_system_centos-7.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_system_centos-7.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_fedora.sh b/features/test/git/install_git_from_system_fedora.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_system_fedora.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_mariner.sh b/features/test/git/install_git_from_system_mariner.sh deleted file mode 100644 index 2114dfdf..00000000 --- a/features/test/git/install_git_from_system_mariner.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -# Ensure git clone works, i.e. ca-certificates are installed. -check "git clone" bash -c "cd /tmp && git clone https://github.com/devcontainers/feature-starter.git" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_rocky-8.sh b/features/test/git/install_git_from_system_rocky-8.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_system_rocky-8.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/install_git_from_system_rocky-9.sh b/features/test/git/install_git_from_system_rocky-9.sh deleted file mode 100644 index 84800b54..00000000 --- a/features/test/git/install_git_from_system_rocky-9.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -# Definition specific tests -check "version" git --version - -cd /tmp && git clone https://github.com/devcontainers/feature-starter.git -cd feature-starter -check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'" - -# Report result -reportResults diff --git a/features/test/git/scenarios.json b/features/test/git/scenarios.json deleted file mode 100644 index 7db7f687..00000000 --- a/features/test/git/scenarios.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "install_git_from_src": { - "image": "ubuntu:noble", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_alpine": { - "image": "mcr.microsoft.com/devcontainers/base:alpine", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_jammy": { - "image": "ubuntu:jammy", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_ppa_jammy": { - "image": "ubuntu:jammy", - "features": { - "git": { - "version": "latest", - "ppa": "true" - } - } - }, - "install_git_from_src_noble": { - "image": "ubuntu:noble", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_ppa_noble": { - "image": "ubuntu:noble", - "features": { - "git": { - "version": "latest", - "ppa": "true" - } - } - }, - "install_git_from_src_resolute": { - "image": "ubuntu:resolute", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_ppa_resolute": { - "image": "ubuntu:resolute", - "features": { - "git": { - "version": "latest", - "ppa": "true" - } - } - }, - "install_git_from_src_bullseye": { - "image": "debian:bullseye", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_centos-7": { - "image": "centos:centos7", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_alma-8": { - "image": "almalinux:8", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_alma-9": { - "image": "almalinux:9", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_rocky-8": { - "image": "rockylinux:8", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_rocky-9": { - "image": "rockylinux:9", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_fedora": { - "image": "fedora", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_src_mariner": { - "image": "mcr.microsoft.com/cbl-mariner/base/core:2.0", - "features": { - "git": { - "version": "latest", - "ppa": "false" - } - } - }, - "install_git_from_system_alpine": { - "image": "mcr.microsoft.com/devcontainers/base:alpine", - "features": { - "git": { - "version": "system", - "ppa": "false" - } - } - }, - "install_git_from_system_centos-7": { - "image": "centos:centos7", - "features": { - "git": { - "version": "system", - "ppa": "true" - } - } - }, - "install_git_from_system_alma-8": { - "image": "almalinux:8", - "features": { - "git": { - "version": "system", - "ppa": "true" - } - } - }, - "install_git_from_system_alma-9": { - "image": "almalinux:9", - "features": { - "git": { - "version": "system", - "ppa": "true" - } - } - }, - "install_git_from_system_rocky-8": { - "image": "rockylinux:8", - "features": { - "git": { - "version": "system", - "ppa": "true" - } - } - }, - "install_git_from_system_rocky-9": { - "image": "rockylinux:9", - "features": { - "git": { - "version": "system", - "ppa": "true" - } - } - }, - "install_git_from_system_fedora": { - "image": "fedora", - "features": { - "git": { - "version": "system", - "ppa": "true" - } - } - }, - "install_git_from_system_mariner": { - "image": "mcr.microsoft.com/cbl-mariner/base/core:2.0", - "features": { - "git": { - "version": "system", - "ppa": "true" - } - } - } -} diff --git a/features/test/git/test.sh b/features/test/git/test.sh deleted file mode 100644 index ce1552ef..00000000 --- a/features/test/git/test.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 "version" git --version - -# Report result -reportResults diff --git a/image/.devcontainer/devcontainer.json b/image/.devcontainer/devcontainer.json index c7189630..903660e9 100644 --- a/image/.devcontainer/devcontainer.json +++ b/image/.devcontainer/devcontainer.json @@ -22,7 +22,7 @@ "installZsh": "true", "upgradePackages": "true" }, - "./features/src/git": { + "ghcr.io/devcontainers/features/git:1": { "ppa": "true", "version": "latest" }, @@ -42,7 +42,7 @@ }, "overrideFeatureInstallOrder": [ "ghcr.io/devcontainers/features/common-utils", - "./features/src/git", + "ghcr.io/devcontainers/features/git", "ghcr.io/devcontainers/features/git-lfs", "ghcr.io/devcontainers/features/github-cli", "./features/src/gitlab-cli",