Skip to content

Commit

Permalink
Merge branch 'devcontainers:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
openscript authored Jan 29, 2024
2 parents b9cecab + 3e0c0ae commit 46be477
Show file tree
Hide file tree
Showing 35 changed files with 328 additions and 52 deletions.
4 changes: 2 additions & 2 deletions src/common-utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "common-utils",
"version": "2.3.1",
"version": "2.4.1",
"name": "Common Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
Expand Down Expand Up @@ -66,4 +66,4 @@
"description": "Add packages from non-free Debian repository? (Debian only)"
}
}
}
}
19 changes: 15 additions & 4 deletions src/common-utils/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ install_debian_packages() {
ca-certificates \
unzip \
bzip2 \
xz-utils \
zip \
nano \
vim-tiny \
Expand Down Expand Up @@ -154,9 +155,12 @@ install_debian_packages() {
install_redhat_packages() {
local package_list=""
local remove_epel="false"
local install_cmd=dnf
if ! type dnf > /dev/null 2>&1; then
install_cmd=yum
local install_cmd=microdnf
if ! type microdnf > /dev/null 2>&1; then
install_cmd=dnf
if ! type dnf > /dev/null 2>&1; then
install_cmd=yum
fi
fi

if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
Expand All @@ -173,6 +177,7 @@ install_redhat_packages() {
ca-certificates \
rsync \
unzip \
xz \
zip \
nano \
vim-minimal \
Expand Down Expand Up @@ -256,6 +261,7 @@ install_alpine_packages() {
rsync \
ca-certificates \
unzip \
xz \
zip \
nano \
vim \
Expand All @@ -265,7 +271,6 @@ install_alpine_packages() {
libstdc++ \
krb5-libs \
libintl \
libssl1.1 \
lttng-ust \
tzdata \
userspace-rcu \
Expand All @@ -279,6 +284,12 @@ install_alpine_packages() {
shadow \
strace

# # Include libssl1.1 if available (not available for 3.19 and newer)
LIBSSL1_PKG=libssl1.1
if [[ $(apk search --no-cache -a $LIBSSL1_PKG | grep $LIBSSL1_PKG) ]]; then
apk add --no-cache $LIBSSL1_PKG
fi

# Install man pages - package name varies between 3.12 and earlier versions
if apk info man > /dev/null 2>&1; then
apk add --no-cache man man-pages
Expand Down
2 changes: 1 addition & 1 deletion src/docker-outside-of-docker/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "docker-outside-of-docker",
"version": "1.3.1",
"version": "1.3.2",
"name": "Docker (docker-outside-of-docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker",
"description": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.",
Expand Down
2 changes: 1 addition & 1 deletion src/docker-outside-of-docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "true" ] && [ "${SOURCE_SOCKET}" != "${TARGET_
log "Enabling socket proxy."
log "Proxying ${SOURCE_SOCKET} to ${TARGET_SOCKET} for vscode"
sudoIf rm -rf ${TARGET_SOCKET}
(sudoIf socat UNIX-LISTEN:${TARGET_SOCKET},fork,mode=660,user=${USERNAME} UNIX-CONNECT:${SOURCE_SOCKET} 2>&1 | sudoIf tee -a \${SOCAT_LOG} > /dev/null & echo "\$!" | sudoIf tee \${SOCAT_PID} > /dev/null)
(sudoIf socat UNIX-LISTEN:${TARGET_SOCKET},fork,mode=660,user=${USERNAME},backlog=128 UNIX-CONNECT:${SOURCE_SOCKET} 2>&1 | sudoIf tee -a \${SOCAT_LOG} > /dev/null & echo "\$!" | sudoIf tee \${SOCAT_PID} > /dev/null)
else
log "Socket proxy already running."
fi
Expand Down
2 changes: 1 addition & 1 deletion src/dotnet/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "dotnet",
"version": "2.0.2",
"version": "2.0.3",
"name": "Dotnet CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
"description": "This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.",
Expand Down
6 changes: 5 additions & 1 deletion src/dotnet/scripts/vendor/dotnet-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,11 @@ do
-?|--?|-h|--help|-[Hh]elp)
script_name="$(basename "$0")"
echo ".NET Tools Installer"
echo "Usage: $script_name [-c|--channel <CHANNEL>] [-v|--version <VERSION>] [-p|--prefix <DESTINATION>]"
echo "Usage:"
echo " # Install a .NET SDK of a given Quality from a given Channel"
echo " $script_name [-c|--channel <CHANNEL>] [-q|--quality <QUALITY>]"
echo " # Install a .NET SDK of a specific public version"
echo " $script_name [-v|--version <VERSION>]"
echo " $script_name -h|-?|--help"
echo ""
echo "$script_name is a simple command line interface for obtaining dotnet cli."
Expand Down
2 changes: 2 additions & 0 deletions src/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Installs Java, SDKMAN! (if not installed), and needed dependencies.
| mavenVersion | Select or enter a Maven version | string | latest |
| installAnt | Install Ant, a software tool for automating software build processes | boolean | false |
| antVersion | Select or enter an Ant version | string | latest |
| installGroovy | Install Groovy, powerful, optionally typed and dynamic language with static-typing and static compilation capabilities | boolean | false |
| groovyVersion | Select or enter a Groovy version | string | latest |

## Customizations

Expand Down
23 changes: 20 additions & 3 deletions src/java/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "java",
"version": "1.2.2",
"version": "1.3.0",
"name": "Java (via SDKMAN!)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/java",
"description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.",
Expand All @@ -23,7 +23,8 @@
"ms",
"open",
"oracle",
"tem"
"tem",
"amzn"
],
"default": "ms",
"description": "Select or enter a JDK distribution"
Expand Down Expand Up @@ -74,6 +75,22 @@
],
"default": "latest",
"description": "Select or enter an Ant version"
},
"installGroovy": {
"type": "boolean",
"default": false,
"description": "Install Groovy, powerful, optionally typed and dynamic language with static-typing and static compilation capabilities"
},
"groovyVersion": {
"type": "string",
"proposals": [
"latest",
"2.5.22",
"3.0.19",
"4.0.16"
],
"default": "latest",
"description": "Select or enter a Groovy version"
}
},
"customizations": {
Expand All @@ -92,6 +109,6 @@
"PATH": "/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:/usr/local/sdkman/candidates/ant/current/bin:${PATH}"
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
"ghcr.io/devcontainers/features/common-utils"
]
}
7 changes: 7 additions & 0 deletions src/java/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ INSTALL_MAVEN="${INSTALLMAVEN:-"false"}"
MAVEN_VERSION="${MAVENVERSION:-"latest"}"
INSTALL_ANT="${INSTALLANT:-"false"}"
ANT_VERSION="${ANTVERSION:-"latest"}"
INSTALL_GROOVY="${INSTALLGROOVY:-"false"}"
GROOVY_VERSION="${GROOVYVERSION:-"latest"}"
JDK_DISTRO="${JDKDISTRO}"

export SDKMAN_DIR="${SDKMAN_DIR:-"/usr/local/sdkman"}"
Expand Down Expand Up @@ -190,6 +192,11 @@ if [[ "${INSTALL_MAVEN}" = "true" ]] && ! mvn --version > /dev/null; then
sdk_install maven ${MAVEN_VERSION}
fi

# Install Groovy
if [[ "${INSTALL_GROOVY}" = "true" ]] && ! groovy --version > /dev/null; then
sdk_install groovy "${GROOVY_VERSION}"
fi

# Clean up
rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion src/kubectl-helm-minikube/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "kubectl-helm-minikube",
"version": "1.1.5",
"version": "1.1.6",
"name": "Kubectl, Helm, and Minikube",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube",
"description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.",
Expand Down
2 changes: 1 addition & 1 deletion src/kubectl-helm-minikube/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ if [ ${KUBECTL_VERSION} != "none" ]; then
kubectl completion bash > /etc/bash_completion.d/kubectl

# kubectl zsh completion
if [ -e "${USERHOME}}/.oh-my-zsh" ]; then
if [ -e "${USERHOME}/.oh-my-zsh" ]; then
mkdir -p "${USERHOME}/.oh-my-zsh/completions"
kubectl completion zsh > "${USERHOME}/.oh-my-zsh/completions/_kubectl"
chown -R "${USERNAME}" "${USERHOME}/.oh-my-zsh"
Expand Down
1 change: 1 addition & 0 deletions src/nix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Installs the Nix package manager and optionally a set of packages.
| version | Version of Nix to install. | string | latest |
| multiUser | Perform a multi-user install (instead of single user) | boolean | true |
| packages | Optional comma separated list of Nix packages to install in profile. | string | - |
| useAttributePath | Enable this option to use exact attribute path of the package in the Nixpkgs repository, aligning with the nix-env -iA command. | boolean | false |
| flakeUri | Optional URI to a Nix Flake to install in profile. | string | - |
| extraNixConfig | Optional comma separated list of extra lines to add to /etc/nix/nix.conf. | string | - |

Expand Down
11 changes: 8 additions & 3 deletions src/nix/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "nix",
"version": "1.1.3",
"version": "1.2.0",
"name": "Nix Package Manager",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/nix",
"description": "Installs the Nix package manager and optionally a set of packages.",
"description": "Installs the Nix package manager and optionally a set of packages.",
"options": {
"version": {
"type": "string",
Expand All @@ -21,6 +21,11 @@
"default": "",
"description": "Optional comma separated list of Nix packages to install in profile."
},
"useAttributePath": {
"type": "boolean",
"default": false,
"description": "Enable this option to use exact attribute path of the package in the Nixpkgs repository, aligning with the nix-env -iA command."
},
"flakeUri": {
"type": "string",
"default": "",
Expand All @@ -39,4 +44,4 @@
"PATH": "/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:${PATH}"
},
"entrypoint": "/usr/local/share/nix-entrypoint.sh"
}
}
9 changes: 5 additions & 4 deletions src/nix/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cd "${FEATURE_DIR}"
VERSION="${VERSION:-"latest"}"
MULTIUSER="${MULTIUSER:-"true"}"
PACKAGES="${PACKAGES//,/ }"
USEATTRIBUTEPATH="${USEATTRIBUTEPATH:-"false"}"
FLAKEURI="${FLAKEURI:-""}"
EXTRANIXCONFIG="${EXTRANIXCONFIG:-""}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
Expand Down Expand Up @@ -68,7 +69,7 @@ else
exit 1
fi
echo "(*) Performing single-user install..."
echo -e "\n**NOTE: Nix will only work for user ${USERNAME} on Linux if the host machine user's UID is $(id -u ${USERNAME}). You will need to chown /nix otherwise.**\n"
echo -e "\n**NOTE: Nix will only work for user ${USERNAME} on Linux if the host machine user's UID is $(id -u ${USERNAME}). You will need to chown /nix otherwise.**\n"
# Install per https://nixos.org/manual/nix/stable/installation/installing-binary.html#single-user-installation
mkdir -p /nix
chown ${USERNAME} /nix ${tmpdir}
Expand All @@ -79,14 +80,14 @@ else
'
update_rc_file "$home_dir/.bashrc" "${snippet}"
update_rc_file "$home_dir/.zshenv" "${snippet}"
update_rc_file "$home_dir/.profile" "${snippet}"
update_rc_file "$home_dir/.profile" "${snippet}"
fi
rm -rf "${tmpdir}" "/tmp/tmp-gnupg"
fi

