Skip to content

Added 'conan' feature - #1

Closed
nkdui wants to merge 6 commits into
mainfrom
feature/conan
Closed

Added 'conan' feature#1
nkdui wants to merge 6 commits into
mainfrom
feature/conan

Conversation

@nkdui

@nkdui nkdui commented Apr 19, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Conan (1.x) Dev Container Feature, including install logic and multi-distro test scenarios, so users can install Conan 1.x (or a pinned 1.x version) in dev containers.

Changes:

  • Introduces src/conan feature metadata, install script, and README documentation.
  • Adds default + scenario-based feature tests across multiple distributions and a pinned-version scenario.
  • Adds a Conan feature test matrix via test/conan/scenarios.json.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/conan/install.sh Implements Conan 1.x installation via a Python virtualenv, with distro detection and version gating.
src/conan/devcontainer-feature.json Declares the conan feature, option conanVersion, and dependency ordering via installsAfter.
src/conan/README.md Documents the feature usage and options.
test/conan/test.sh Default (auto-generated) test validating Conan presence/version output.
test/conan/scenarios.json Defines per-distro and version-specific test scenarios for the feature.
test/conan/debian.sh Scenario test for Debian image.
test/conan/fedora.sh Scenario test for Fedora image.
test/conan/archlinux.sh Scenario test for Arch Linux image.
test/conan/alpine.sh Scenario test for Alpine image.
test/conan/specific_version.sh Scenario test verifying installation of Conan 1.62.0.
test/conan/installed.sh Scenario test validating behavior when Conan is already present in the base image.
AGENTS.md Adds repository structure and contributor guidance for features + tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/conan/install.sh
Comment on lines +67 to +94
install_python() {
DISTRO=$(detect_distribution)
echo "Detected distribution: $DISTRO"

if command -v python3 > /dev/null 2>&1; then
echo "Python3 is already installed"
return
fi

echo "Installing Python3..."
case "$DISTRO" in
debian|ubuntu)
apt-get update && apt-get install -y --no-install-recommends python3 python3-venv
;;
arch|archlinux)
pacman -Sy --noconfirm python
;;
fedora)
dnf install -y python3
;;
alpine)
apk add --no-cache python3 py3-pip
;;
*)
echo "ERROR: Unsupported distribution: $DISTRO"
exit 1
;;
esac

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install_python skips installing distro packages as soon as python3 exists, but python3 -m venv can still fail if the venv module isn’t present (e.g., Debian/Ubuntu images with python3 but without python3-venv). Consider explicitly checking python3 -m venv --help (or presence of the venv module) and installing the needed package(s) when missing instead of only checking command -v python3.

Suggested change
install_python() {
DISTRO=$(detect_distribution)
echo "Detected distribution: $DISTRO"
if command -v python3 > /dev/null 2>&1; then
echo "Python3 is already installed"
return
fi
echo "Installing Python3..."
case "$DISTRO" in
debian|ubuntu)
apt-get update && apt-get install -y --no-install-recommends python3 python3-venv
;;
arch|archlinux)
pacman -Sy --noconfirm python
;;
fedora)
dnf install -y python3
;;
alpine)
apk add --no-cache python3 py3-pip
;;
*)
echo "ERROR: Unsupported distribution: $DISTRO"
exit 1
;;
esac
has_python_venv() {
command -v python3 > /dev/null 2>&1 && python3 -m venv --help > /dev/null 2>&1
}
install_python() {
DISTRO=$(detect_distribution)
echo "Detected distribution: $DISTRO"
NEED_PYTHON=1
NEED_VENV=1
if command -v python3 > /dev/null 2>&1; then
NEED_PYTHON=0
if has_python_venv; then
NEED_VENV=0
echo "Python3 and venv are already installed"
return
fi
echo "Python3 is already installed, but the venv module is missing"
fi
echo "Installing required Python packages..."
case "$DISTRO" in
debian|ubuntu)
apt-get update
if [ "$NEED_PYTHON" -eq 1 ]; then
apt-get install -y --no-install-recommends python3 python3-venv
else
apt-get install -y --no-install-recommends python3-venv
fi
;;
arch|archlinux)
if [ "$NEED_PYTHON" -eq 1 ]; then
pacman -Sy --noconfirm python
fi
;;
fedora)
if [ "$NEED_PYTHON" -eq 1 ]; then
dnf install -y python3
fi
;;
alpine)
if [ "$NEED_PYTHON" -eq 1 ]; then
apk add --no-cache python3 py3-pip
fi
;;
*)
echo "ERROR: Unsupported distribution: $DISTRO"
exit 1
;;
esac
if ! has_python_venv; then
echo "ERROR: Python3 venv support is not available after installation"
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment thread src/conan/install.sh
Comment on lines +97 to +107
install_conan() {
echo "Creating virtual environment at $CONAN_VENV_DIR..."
python3 -m venv "$CONAN_VENV_DIR"

if [ "$CONAN_VERSION" = "latest" ]; then
echo "Installing latest Conan 1.x..."
"$CONAN_VENV_DIR/bin/pip" install --upgrade "conan<2"
else
echo "Installing Conan $CONAN_VERSION..."
"$CONAN_VENV_DIR/bin/pip" install "conan==$CONAN_VERSION"
fi

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Alpine, creating a venv and then calling $CONAN_VENV_DIR/bin/pip assumes pip gets bootstrapped into the venv. Depending on the base image’s Python build, venv may not include pip by default, which will make the install fail. Consider ensuring pip is present in the venv (e.g., via python3 -m ensurepip/installing the appropriate distro package) before invoking the venv’s pip.

Copilot uses AI. Check for mistakes.
Comment thread src/conan/install.sh
apt-get update && apt-get install -y --no-install-recommends python3 python3-venv
;;
arch|archlinux)
pacman -Sy --noconfirm python

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using pacman -Sy performs a sync without upgrading the system and is discouraged on Arch because it can lead to partial-upgrade breakage. Prefer an approach that avoids partial upgrades (e.g., including an upgrade step) to make the install more reliable.

