Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
features:
- ohmyposh
- microsoft-security-devops-cli
- prompty-dumpty
baseImage:
- debian:latest
- ubuntu:latest
Expand All @@ -36,6 +37,7 @@ jobs:
features:
- ohmyposh
- microsoft-security-devops-cli
- prompty-dumpty
steps:
- uses: actions/checkout@v4

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Feature tarballs for local testing
.devcontainer/*.tgz
.DS_Store
17 changes: 17 additions & 0 deletions docs/prompty-dumpty-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Plan: prompty-dumpty DevContainer Feature

Install prompty-dumpty (v0.6.2 current) Python package system-wide using pip3 with `--break-system-packages` flag. The CLI command `dumpty` will be available globally after installation.

## Steps

1. **Create feature structure** at `src/prompty-dumpty/` with `devcontainer-feature.json` (id: "prompty-dumpty", version option only with default "latest", no `installsAfter` or installPath), `README.md` documenting the `dumpty` command, and `.gitignore`

2. **Write install script** at `src/prompty-dumpty/install.sh` with `set -e` for fail-fast behavior, detect package manager (apt/apk/yum), install `python3-pip` if missing, run `pip3 install prompty-dumpty --break-system-packages` (latest) or `pip3 install prompty-dumpty==VERSION --break-system-packages` (specific version like 0.6.2)

3. **Add verification and output** using `command -v dumpty` to verify installation, run `dumpty --version`, display colored success message with installation details following `src/microsoft-security-devops-cli/install.sh` colored output pattern

4. **Create test suite** at `test/prompty-dumpty/` with `test.sh` (installs latest, verifies `dumpty` exists), `version.sh` (installs version 0.6.2 specifically), and `scenarios.json` testing both scenarios on debian/ubuntu base images

## Further Considerations

None - ready to implement with fail-fast on errors and pip's default install paths.
37 changes: 37 additions & 0 deletions src/prompty-dumpty/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Prompty Dumpty (prompty-dumpty)

Installs prompty-dumpty CLI tool for managing prompty files

## Example Usage

```json
"features": {
"ghcr.io/rosstaco/devcontainer-features/prompty-dumpty:1": {}
}
```

## Options

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Version of prompty-dumpty to install. Use 'latest' or a specific version like '0.6.2' | string | latest |

## Usage

After installation, the `dumpty` command will be available:

```bash
dumpty --help
dumpty --version
```

## Notes

This feature installs prompty-dumpty system-wide using pip3 with the `--break-system-packages` flag, which is appropriate for containerized development environments. Python 3 is assumed to be present in the base image.

For more information about prompty-dumpty, visit: https://pypi.org/project/prompty-dumpty/

---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/rosstaco/devcontainer-features/blob/main/src/prompty-dumpty/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
14 changes: 14 additions & 0 deletions src/prompty-dumpty/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": "prompty-dumpty",
"version": "1.0.0",
"name": "Prompty Dumpty",
"description": "Installs prompty-dumpty CLI tool for managing prompty files",
"documentationURL": "https://github.com/rosstaco/devcontainer-features/tree/main/src/prompty-dumpty",
"options": {
"version": {
"type": "string",
"default": "latest",
"description": "Version of prompty-dumpty to install. Use 'latest' or a specific version like '0.6.2'"
}
}
}
88 changes: 88 additions & 0 deletions src/prompty-dumpty/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash
set -e

# Prompty Dumpty installation script for devcontainer features
# https://pypi.org/project/prompty-dumpty/

VERSION="${VERSION:-latest}"

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

echo -e "${GREEN}Installing prompty-dumpty...${NC}"

# Ensure pip is available
if ! command -v pip3 &> /dev/null; then
echo "Installing python3-pip..."
export DEBIAN_FRONTEND=noninteractive
if command -v apt-get &> /dev/null; then
apt-get update && apt-get install -y --no-install-recommends python3-pip
elif command -v apk &> /dev/null; then
apk add --no-cache py3-pip
elif command -v yum &> /dev/null; then
yum install -y python3-pip
else
echo -e "${RED}Could not install python3-pip. Please install it manually.${NC}"
exit 1
fi
fi

# Build pip install command
if [ "$VERSION" = "latest" ]; then
echo "Installing latest version..."
PIP_PACKAGE="prompty-dumpty"
else
echo "Installing version: $VERSION"
PIP_PACKAGE="prompty-dumpty==$VERSION"
fi

# Check if pip supports --break-system-packages flag (pip >= 23.0)
if pip3 install --help 2>&1 | grep -q "break-system-packages"; then
PIP_SUPPORTS_BREAK_SYSTEM="yes"
else
PIP_SUPPORTS_BREAK_SYSTEM="no"
fi

# Install prompty-dumpty with appropriate flags
if [ "$PIP_SUPPORTS_BREAK_SYSTEM" = "yes" ]; then
echo "Running: pip3 install $PIP_PACKAGE --break-system-packages"
if ! pip3 install "$PIP_PACKAGE" --break-system-packages; then
echo -e "${RED}Failed to install prompty-dumpty${NC}"
exit 1
fi
else
echo "Running: pip3 install $PIP_PACKAGE"
if ! pip3 install "$PIP_PACKAGE"; then
echo -e "${RED}Failed to install prompty-dumpty${NC}"
exit 1
fi
fi

echo -e "${GREEN}prompty-dumpty installed successfully${NC}"

# Verify installation
if ! command -v dumpty &> /dev/null; then
echo -e "${YELLOW}Warning: dumpty command not found in PATH${NC}"
echo -e "${YELLOW}You may need to restart your shell or source your shell configuration${NC}"
else
echo -e "${GREEN}dumpty installation verified successfully${NC}"

# Try to get version info
if INSTALLED_VERSION=$(dumpty --version 2>&1); then
echo "Installed version: $INSTALLED_VERSION"
else
echo "Installed version: version check failed"
fi
fi

echo ""
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}Installation complete!${NC}"
echo -e "${GREEN}========================================${NC}"
echo ""
echo "The 'dumpty' command is now available."
echo ""
echo "For more information: https://pypi.org/project/prompty-dumpty/"
13 changes: 13 additions & 0 deletions test/prompty-dumpty/alpine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# This test verifies prompty-dumpty works on Alpine

set -e

source dev-container-features-test-lib

check "dumpty is executable" bash -c "command -v dumpty"

check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

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

The || true at the end of the version check masks potential failures. If dumpty --version fails, the test will still pass. Consider removing || true to ensure the command actually succeeds, or add explicit validation of the output.

Suggested change
check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
check "dumpty version command works" bash -c "dumpty --version 2>&1"

Copilot uses AI. Check for mistakes.

reportResults
13 changes: 13 additions & 0 deletions test/prompty-dumpty/debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# This test verifies prompty-dumpty works on Debian

set -e

source dev-container-features-test-lib

check "dumpty is executable" bash -c "command -v dumpty"

check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

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

The || true at the end of the version check masks potential failures. If dumpty --version fails, the test will still pass. Consider removing || true to ensure the command actually succeeds, or add explicit validation of the output.

Suggested change
check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
check "dumpty version command works" bash -c "dumpty --version 2>&1"

Copilot uses AI. Check for mistakes.

reportResults
22 changes: 22 additions & 0 deletions test/prompty-dumpty/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"prompty-dumpty": {
"version": "0.6.2"
}
}
},
"debian": {
"image": "mcr.microsoft.com/devcontainers/base:debian",
"features": {
"prompty-dumpty": {}
}
},
"alpine": {
"image": "mcr.microsoft.com/devcontainers/base:alpine",
"features": {
"prompty-dumpty": {}
}
}
}
23 changes: 23 additions & 0 deletions test/prompty-dumpty/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# This test file will be executed against an auto-generated devcontainer.json that
# includes the 'prompty-dumpty' Feature with no options.
#
# Thus, the value of all options will fall back to the default value in the
# Feature's 'devcontainer-feature.json'.
#
# These scripts are run as 'root' by default. Although that can be changed
# with the '--remote-user' flag.

set -e

# Optional: Import test library bundled with the devcontainer CLI
source dev-container-features-test-lib

# Feature-specific tests
check "dumpty is executable" bash -c "command -v dumpty"

check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

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

The || true at the end of the version check masks potential failures. If dumpty --version fails, the test will still pass. Consider removing || true to ensure the command actually succeeds, or add explicit validation of the output.

Suggested change
check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
check "dumpty version command works" bash -c "dumpty --version 2>&1"

Copilot uses AI. Check for mistakes.

# Report results
reportResults
Comment on lines +18 to +23
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

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

The test logic in lines 18-20 is duplicated across all four test files (test.sh, version.sh, alpine.sh, debian.sh). Consider extracting this common test logic into a shared function or separate file to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
13 changes: 13 additions & 0 deletions test/prompty-dumpty/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# This test verifies that a specific version can be installed

set -e

source dev-container-features-test-lib

check "dumpty is executable" bash -c "command -v dumpty"

check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

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

The || true at the end of the version check masks potential failures. If dumpty --version fails, the test will still pass. Consider removing || true to ensure the command actually succeeds, or add explicit validation of the output.

Suggested change
check "dumpty version command works" bash -c "dumpty --version 2>&1 || true"
check "dumpty version command works" bash -c "dumpty --version 2>&1"

Copilot uses AI. Check for mistakes.

reportResults