# Set nix config
mkdir -p /etc/nix
create_or_update_file /etc/nix/nix.conf 'sandbox = false'
create_or_update_file /etc/nix/nix.conf 'sandbox = false'
if [ ! -z "${FLAKEURI}" ] && [ "${FLAKEURI}" != "none" ]; then
create_or_update_file /etc/nix/nix.conf 'experimental-features = nix-command flakes'
fi
Expand Down Expand Up @@ -127,4 +128,4 @@ else
"
fi

echo "Done!"
echo "Done!"
19 changes: 19 additions & 0 deletions src/nix/post-install-steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,29 @@
set -e
echo "(*) Executing post-installation steps..."

# if not starts with "nixpkgs." add it as prefix to package name
add_nixpkgs_prefix() {
local packages=$1
local -a addr
IFS=' ' read -ra addr <<<"$packages"
for i in "${!addr[@]}"; do
if [[ ${addr[i]} != nixpkgs.* ]]; then
addr[i]="nixpkgs.${addr[i]}"
fi
done
IFS=' ' echo "${addr[*]}"
}

# Install list of packages in profile if specified.
if [ ! -z "${PACKAGES}" ] && [ "${PACKAGES}" != "none" ]; then
if [ "${USEATTRIBUTEPATH}" = "true" ]; then
PACKAGES=$(add_nixpkgs_prefix "$PACKAGES")
echo "Installing packages \"${PACKAGES}\" in profile..."
nix-env -iA ${PACKAGES}
else
echo "Installing packages \"${PACKAGES}\" in profile..."
nix-env --install ${PACKAGES}
fi
fi

# Install Nix flake in profile if specified
Expand Down
16 changes: 16 additions & 0 deletions test/common-utils/alma-8-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

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

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el8"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/alma-8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

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

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el8"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/alma-9-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

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

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el9"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/alma-9.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

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

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el9"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
Loading

0 comments on commit 46be477

Please sign in to comment.