devcontainers / devcontainers/features

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

Đang mở
#765 4 bình luận 2 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Shell
Star
1.5k
Fork
621
Merge trung bình
6 ngày 53 phút
Pull request đã merge (30 ngày)
9

Mô tả

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
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với src/common-utils/main.sh, ở quanh các dòng được tham chiếu 322 và 336, sau đó kiểm tra các tập lệnh cài đặt cho những Features khác. So sánh cách xử lý việc phát hiện bản phân phối và các lỗi do hệ điều hành không được hỗ trợ, đồng thời xác minh rằng các Features bị ảnh hưởng báo cáo một lỗi rõ ràng về image không được hỗ trợ thay vì lỗi của trình quản lý gói.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
shell
Lĩnh vực
devops
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.