Suggested change
pacman -Sy --noconfirm python
pacman -Syu --noconfirm python

Copilot uses AI. Check for mistakes.
Comment thread src/conan/README.md
Comment on lines +17 to +20
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| conanVersion | Version of Conan 1.x to install (e.g., '1.66.0', '1.60.2', or 'latest' for newest 1.x) | string | latest |

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options table markdown is malformed (extra leading | on each row: || ...). This won’t render as a table in most markdown renderers; update it to a standard 4-column table with single leading/trailing pipes and a proper separator row.

Copilot uses AI. Check for mistakes.
Comment thread test/conan/installed.sh
Comment on lines +3 to +4
# Test scenario: specific_version
# Tests installing a specific Conan 1.x version

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header comment looks copy/pasted from specific_version and doesn’t match the scenario name/file (installed). Update the scenario name/description so it reflects what this test is actually validating (preinstalled Conan image + feature behavior).

Suggested change
# Test scenario: specific_version
# Tests installing a specific Conan 1.x version
# Test scenario: installed
# Tests the preinstalled Conan image and feature behavior

Copilot uses AI. Check for mistakes.
Comment thread test/conan/scenarios.json
Comment on lines +3 to +28
"image": "debian:latest",
"features": {
"conan": {}
}
},
"fedora": {
"image": "fedora:latest",
"features": {
"conan": {}
}
},
"archlinux": {
"image": "archlinux:latest",
"features": {
"conan": {}
}
},
"alpine": {
"image": "alpine:latest",
"features": {
"ghcr.io/cirolosapio/devcontainers-features/alpine-bash:0": {},
"conan": {}
}
},
"specific_version": {
"image": "debian:latest",

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using floating :latest tags for distro images in CI scenarios can make tests flaky over time as upstream images change. Consider pinning these to a stable tag/digest (or a known-good release tag) to keep test results reproducible.

Suggested change
"image": "debian:latest",
"features": {
"conan": {}
}
},
"fedora": {
"image": "fedora:latest",
"features": {
"conan": {}
}
},
"archlinux": {
"image": "archlinux:latest",
"features": {
"conan": {}
}
},
"alpine": {
"image": "alpine:latest",
"features": {
"ghcr.io/cirolosapio/devcontainers-features/alpine-bash:0": {},
"conan": {}
}
},
"specific_version": {
"image": "debian:latest",
"image": "debian:12",
"features": {
"conan": {}
}
},
"fedora": {
"image": "fedora:40",
"features": {
"conan": {}
}
},
"archlinux": {
"image": "archlinux:base-devel",
"features": {
"conan": {}
}
},
"alpine": {
"image": "alpine:3.20",
"features": {
"ghcr.io/cirolosapio/devcontainers-features/alpine-bash:0": {},
"conan": {}
}
},
"specific_version": {
"image": "debian:12",

Copilot uses AI. Check for mistakes.
@nkdui nkdui closed this Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants