devcontainers / devcontainers/features

Features should provide a meaningful error message if it's not supported by a devcontainer image

Abierto
#765 4 comentarios 2 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Shell
Estrellas
1.5k
Forks
621
Merge medio
6 d 53 min
PR fusionados (30 d)
9

Descripción

Most Features are only supported on Debian-based devcontainer images. Adding these features to an Alpine or Red Hat devcontainer often results in error messages such as "dpkg: not found."

An error message stating that the OS isn't supported would be more intuitive.

Given that the [common-utils](https://github.com/devcontainers/features/blob/d53b9d1816bac7a62f9ba5f20723eef428042d1f/src/common-utils/main.sh#L322) script already supports this (see below), it shouldn't be difficult to adapt in other features.

Requiring such a "preamble" may encourage developers to support other base devcontainer images, much like [common-utils](https://github.com/devcontainers/features/blob/d53b9d1816bac7a62f9ba5f20723eef428042d1f/src/common-utils/main.sh#L336) does.

```bash
# 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}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then
ADJUSTED_ID="rhel"
elif [ "${ID}" = "alpine" ]; then
ADJUSTED_ID="alpine"
else
echo "Linux distro ${ID} not supported."
exit 1
fi
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.