diff options
author | Josh Spicer <joshspicer@github.com> | 2022-06-03 17:46:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 17:46:25 +0300 |
commit | c12a205ab8e195541acfe0cb654b4888e16ea05c (patch) | |
tree | a1a45ac7dec9f31fa62972a65414b6d6fd1fd60d | |
parent | 283b8e1f8f5dec9e54199c107e772ce56683769e (diff) |
Pass options via environment variables (#39)
* up to docker-in-docker converted
* first pass at the rest of the features (and bash linting and updated CLI
* move shell linter to own file
* rename feature.json -> devcontainer-feature.json
* continue on error
* continue on error in right spot
* formatting
* fix AZ_VERSION
* update python
* restore variable name
* update linter actions, fix dind/dfd/desktop scripts, add test-scenaerios
* add tree because I like tree
* glob for shell linter
* fix test-scenarios
* shell linter
* more shell helper
60 files changed, 445 insertions, 314 deletions
diff --git a/.github/workflows/linter-automated.yaml b/.github/workflows/linter-automated.yaml new file mode 100644 index 0000000..7ff4015 --- /dev/null +++ b/.github/workflows/linter-automated.yaml @@ -0,0 +1,18 @@ +name: "Shell script linter" +on: + push: + branches: + - main + pull_request: + +jobs: + shellchecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Shell Linter + uses: azohra/shell-linter@v0.6.0 + with: + path: "src/**/*.sh" + severity: "error" # [style, info, warning, error]
\ No newline at end of file diff --git a/.github/workflows/linter-manual.yaml b/.github/workflows/linter-manual.yaml new file mode 100644 index 0000000..79d88d0 --- /dev/null +++ b/.github/workflows/linter-manual.yaml @@ -0,0 +1,24 @@ +name: "Shell script linter (manual)" +on: + workflow_dispatch: + inputs: + path: + description: "Path to the shell scripts to lint" + required: true + default: "src/**/*.sh" + severity: + description: "Minimum Severity (style, info, warning, error)" + required: true + default: "style" + +jobs: + shellchecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Shell Linter + uses: azohra/shell-linter@v0.6.0 + with: + path: ${{ github.event.inputs.path }} + severity: ${{ github.event.inputs.severity }}
\ No newline at end of file diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml index cafee9c..cb55100 100644 --- a/.github/workflows/test-pr.yaml +++ b/.github/workflows/test-pr.yaml @@ -1,5 +1,5 @@ name: "Test updated features (PR)" -on: +on: pull_request: jobs: @@ -8,44 +8,52 @@ jobs: outputs: features: ${{ steps.filter.outputs.changes }} steps: - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - anaconda: ./**/anaconda/** - aws-cli: ./**/aws-cli/** - azure-cli: ./**/azure-cli/** - common: ./**/common/** - desktop-lite: ./**/desktop-lite/** - docker-from-docker: ./**/docker-from-docker/** - docker-in-docker: ./**/docker-in-docker/** - dotnet: ./**/dotnet/** - git: ./**/git/** - git-lfs: ./**/git-lfs/** - github-cli: ./**/github-cli/** - go: ./**/go/** - hugo: ./**/hugo/** - java: ./**/java/** - 'python jupyterlab': ./**/jupyterlab/** - kubectl-helm-minikube: ./**/kubectl-helm-minikube/** - node: ./**/node/** - oryx: ./**/oryx/** - php: ./**/php/** - powershell: ./**/powershell/** - python: ./**/python/** - ruby: ./**/ruby/** - rust: ./**/rust/** - sshd: ./**/sshd/** - terraform: ./**/terraform/** + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + anaconda: ./**/anaconda/** + aws-cli: ./**/aws-cli/** + azure-cli: ./**/azure-cli/** + common: ./**/common/** + desktop-lite: ./**/desktop-lite/** + docker-from-docker: ./**/docker-from-docker/** + docker-in-docker: ./**/docker-in-docker/** + dotnet: ./**/dotnet/** + git: ./**/git/** + git-lfs: ./**/git-lfs/** + github-cli: ./**/github-cli/** + go: ./**/go/** + hugo: ./**/hugo/** + java: ./**/java/** + 'python jupyterlab': ./**/jupyterlab/** + kubectl-helm-minikube: ./**/kubectl-helm-minikube/** + node: ./**/node/** + oryx: ./**/oryx/** + php: ./**/php/** + powershell: ./**/powershell/** + python: ./**/python/** + ruby: ./**/ruby/** + rust: ./**/rust/** + sshd: ./**/sshd/** + terraform: ./**/terraform/** - test: + test: needs: detect-changes runs-on: ubuntu-latest + continue-on-error: true strategy: matrix: features: ${{ fromJSON(needs.detect-changes.outputs.features) }} - baseImage: [ "ubuntu:focal", "ubuntu:jammy", "debian:11", "mcr.microsoft.com/vscode/devcontainers/base:ubuntu", "mcr.microsoft.com/vscode/devcontainers/base:debian" ] + baseImage: + [ + "ubuntu:focal", + "ubuntu:jammy", + "debian:11", + "mcr.microsoft.com/vscode/devcontainers/base:ubuntu", + "mcr.microsoft.com/vscode/devcontainers/base:debian", + ] steps: - uses: actions/checkout@v2 - name: " Testing '${{ matrix.features }}' against '${{ matrix.baseImage }}'" - run: npx --yes ./devcontainers-cli-0.3.0.tgz features test -f ${{ matrix.features }} -i ${{ matrix.baseImage }} -c `pwd`
\ No newline at end of file + run: npx --yes ./devcontainers-cli-0.3.0.tgz features test -f ${{ matrix.features }} -i ${{ matrix.baseImage }} -c `pwd` diff --git a/.github/workflows/test-scenarios.yaml b/.github/workflows/test-scenarios.yaml new file mode 100644 index 0000000..5393449 --- /dev/null +++ b/.github/workflows/test-scenarios.yaml @@ -0,0 +1,15 @@ +name: "Test Scenarios" +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + scenarios: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: " Running predefined test scenarios" + run: npx --yes ./devcontainers-cli-0.3.0.tgz features test --scenarios `pwd`/test-scenarios -c `pwd` diff --git a/devcontainers-cli-0.3.0.tgz b/devcontainers-cli-0.3.0.tgz Binary files differindex 941c6bc..34b595b 100644 --- a/devcontainers-cli-0.3.0.tgz +++ b/devcontainers-cli-0.3.0.tgz diff --git a/lib/utils.sh b/lib/utils.sh index 61dc20c..0e33585 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -4,7 +4,7 @@ detect_user() { local possible_users=${2:-("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")} if [ "${!user_variable_name}" = "auto" ] || [ "${!user_variable_name}" = "automatic" ]; then declare -g ${user_variable_name}="" - for current_user in ${possible_users[@]}; do + for current_user in "${POSSIBLE_USERS[@]}"; do if id -u "${current_user}" > /dev/null 2>&1; then declare -g ${user_variable_name}="${current_user}" break diff --git a/src/anaconda/feature.json b/src/anaconda/devcontainer-feature.json index f733b63..f733b63 100644 --- a/src/anaconda/feature.json +++ b/src/anaconda/devcontainer-feature.json diff --git a/src/anaconda/install.sh b/src/anaconda/install.sh index f7dfd0b..272ba73 100644 --- a/src/anaconda/install.sh +++ b/src/anaconda/install.sh @@ -6,13 +6,12 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/anaconda.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./anaconda-debian.sh [Conda version] [Non-root user] [Add rc files flag] -VERSION=${1:-"latest"} -USERNAME=${2:-"automatic"} -UPDATE_RC=${3:-"true"} +VERSION=${VERSION:-"latest"} + +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} CONDA_DIR=${CONDA_DIR:-"/usr/local/conda"} set -eux @@ -32,7 +31,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/aws-cli/feature.json b/src/aws-cli/devcontainer-feature.json index ee1df10..ee1df10 100644 --- a/src/aws-cli/feature.json +++ b/src/aws-cli/devcontainer-feature.json diff --git a/src/aws-cli/install.sh b/src/aws-cli/install.sh index 0d204de..b2566c9 100755 --- a/src/aws-cli/install.sh +++ b/src/aws-cli/install.sh @@ -6,12 +6,11 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/awscli.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./awscli-debian.sh [AWS CLI version] set -e -AWSCLI_VERSION=${1:-"latest"} +VERSION=${VERSION:-"latest"} + AWSCLI_GPG_KEY=FB5DB77FD5C118B80511ADA8A6310ACC4672475C AWSCLI_GPG_KEY_MATERIAL="-----BEGIN PGP PUBLIC KEY BLOCK----- @@ -108,8 +107,8 @@ install() { local scriptSigFile=awscli.sig # See Linux install docs at https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html - if [ "${AWSCLI_VERSION}" != "latest" ]; then - local versionStr=-${AWSCLI_VERSION} + if [ "${VERSION}" != "latest" ]; then + local versionStr=-${VERSION} fi architecture=$(dpkg --print-architecture) case "${architecture}" in diff --git a/src/azure-cli/feature.json b/src/azure-cli/devcontainer-feature.json index 6ae3769..6ae3769 100644 --- a/src/azure-cli/feature.json +++ b/src/azure-cli/devcontainer-feature.json diff --git a/src/azure-cli/install.sh b/src/azure-cli/install.sh index a7f2a84..d5a586f 100644 --- a/src/azure-cli/install.sh +++ b/src/azure-cli/install.sh @@ -6,12 +6,11 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/azcli.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./azcli-debian.sh set -e -AZ_VERSION=${1:-"latest"} +AZ_VERSION=${VERSION:-"latest"} + MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" AZCLI_ARCHIVE_ARCHITECTURES="amd64" AZCLI_ARCHIVE_VERSION_CODENAMES="stretch buster bullseye bionic focal" diff --git a/src/common/feature.json b/src/common/devcontainer-feature.json index d6b94f2..318d0cf 100644 --- a/src/common/feature.json +++ b/src/common/devcontainer-feature.json @@ -3,42 +3,53 @@ "name": "common", "description": "common", "options": { - "installZsh": { + "install_Zsh": { "type": "boolean", "default": true, "description": "Install ZSH?" }, - "installOhMyZsh": { + "install_Oh_My_Zsh": { "type": "boolean", "default": true, "description": "Install Oh My Zsh!?" }, - "upgradePackages": { - "type":"boolean", + "upgrade_packages": { + "type": "boolean", "default": true, "description": "Upgrade OS packages?" }, "username": { - "type":"string", - "proposals": ["vscode", "codespace", "none", "automatic"], + "type": "string", + "proposals": [ + "vscode", + "codespace", + "none", + "automatic" + ], "default": "automatic", "description": "Enter name of non-root user to configure or none to skip" }, - "uid": { - "type":"string", - "proposals": ["1000", "automatic"], + "user_uid": { + "type": "string", + "proposals": [ + "1000", + "automatic" + ], "default": "automatic", "description": "Enter uid for non-root user" }, - "gid": { + "user_gid": { "type": "string", - "proposals": ["1000", "automatic"], + "proposals": [ + "1000", + "automatic" + ], "default": "automatic", "description": "Enter gid for non-root user" }, - "nonFreePackages": { - "type":"boolean", - "default": true, + "add_non_free_packages": { + "type": "boolean", + "default": false, "description": "Add packages from non-free Debian repository?" } }, diff --git a/src/common/install.sh b/src/common/install.sh index 77c64db..ab8adb0 100644 --- a/src/common/install.sh +++ b/src/common/install.sh @@ -6,18 +6,17 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/common.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./common-debian.sh [install zsh flag] [username] [user UID] [user GID] [upgrade packages flag] [install Oh My Zsh! flag] [Add non-free packages] set -e -INSTALL_ZSH=${1:-"true"} -USERNAME=${2:-"automatic"} -USER_UID=${3:-"automatic"} -USER_GID=${4:-"automatic"} -UPGRADE_PACKAGES=${5:-"true"} -INSTALL_OH_MYS=${6:-"true"} -ADD_NON_FREE_PACKAGES=${7:-"false"} +INSTALL_ZSH=${INSTALL_ZSH:-"true"} +INSTALL_OH_MY_ZSH=${INSTALL_OH_MY_ZSH:-"true"} +UPGRADE_PACKAGES=${UPGRADE_PACKAGES:-"true"} +USERNAME=${USERNAME:-"automatic"} +USER_UID=${USER_UID:-"automatic"} +USER_GID=${USER_GID:-"automatic"} +ADD_NON_FREE_PACKAGES=${ADD_NON_FREE_PACKAGES:-"false"} + SCRIPT_DIR="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)" MARKER_FILE="/usr/local/etc/vscode-dev-containers/common" @@ -35,7 +34,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break @@ -85,6 +84,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then net-tools \ psmisc \ curl \ + tree \ wget \ rsync \ ca-certificates \ @@ -376,7 +376,7 @@ if [ "${INSTALL_ZSH}" = "true" ]; then # Adapted, simplified inline Oh My Zsh! install steps that adds, defaults to a codespaces theme. # See https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh for official script. oh_my_install_dir="${user_rc_path}/.oh-my-zsh" - if [ ! -d "${oh_my_install_dir}" ] && [ "${INSTALL_OH_MYS}" = "true" ]; then + if [ ! -d "${oh_my_install_dir}" ] && [ "${INSTALL_OH_MY_ZSH}" = "true" ]; then template_path="${oh_my_install_dir}/templates/zshrc.zsh-template" user_rc_file="${user_rc_path}/.zshrc" umask g-w,o-w diff --git a/src/desktop-lite/feature.json b/src/desktop-lite/devcontainer-feature.json index 4ad8b8d..fa7649c 100644 --- a/src/desktop-lite/feature.json +++ b/src/desktop-lite/devcontainer-feature.json @@ -4,25 +4,43 @@ "options": { "version": { "type": "string", - "enum": ["latest"], + "proposals": [ + "latest" + ], "default": "latest", - "description": "Currently unused." + "description": "Currently Unused!" }, - "password": { + "novnc_version": { "type": "string", - "proposals": ["vscode","codespaces","password"], + "proposals": [ + "1.2.0" + ], + "default": "1.2.0", + "description": "NoVnc Version" + }, + "vnc_password": { + "type": "string", + "proposals": [ + "vscode", + "codespaces", + "password" + ], "default": "vscode", "description": "Enter a password for desktop connections" }, - "webPort": { + "novnc_port": { "type": "string", - "proposals": ["6080"], + "proposals": [ + "6080" + ], "default": "6080", - "description": "Enter a port for the desktop web client" + "description": "Enter a port for the VNC web client" }, - "vncPort": { + "vnc_port": { "type": "string", - "proposals": ["5901"], + "proposals": [ + "5901" + ], "default": "5901", "description": "Enter a port for the desktop VNC server" } diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index ac149c4..e9f74f1 100644 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -6,16 +6,16 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/desktop-lite.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./desktop-lite-debian.sh [non-root user] [Desktop password] [Install web client flag] [VNC port] [Web Port] -USERNAME=${1:-"automatic"} -VNC_PASSWORD=${2:-"vscode"} -INSTALL_NOVNC=${3:-"true"} -VNC_PORT="${4:-5901}" -NOVNC_PORT="${5:-6080}" +NOVNC_VERSION=${NOVNC_VERSION:-"1.2.0"} # TODO: Add in a 'latest' auto-detect and swap name to 'version' +VNC_PASSWORD=${VNC_PASSWORD:-"vscode"} +NOVNC_PORT="${NOVNC_PORT:-6080}" +VNC_PORT="${VNC_PORT:-5901}" + +INSTALL_NOVNC=${INSTALL_NOVNC:-"true"} +USERNAME=${USERNAME:-"automatic"} + -NOVNC_VERSION=1.2.0 WEBSOCKETIFY_VERSION=0.10.0 package_list=" @@ -72,7 +72,7 @@ fi if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/docker-from-docker/feature.json b/src/docker-from-docker/devcontainer-feature.json index ce955a7..f9c5d28 100644 --- a/src/docker-from-docker/feature.json +++ b/src/docker-from-docker/devcontainer-feature.json @@ -4,7 +4,11 @@ "options": { "version": { "type": "string", - "proposals": ["latest", "none", "20.10"], + "proposals": [ + "latest", + "none", + "20.10" + ], "default": "latest", "description": "Select or enter a Docker/Moby CLI version. (Availability can vary by OS version.)" }, @@ -13,9 +17,12 @@ "default": true, "description": "Install OSS Moby build instead of Docker CE" }, - "dockerDashComposeVersion": { + "docker_dash_compose_version": { "type": "string", - "enum": ["v1", "v2" ], + "enum": [ + "v1", + "v2" + ], "default": "v1", "description": "Compose version to use for docker-compose (v1 or v2)" } @@ -29,9 +36,9 @@ ], "mounts": [ { - "source":"/var/run/docker.sock", - "target":"/var/run/docker-host.sock", - "type":"bind" + "source": "/var/run/docker.sock", + "target": "/var/run/docker-host.sock", + "type": "bind" } ], "install": { diff --git a/src/docker-from-docker/install.sh b/src/docker-from-docker/install.sh index 1102ae9..88ad52f 100644 --- a/src/docker-from-docker/install.sh +++ b/src/docker-from-docker/install.sh @@ -6,16 +6,16 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./docker-debian.sh [enable non-root docker socket access flag] [source socket] [target socket] [non-root user] [use moby] [CLI version] [Major version for docker-compose] - -ENABLE_NONROOT_DOCKER=${1:-"true"} -SOURCE_SOCKET=${2:-"/var/run/docker-host.sock"} -TARGET_SOCKET=${3:-"/var/run/docker.sock"} -USERNAME=${4:-"automatic"} -USE_MOBY=${5:-"true"} -DOCKER_VERSION=${6:-"latest"} -DOCKER_DASH_COMPOSE_VERSION=${7:-"v1"} # v1 or v2 + +DOCKER_VERSION=${VERSION:-"latest"} +USE_MOBY=${MOBY:-"true"} +DOCKER_DASH_COMPOSE_VERSION=${DOCKER_DASH_COMPOSE_VERSION:-"v1"} # v1 or v2 + +ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"} +SOURCE_SOCKET=${SOURCE_SOCKET:-"/var/run/docker-host.sock"} +TARGET_SOCKET=${TARGET_SOCKET:-"/var/run/docker.sock"} +USERNAME=${USERNAME:-"automatic"} + MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" @@ -31,7 +31,7 @@ fi if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/docker-in-docker/feature.json b/src/docker-in-docker/devcontainer-feature.json index 0aa95e9..096756d 100644 --- a/src/docker-in-docker/feature.json +++ b/src/docker-in-docker/devcontainer-feature.json @@ -4,7 +4,11 @@ "options": { "version": { "type": "string", - "proposals": ["latest", "none", "20.10" ], + "proposals": [ + "latest", + "none", + "20.10" + ], "default": "latest", "description": "Select or enter a Docker/Moby Engine version. (Availability can vary by OS version.)" }, @@ -13,9 +17,12 @@ "default": true, "description": "Install OSS Moby build instead of Docker CE" }, - "dockerDashComposeVersion": { + "docker_dash_compose_version": { "type": "string", - "enum": ["v1", "v2" ], + "enum": [ + "v1", + "v2" + ], "default": "v1", "description": "Default version of Docker Compose (v1 or v2)" } @@ -30,9 +37,9 @@ ], "mounts": [ { - "source":"dind-var-lib-docker", - "target":"/var/lib/docker", - "type":"volume" + "source": "dind-var-lib-docker", + "target": "/var/lib/docker", + "type": "volume" } ], "install": { diff --git a/src/docker-in-docker/install.sh b/src/docker-in-docker/install.sh index a525203..02dd260 100644 --- a/src/docker-in-docker/install.sh +++ b/src/docker-in-docker/install.sh @@ -6,14 +6,15 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./docker-in-docker-debian.sh [enable non-root docker access flag] [non-root user] [use moby] [Engine/CLI Version] [Major version for docker-compose] -ENABLE_NONROOT_DOCKER=${1:-"true"} -USERNAME=${2:-"automatic"} -USE_MOBY=${3:-"true"} -DOCKER_VERSION=${4:-"latest"} # The Docker/Moby Engine + CLI should match in version -DOCKER_DASH_COMPOSE_VERSION=${5:-"v1"} # v1 or v2 + +DOCKER_VERSION=${VERSION:-"latest"} # The Docker/Moby Engine + CLI should match in version +USE_MOBY=${MOBY:-"true"} +DOCKER_DASH_COMPOSE_VERSION=${DOCKER_DASH_COMPOSE_VERSION:-"v1"} # v1 or v2 + +ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"} +USERNAME=${USERNAME:-"automatic"} + MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy" @@ -40,7 +41,7 @@ fi if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/dotnet/feature.json b/src/dotnet/devcontainer-feature.json index 4e2c7a7..04b2811 100644 --- a/src/dotnet/feature.json +++ b/src/dotnet/devcontainer-feature.json @@ -4,21 +4,26 @@ "options": { "version": { "type": "string", - "proposals": ["latest","6.0","5.0","3.1"], + "proposals": [ + "latest", + "6.0", + "5.0", + "3.1" + ], "default": "latest", "description": "Select or enter a dotnet CLI version. (Available versions may vary by Linux distribution.)" }, - "runtimeOnly": { - "type":"boolean", + "runtime_only": { + "type": "boolean", "default": false, "description": "Install just the dotnet runtime if true, and sdk if false." }, - "overrideDefaultVersion": { - "type": "boolean", - "default": "true", - "description": "If true, overrides existing version (if any) of dotnet on the PATH" + "override_default_version": { + "type": "boolean", + "default": "true", + "description": "If true, overrides existing version (if any) of dotnet on the PATH" }, - "installUsingApt": { + "install_using_apt": { "type": "boolean", "default": "true", "description": "If true, it installs using apt instead of the release URL" diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh index 4052dbd..0a147bc 100644 --- a/src/dotnet/install.sh +++ b/src/dotnet/install.sh @@ -6,17 +6,16 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/dotnet.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./dotnet-debian.sh [.NET version] [.NET runtime only] [non-root user] [add TARGET_DOTNET_ROOT to rc files flag] [.NET root] [access group name] - -DOTNET_VERSION=${1:-"latest"} -DOTNET_RUNTIME_ONLY=${2:-"false"} -USERNAME=${3:-"automatic"} -UPDATE_RC=${4:-"true"} -TARGET_DOTNET_ROOT=${5:-"/usr/local/dotnet"} -ACCESS_GROUP=${6:-"dotnet"} -OVERRIDE_DEFAULT_VERSION=${7:-"true"} -INSTALL_USING_APT=${8:-"true"} + +DOTNET_VERSION=${VERSION:-"latest"} +DOTNET_RUNTIME_ONLY=${RUNTIME_ONLY:-"false"} +OVERRIDE_DEFAULT_VERSION=${OVERRIDE_DEFAULT_VERSION:-"true"} +INSTALL_USING_APT=${INSTALL_USING_APT:-"true"} + +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} +TARGET_DOTNET_ROOT=${TARGET_DOTNET_ROOT:-"/usr/local/dotnet"} +ACCESS_GROUP=${ACCESS_GROUP:-"dotnet"} MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" DOTNET_ARCHIVE_ARCHITECTURES="amd64" diff --git a/src/git-lfs/feature.json b/src/git-lfs/devcontainer-feature.json index 892670b..516454e 100644 --- a/src/git-lfs/feature.json +++ b/src/git-lfs/devcontainer-feature.json @@ -4,9 +4,12 @@ "options": { "version": { "type": "string", - "enum": ["latest", "none"], + "enum": [ + "latest", + "none" + ], "default": "latest", - "description": "Currently unused." + "description": "Select version of Git LFS to install" } }, "install": { diff --git a/src/git-lfs/install.sh b/src/git-lfs/install.sh index dd9e702..0ba88c3 100644 --- a/src/git-lfs/install.sh +++ b/src/git-lfs/install.sh @@ -6,10 +6,9 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/git-lfs.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./git-lfs-debian.sh [version] -GIT_LFS_VERSION=${1:-"latest"} +GIT_LFS_VERSION=${VERSION:-"latest"} + GIT_LFS_ARCHIVE_GPG_KEY_URI="https://packagecloud.io/github/git-lfs/gpgkey" GIT_LFS_ARCHIVE_ARCHITECTURES="amd64" GIT_LFS_ARCHIVE_VERSION_CODENAMES="stretch buster bullseye bionic focal" diff --git a/src/git/feature.json b/src/git/devcontainer-feature.json index 6d9686b..6d9686b 100644 --- a/src/git/feature.json +++ b/src/git/devcontainer-feature.json diff --git a/src/git/install.sh b/src/git/install.sh index 6900897..1da6500 100644 --- a/src/git/install.sh +++ b/src/git/install.sh @@ -6,11 +6,9 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/git-from-src.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./git-from-src-debian.sh [version] [use PPA if available] -GIT_VERSION=${1:-"latest"} # 'system' checks the base image first, else installs 'latest' -USE_PPA_IF_AVAILABLE=${2:-"false"} +GIT_VERSION=${VERSION:-"latest"} # 'system' checks the base image first, else installs 'latest' +USE_PPA_IF_AVAILABLE=${PPA:-"false"} GIT_CORE_PPA_ARCHIVE_GPG_KEY=E1DD270288B4E6030699E45FA1715D88E1DF1F24 GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80 diff --git a/src/github-cli/feature.json b/src/github-cli/devcontainer-feature.json index 9a00923..a99634c 100644 --- a/src/github-cli/feature.json +++ b/src/github-cli/devcontainer-feature.json @@ -4,7 +4,10 @@ "options": { "version": { "type": "string", - "proposals": ["latest", "none"], + "proposals": [ + "latest", + "none" + ], "default": "latest", "description": "Select version of the GitHub CLI, if not latest." } diff --git a/src/github-cli/install.sh b/src/github-cli/install.sh index 01ad4d4..4fea41b 100644 --- a/src/github-cli/install.sh +++ b/src/github-cli/install.sh @@ -6,10 +6,8 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/github.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./github-debian.sh [version] -CLI_VERSION=${1:-"latest"} +CLI_VERSION=${VERSION:-"latest"} GITHUB_CLI_ARCHIVE_GPG_KEY=C99B11DEB97541F0 GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80 diff --git a/src/go/feature.json b/src/go/devcontainer-feature.json index 387839e..387839e 100644 --- a/src/go/feature.json +++ b/src/go/devcontainer-feature.json diff --git a/src/go/install.sh b/src/go/install.sh index 86d652b..96a1b38 100644 --- a/src/go/install.sh +++ b/src/go/install.sh @@ -6,15 +6,14 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/go.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./go-debian.sh [Go version] [GOROOT] [GOPATH] [non-root user] [Add GOPATH, GOROOT to rc files flag] [Install tools flag] -TARGET_GO_VERSION=${1:-"latest"} -TARGET_GOROOT=${2:-"/usr/local/go"} -TARGET_GOPATH=${3:-"/go"} -USERNAME=${4:-"automatic"} -UPDATE_RC=${5:-"true"} -INSTALL_GO_TOOLS=${6:-"true"} +TARGET_GO_VERSION=${VERSION:-"latest"} + +TARGET_GOROOT=${TARGET_GOROOT:-"/usr/local/go"} +TARGET_GOPATH=${TARGET_GOPATH:-"/go"} +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} +INSTALL_GO_TOOLS=${INSTALL_GO_TOOLS:-"true"} # https://www.google.com/linuxrepositories/ GO_GPG_KEY_URI="https://dl.google.com/linux/linux_signing_key.pub" @@ -35,7 +34,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/hugo/feature.json b/src/hugo/devcontainer-feature.json index 1d06486..1d06486 100644 --- a/src/hugo/feature.json +++ b/src/hugo/devcontainer-feature.json diff --git a/src/hugo/install.sh b/src/hugo/install.sh index de1d03c..9e25aeb 100644 --- a/src/hugo/install.sh +++ b/src/hugo/install.sh @@ -6,12 +6,11 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/hugo.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./hugo-debian.sh [Hugo version] [HUGO_DIR] [Non-root user] [Add rc files flag] -VERSION=${1:-"latest"} -USERNAME=${3:-"automatic"} -UPDATE_RC=${4:-"true"} +VERSION=${VERSION:-"latest"} + +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} HUGO_DIR=${HUGO_DIR:-"/usr/local/hugo"} @@ -31,7 +30,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/java/feature.json b/src/java/devcontainer-feature.json index 64d5d65..64d5d65 100644 --- a/src/java/feature.json +++ b/src/java/devcontainer-feature.json diff --git a/src/java/install.sh b/src/java/install.sh index f5880cd..7918568 100644 --- a/src/java/install.sh +++ b/src/java/install.sh @@ -9,10 +9,11 @@ # # Syntax: ./java-debian.sh [JDK version] [SDKMAN_DIR] [non-root user] [Add to rc files flag] -JAVA_VERSION=${1:-"lts"} -export SDKMAN_DIR=${2:-"/usr/local/sdkman"} -USERNAME=${3:-"automatic"} -UPDATE_RC=${4:-"true"} +JAVA_VERSION=${VERSION:-"lts"} + +export SDKMAN_DIR=${SDKMAN_DIR:-"/usr/local/sdkman"} +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} set -e @@ -30,7 +31,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/java/wrapper.sh b/src/java/wrapper.sh index 4d2aef3..d7f05de 100644 --- a/src/java/wrapper.sh +++ b/src/java/wrapper.sh @@ -27,7 +27,7 @@ if [ "${is_jdk_8}" = "true" ]; then # Determine the appropriate non-root user username="" possible_users=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for current_user in ${possible_users[@]}; do + for current_user in "${POSSIBLE_USERS[@]}"; do if id -u ${current_user} > /dev/null 2>&1; then username=${current_user} break diff --git a/src/jupyterlab/feature.json b/src/jupyterlab/devcontainer-feature.json index 86010c3..8546925 100644 --- a/src/jupyterlab/feature.json +++ b/src/jupyterlab/devcontainer-feature.json @@ -4,13 +4,19 @@ "options": { "version": { "type": "string", - "proposals": ["latest", "3.6.2"], + "proposals": [ + "latest", + "3.6.2" + ], "default": "latest", "description": "Select or enter a jupyterlab version." }, - "pythonBinary": { + "python_binary": { "type": "string", - "proposals": ["python", "/usr/local/python/bin/python"], + "proposals": [ + "python", + "/usr/local/python/bin/python" + ], "default": "python", "description": "Select or enter the python binary path." } diff --git a/src/jupyterlab/install.sh b/src/jupyterlab/install.sh index 4d426a4..f6c30d3 100644 --- a/src/jupyterlab/install.sh +++ b/src/jupyterlab/install.sh @@ -6,15 +6,14 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/jupyterlab.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./jupyter-debian.sh set -ex -VERSION=${1:-"latest"} -USERNAME=${2:-"automatic"} -PYTHON=${3:-"python"} -ALLOW_ALL_ORIGINS=${4:-""} +VERSION=${VERSION:-"latest"} +PYTHON=${PYTHON_BINARY:-"python"} + +USERNAME=${USERNAME:-"automatic"} +ALLOW_ALL_ORIGINS=${ALLOW_ALL_ORIGINS:-""} 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.' @@ -25,7 +24,7 @@ fi if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/kubectl-helm-minikube/feature.json b/src/kubectl-helm-minikube/devcontainer-feature.json index 7033c7a..8b50879 100644 --- a/src/kubectl-helm-minikube/feature.json +++ b/src/kubectl-helm-minikube/devcontainer-feature.json @@ -4,19 +4,29 @@ "options": { "version": { "type": "string", - "proposals": ["latest", "none", "1.23", "1.22", "1.21"], + "proposals": [ + "latest", + "none", + "1.23", + "1.22", + "1.21" + ], "default": "latest", "description": "Select or enter a Kubernetes version to install" }, "helm": { "type": "string", - "proposals": ["latest"], + "proposals": [ + "latest" + ], "default": "latest", "description": "Select or enter a Helm version to install" }, "minikube": { "type": "string", - "proposals": ["latest"], + "proposals": [ + "latest" + ], "default": "latest", "description": "Select or enter a Minikube version to install" } @@ -26,9 +36,9 @@ ], "mounts": [ { - "source":"minikube-config", - "target":"/home/vscode/.minikube", - "type":"volume" + "source": "minikube-config", + "target": "/home/vscode/.minikube", + "type": "volume" } ], "install": { diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index 0981024..b10f578 100644 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -6,18 +6,17 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/kubectl-helm.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./kubectl-helm-debian.sh [kubectl verison] [Helm version] [minikube version] [kubectl SHA256] [Helm SHA256] [minikube SHA256] set -e -KUBECTL_VERSION="${1:-"latest"}" -HELM_VERSION="${2:-"latest"}" -MINIKUBE_VERSION="${3:-"none"}" # latest is also valid -KUBECTL_SHA256="${4:-"automatic"}" -HELM_SHA256="${5:-"automatic"}" -MINIKUBE_SHA256="${6:-"automatic"}" -USERNAME=${7:-"automatic"} +KUBECTL_VERSION="${VERSION:-"latest"}" +HELM_VERSION="${HELM:-"latest"}" +MINIKUBE_VERSION="${MINIKUBE:-"none"}" # latest is also valid + +KUBECTL_SHA256="${KUBECTL_SHA256:-"automatic"}" +HELM_SHA256="${HELM_SHA256:-"automatic"}" +MINIKUBE_SHA256="${MINIKUBE_SHA256:-"automatic"}" +USERNAME=${USERNAME:-"automatic"} HELM_GPG_KEYS_URI="https://raw.githubusercontent.com/helm/helm/main/KEYS" GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80 @@ -33,7 +32,7 @@ fi if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/node/feature.json b/src/node/devcontainer-feature.json index fdb29cb..8d3bda6 100644 --- a/src/node/feature.json +++ b/src/node/devcontainer-feature.json @@ -4,24 +4,33 @@ "options": { "version": { "type": "string", - "proposals": [ "lts", "latest", "none", "18", "16", "14" ], + "proposals": [ + "lts", + "latest", + "none", + "18", + "16", + "14" + ], "default": "lts", "description": "Select or enter a Node.js version to install" }, - "nodeGypDependencies": { + "install_tools_for_node_gyp": { "type": "boolean", "default": true, "description": "Install dependencies to compile native node modules (node-gyp)?" }, - "nvmInstallPath": { + "nvm_install_path": { "type": "string", "default": "/usr/local/share/nvm", "description": "The path where NVM will be installed." } }, - "extensions": ["dbaeumer.vscode-eslint"], + "extensions": [ + "dbaeumer.vscode-eslint" + ], "containerEnv": { - "NVM_DIR":"/usr/local/share/nvm", + "NVM_DIR": "/usr/local/share/nvm", "NVM_SYMLINK_CURRENT": "true", "PATH": "${NVM_DIR}/current/bin:${PATH}" }, diff --git a/src/node/install.sh b/src/node/install.sh index 0b2190b..bb71c64 100644 --- a/src/node/install.sh +++ b/src/node/install.sh @@ -6,14 +6,14 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/node.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./node-debian.sh [directory to install nvm] [node version to install (use "none" to skip)] [non-root user] [Update rc files flag] [install node-gyp deps] -export NVM_DIR=${1:-"/usr/local/share/nvm"} -export NODE_VERSION=${2:-"lts"} -USERNAME=${3:-"automatic"} -UPDATE_RC=${4:-"true"} -INSTALL_TOOLS_FOR_NODE_GYP="${5:-true}" +export NODE_VERSION=${VERSION:-"lts"} +export NVM_DIR=${NVM_INSTALL_PATH:-"/usr/local/share/nvm"} +INSTALL_TOOLS_FOR_NODE_GYP="${INSTALL_TOOLS_FOR_NODE_GYP:-true}" + +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} + export NVM_VERSION="0.38.0" set -e @@ -32,7 +32,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json new file mode 100644 index 0000000..c526893 --- /dev/null +++ b/src/oryx/devcontainer-feature.json @@ -0,0 +1,14 @@ +{ + "id": "oryx", + "name": "Oryx", + "containerEnv": { + "PATH": "usr/local/oryx:${PATH}", + "ORYX_SDK_STORAGE_BASE_URL": "https://oryx-cdn.microsoft.io", + "ENABLE_DYNAMIC_INSTALL": "true", + "DYNAMIC_INSTALL_ROOT_DIR": "/usr/local" + }, + "install": { + "app": "", + "file": "install.sh" + } +}
\ No newline at end of file diff --git a/src/oryx/feature.json b/src/oryx/feature.json deleted file mode 100644 index 10a468b..0000000 --- a/src/oryx/feature.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "oryx", - "name": "Oryx", - "containerEnv": { - "PATH":"usr/local/oryx:${PATH}", - "ORYX_SDK_STORAGE_BASE_URL":"https://oryx-cdn.microsoft.io", - "ENABLE_DYNAMIC_INSTALL":"true", - "DYNAMIC_INSTALL_ROOT_DIR":"/usr/local" - }, - "install": { - "app": "", - "file": "install.sh" - } -}
\ No newline at end of file diff --git a/src/oryx/install.sh b/src/oryx/install.sh index 22c12d8..bdbe395 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -6,11 +6,9 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/hugo.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./oryx-debian.sh [Non-root user] -USERNAME=${1:-"automatic"} -UPDATE_RC=${2:-"true"} +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} set -eu @@ -28,7 +26,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/php/feature.json b/src/php/devcontainer-feature.json index 4c5dcac..2832eb1 100644 --- a/src/php/feature.json +++ b/src/php/devcontainer-feature.json @@ -4,19 +4,22 @@ "options": { "version": { "type": "string", - "proposals": ["latest", "8.0.16"], + "proposals": [ + "latest", + "8.0.16" + ], "default": "latest", "description": "Select or enter a PHP version" }, - "installComposer": { + "install_composer": { "type": "boolean", "default": true, "description": "Install PHP Composer?" }, - "overrideDefaultVersion": { - "type": "boolean", - "default": "true", - "description": "If true, overrides existing version (if any) of dotnet on the PATH" + "override_default_version": { + "type": "boolean", + "default": "true", + "description": "If true, overrides existing version (if any) of dotnet on the PATH" } }, "extensions": [ @@ -27,7 +30,7 @@ ], "containerEnv": { "PHP_PATH": "/usr/local/php/current", - "PATH":"${PHP_PATH}:${PHP_PATH}/bin:${PATH}" + "PATH": "${PHP_PATH}:${PHP_PATH}/bin:${PATH}" }, "install": { "app": "", diff --git a/src/php/install.sh b/src/php/install.sh index 125460d..7da6cb8 100644 --- a/src/php/install.sh +++ b/src/php/install.sh @@ -5,17 +5,17 @@ #------------------------------------------------------------------------------------------------------------- # # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./php-debian.sh [PHP version] [PHP_DIR] [Add Composer flag] [Non-root user] [Add rc files flag] - -VERSION=${1:-"latest"} -export PHP_DIR=${2:-"/usr/local/php"} -INSTALL_COMPOSER=${3:-"true"} -USERNAME=${4:-"automatic"} -UPDATE_RC=${5:-"true"} -OVERRIDE_DEFAULT_VERSION=${6:-"true"} set -eux + +VERSION=${VERSION:-"latest"} +INSTALL_COMPOSER=${INSTALL_COMPOSER:-"true"} +OVERRIDE_DEFAULT_VERSION=${OVERRIDE_DEFAULT_VERSION:-"true"} + +export PHP_DIR=${PHP_DIR:-"/usr/local/php"} +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} + export DEBIAN_FRONTEND=noninteractive if [ "$(id -u)" -ne 0 ]; then @@ -33,7 +33,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/powershell/feature.json b/src/powershell/devcontainer-feature.json index 842a629..07e838f 100644 --- a/src/powershell/feature.json +++ b/src/powershell/devcontainer-feature.json @@ -4,7 +4,11 @@ "options": { "version": { "type": "string", - "proposals": ["latest", "none", "7.1"], + "proposals": [ + "latest", + "none", + "7.1" + ], "default": "latest", "description": "Select or enter a version of PowerShell." } diff --git a/src/powershell/install.sh b/src/powershell/install.sh index b8630c4..be60201 100644 --- a/src/powershell/install.sh +++ b/src/powershell/install.sh @@ -6,12 +6,11 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/powershell.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./powershell-debian.sh [version] set -e -POWERSHELL_VERSION=${1:-"latest"} +POWERSHELL_VERSION=${VERSION:-"latest"} + MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" POWERSHELL_ARCHIVE_ARCHITECTURES="amd64" POWERSHELL_ARCHIVE_VERSION_CODENAMES="stretch buster bionic focal" diff --git a/src/python/feature.json b/src/python/devcontainer-feature.json index 9f8543c..238b8d1 100644 --- a/src/python/feature.json +++ b/src/python/devcontainer-feature.json @@ -18,7 +18,7 @@ "default": "os-provided", "description": "Select a Python version to install." }, - "installTools": { + "install_python_tools": { "type": "boolean", "default": true, "description": "Install common Python tools like pylint" @@ -33,12 +33,7 @@ "default": "/usr/local/python", "description": "The path where python will be installed." }, - "setup_links": { - "type": "boolean", - "default": "true", - "description": "If links and aliases should be created." - }, - "overrideDefaultVersion": { + "override_default_version": { "type": "boolean", "default": "true", "description": "If true, overrides existing version (if any) of python on the PATH" diff --git a/src/python/install.sh b/src/python/install.sh index ba0aa0a..ed273c0 100755 --- a/src/python/install.sh +++ b/src/python/install.sh @@ -6,18 +6,18 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/python.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./python-debian.sh [Python Version] [Python intall path] [PIPX_HOME] [non-root user] [Update rc files flag] [install tools flag] [Use Oryx if available flag] [Optimize when building from source flag] - -PYTHON_VERSION=${1:-"latest"} # 'system' checks the base image first, else installs 'latest' -PYTHON_INSTALL_PATH=${2:-"/usr/local/python"} -export PIPX_HOME=${3:-"/usr/local/py-utils"} -USERNAME=${4:-"automatic"} -UPDATE_RC=${5:-"true"} -INSTALL_PYTHON_TOOLS=${6:-"true"} -USE_ORYX_IF_AVAILABLE=${7:-"true"} -OPTIMIZE_BUILD_FROM_SOURCE=${8-"false"} -OVERRIDE_DEFAULT_VERSION=${9:-"true"} + +PYTHON_VERSION=${VERSION:-"latest"} # 'system' checks the base image first, else installs 'latest' +INSTALL_PYTHON_TOOLS=${INSTALL_PYTHON_TOOLS:-"true"} +OPTIMIZE_BUILD_FROM_SOURCE=${OPTIMIZE:-"false"} +PYTHON_INSTALL_PATH=${INSTALL_PATH:-"/usr/local/python"} +OVERRIDE_DEFAULT_VERSION=${OVERRIDE_DEFAULT_VERSION:-"true"} + +export PIPX_HOME=${PIPX_HOME:-"/usr/local/py-utils"} + +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} +USE_ORYX_IF_AVAILABLE=${USE_ORYX_IF_AVAILABLE:-"true"} DEFAULT_UTILS=("pylint" "flake8" "autopep8" "black" "yapf" "mypy" "pydocstyle" "pycodestyle" "bandit" "pipenv" "virtualenv") PYTHON_SOURCE_GPG_KEYS="64E628F8D684696D B26995E310250568 2D347EA6AA65421D FB9921286F5E1540 3A5CA953F73C700D 04C367C218ADD4FF 0EDDC5F26A45C816 6AF053F07D9DC8D2 C9BE28DEE6DF025C 126EB563A74B06BF D9866941EA5BBD71 ED9D77D5" @@ -41,7 +41,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break @@ -365,7 +365,7 @@ if ! type pipx > /dev/null 2>&1; then /tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx pipx_path="/tmp/pip-tmp/bin/" fi -for util in ${DEFAULT_UTILS[@]}; do +for util in "${DEFAULT_UTILS[@]}"; do if ! type ${util} > /dev/null 2>&1; then ${pipx_path}pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall' ${util} else diff --git a/src/ruby/feature.json b/src/ruby/devcontainer-feature.json index 919cf47..919cf47 100644 --- a/src/ruby/feature.json +++ b/src/ruby/devcontainer-feature.json diff --git a/src/ruby/install.sh b/src/ruby/install.sh index 3d3edbc..2e9b37a 100644 --- a/src/ruby/install.sh +++ b/src/ruby/install.sh @@ -6,13 +6,12 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/ruby.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./ruby-debian.sh [Ruby version] [non-root user] [Add to rc files flag] [Install tools flag] -RUBY_VERSION=${1:-"latest"} -USERNAME=${2:-"automatic"} -UPDATE_RC=${3:-"true"} -INSTALL_RUBY_TOOLS=${6:-"true"} +RUBY_VERSION=${VERSION:-"latest"} + +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} +INSTALL_RUBY_TOOLS=${INSTALL_RUBY_TOOLS:-"true"} # Note: ruby-debug-ide will install the right version of debase if missing and # installing debase directly fails on Ruby 3.1.0 as of 1/7/2022, so omitting. @@ -39,7 +38,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/rust/feature.json b/src/rust/devcontainer-feature.json index 147969f..147969f 100644 --- a/src/rust/feature.json +++ b/src/rust/devcontainer-feature.json diff --git a/src/rust/install.sh b/src/rust/install.sh index 1d90b14..07a36a7 100644 --- a/src/rust/install.sh +++ b/src/rust/install.sh @@ -6,16 +6,15 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/rust.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./rust-debian.sh [CARGO_HOME] [RUSTUP_HOME] [non-root user] [add CARGO/RUSTUP_HOME to rc files flag] [whether to update rust] [Rust version] [rustup install profile] -export CARGO_HOME=${1:-"/usr/local/cargo"} -export RUSTUP_HOME=${2:-"/usr/local/rustup"} -USERNAME=${3:-"automatic"} -UPDATE_RC=${4:-"true"} -UPDATE_RUST=${5:-"false"} -RUST_VERSION=${6:-"latest"} -RUSTUP_PROFILE=${7:-"minimal"} +RUST_VERSION=${VERSION:-"latest"} +RUSTUP_PROFILE=${PROFILE:-"minimal"} + +export CARGO_HOME=${CARGO_HOME:-"/usr/local/cargo"} +export RUSTUP_HOME=${RUSTUP_HOME:-"/usr/local/rustup"} +USERNAME=${USERNAME:-"automatic"} +UPDATE_RC=${UPDATE_RC:-"true"} +UPDATE_RUST=${UPDATE_RUST:-"false"} set -e @@ -33,7 +32,7 @@ chmod +x /etc/profile.d/00-restore-env.sh if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/sshd/feature.json b/src/sshd/devcontainer-feature.json index 4de71d9..4de71d9 100644 --- a/src/sshd/feature.json +++ b/src/sshd/devcontainer-feature.json diff --git a/src/sshd/install.sh b/src/sshd/install.sh index 3e8d2ec..4ee7893 100644 --- a/src/sshd/install.sh +++ b/src/sshd/install.sh @@ -7,15 +7,13 @@ # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/sshd.md # Maintainer: The VS Code and Codespaces Teams # -# Syntax: ./sshd-debian.sh [SSH Port (don't use 22)] [non-root user] [start sshd now flag] [new password for user] [fix environment flag] -# # Note: You can change your user's password with "sudo passwd $(whoami)" (or just "passwd" if running as root). -SSHD_PORT=${1:-"2222"} -USERNAME=${2:-"automatic"} -START_SSHD=${3:-"false"} -NEW_PASSWORD=${4:-"skip"} -FIX_ENVIRONMENT=${5:-"true"} +SSHD_PORT=${SSHD_PORT:-"2222"} +USERNAME=${USERNAME:-"automatic"} +START_SSHD=${START_SSHD:-"false"} +NEW_PASSWORD=${NEW_PASSWORD:-"skip"} +FIX_ENVIRONMENT=${FIX_ENVIRONMENT:-"true"} set -e @@ -28,7 +26,7 @@ fi if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break diff --git a/src/terraform/feature.json b/src/terraform/devcontainer-feature.json index 8af83a7..8af83a7 100644 --- a/src/terraform/feature.json +++ b/src/terraform/devcontainer-feature.json diff --git a/src/terraform/install.sh b/src/terraform/install.sh index f2614ae..3368374 100644 --- a/src/terraform/install.sh +++ b/src/terraform/install.sh @@ -6,17 +6,16 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/terraform.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./terraform-debian.sh [terraform version] [tflint version] [terragrunt version] [terraform SHA] [tflint SHA] [terragrunt SHA] set -e -TERRAFORM_VERSION="${1:-"latest"}" -TFLINT_VERSION="${2:-"latest"}" -TERRAGRUNT_VERSION="${3:-"latest"}" -TERRAFORM_SHA256="${4:-"automatic"}" -TFLINT_SHA256="${5:-"automatic"}" -TERRAGRUNT_SHA256="${6:-"automatic"}" +TERRAFORM_VERSION="${VERSION:-"latest"}" +TFLINT_VERSION="${TFLINT:-"latest"}" +TERRAGRUNT_VERSION="${TERRAGRUNT:-"latest"}" + +TERRAFORM_SHA256="${TERRAFORM_SHA256:-"automatic"}" +TFLINT_SHA256="${TFLINT_SHA256:-"automatic"}" +TERRAGRUNT_SHA256="${TERRAGRUNT_SHA256:-"automatic"}" TERRAFORM_GPG_KEY="72D7468F" TFLINT_GPG_KEY_URI="https://raw.githubusercontent.com/terraform-linters/tflint/master/8CE69160EB3F2FE9.key" diff --git a/test-scenarios/install_python_twice.sh b/test-scenarios/install_python_twice.sh index 9750ddd..911ee54 100644 --- a/test-scenarios/install_python_twice.sh +++ b/test-scenarios/install_python_twice.sh @@ -5,11 +5,10 @@ set -e # Optional: Import test library source dev-container-features-test-lib -# Definition specific tests -check "version" python --version +check "version 3.9 installed" ls -1 /usr/local/python/ | grep 3.9 +check "version 3.8 installed" ls -1 /usr/local/python/ | grep 3.8 -# ... -# ... +check "3.9 alias to python on path" python --version | grep 3.9 # Report result reportResults diff --git a/test-scenarios/scenarios.json b/test-scenarios/scenarios.json index a4d3fa2..e97b853 100644 --- a/test-scenarios/scenarios.json +++ b/test-scenarios/scenarios.json @@ -4,11 +4,16 @@ "features": [ { "id": "python", - "version": "3.8" + "options": { + "version": "3.8" + } }, { "id": "python", - "version": "3.9" + "options": { + "version": "3.9", + "overrideDefaultVersion": true + } } ] } |