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
41 changes: 0 additions & 41 deletions .gic.yaml

This file was deleted.

26 changes: 13 additions & 13 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
## Commit Messages.
# General Instructions

We follow conventional commit specification for commit messages. This means that each commit message should start with a type, followed by an optional scope, and then a description. The types we use are:
- Ensure any code you produce is correct.
- for commit messages use conventional commit format, e.g. `feat: add new feature`, `fix: correct a bug`, `docs: update documentation`, etc. https://www.conventionalcommits.org/en/v1.0.0/

- **feat**: A new feature
- **fix**: A bug fix
- **docs**: Documentation only changes
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**: A code change that improves performance
- **test**: Adding missing or correcting existing tests
- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
- **chore**: Other changes that don't modify src or test files
## New Feature Instructions

More details in here https://www.conventionalcommits.org/en/v1.0.0/
When creating a new feature, follow these steps:
- Update the README.md to include the new feature in the list of features.
- Each feature should be implemented under src/feature-name. Include a devcontainer-feature.json and install.sh file.
- The install.sh file should install the package from the source repository. Not using a package manager like apt.
- Each feature should have a test under test/feature-name/test.sh
- Each feature should include a global test under test/_global/feature-name-specific-version.sh if a specific version can be installed.
- Update the ../../test/_global/all-tools.sh to validate the new feature is installed.
- Update the ../../test/_global/scenarios.json to include the new feature.
- include the feature in the workflows
18 changes: 18 additions & 0 deletions .github/prompts/generate-commit-message.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Generate a Git commit message using the Conventional Commits format. Then, include three --trailer fields:

Assistant-model: The name of the AI model (e.g., GPT-4o)

LLM-Contrib: An estimated percentage of contribution from the AI (e.g., 60%)

Prompt: A brief human instruction or goal (e.g., "Refactor for readability")

Format the final output like this:

bash
Copy
Edit
git commit --message "type(scope): concise description" \
--trailer "Assistant-model: GPT-4o" \
--trailer "LLM-Contrib: 60%" \
--trailer "Prompt: <short description of prompt>"
Use an appropriate Conventional Commit type (like feat, fix, refactor, docs, etc.) and optionally include a scope if relevant.
14 changes: 0 additions & 14 deletions .github/prompts/new-feature.prompt.md

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- skopeo
- uv
- codex
- bat
baseImage:
- debian:latest
- ubuntu:latest
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This repository contains a _collection_ of Features.

| Name | URL | Description |
| --- | --- | --- |
| bat | https://github.com/sharkdp/bat | A cat(1) clone with syntax highlighting and Git integration. |
| flux | https://fluxcd.io/flux/installation/ | Flux is a tool for keeping Kubernetes clusters in sync with sources of configuration |
| notation | https://notaryproject.dev/ | Notation is a CLI project to add signatures as standard items in the registry ecosystem, and to build a set of simple tooling for signing and verifying these signatures. This should be viewed as similar security to checking git commit signatures, although the signatures are generic and can be used for additional purposes. Notation is an implementation of the Notary v2 specifications.|
| crane | https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md | crane is a tool for interacting with remote images and registries.|
Expand All @@ -26,6 +27,23 @@ This repository contains a _collection_ of Features.



### `bat`

Running `bat` inside the built container will print the help menu of bat.

```jsonc
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/jsburckhardt/devcontainer-features/bat:1": {}
}
}
```

```bash
bat --version
```

### `flux`

Running `flux` inside the built container will print the help menu of flux.
Expand Down
13 changes: 13 additions & 0 deletions src/bat/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "bat",
"id": "bat",
"version": "1.0.0",
"description": "A cat(1) clone with syntax highlighting and Git integration.",
"options": {
"version": {
"type": "string",
"default": "latest",
"description": "Version of bat to install from GitHub releases e.g. v0.22.0"
}
}
}
120 changes: 120 additions & 0 deletions src/bat/install.sh
Comment thread
jsburckhardt marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env bash

# Variables
REPO_OWNER="sharkdp"
REPO_NAME="bat"
BINARY_NAME="bat"
BAT_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

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.'
exit 1
fi

# Clean up
rm -rf /var/lib/apt/lists/*

# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
apt-get -y install --no-install-recommends "$@"
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates

# Function to get the latest version from GitHub API
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
}

# Check if a version is passed as an argument
if [ -z "$BAT_VERSION" ] || [ "$BAT_VERSION" == "latest" ]; then
# No version provided, get the latest version
BAT_VERSION=$(get_latest_version)
echo "No version provided or 'latest' specified, installing the latest version: $BAT_VERSION"
else
echo "Installing version from environment variable: $BAT_VERSION"
fi

# Determine the OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

case "$ARCH" in
x86_64)
ARCH="x86_64"
;;
i686)
ARCH="i686"
;;
aarch64)
ARCH="aarch64"
;;
armv7l)
ARCH="arm-unknown"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac

case "$OS" in
linux)
OS="unknown-linux-gnu"
;;
darwin)
OS="apple-darwin"
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac

# Construct the download URL
DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${BAT_VERSION}/bat-${BAT_VERSION}-${ARCH}-${OS}.tar.gz"

# Create a temporary directory for the download
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR" || exit

echo "Downloading bat from $DOWNLOAD_URL"
curl -sSL "$DOWNLOAD_URL" -o "bat.tar.gz"

# Extract the tarball
echo "Extracting bat..."
tar -xzf "bat.tar.gz"

# Find the extracted directory (it should match the archive name pattern)
EXTRACTED_DIR=$(find . -name "bat-${BAT_VERSION}-*" -type d | head -1)
if [ -z "$EXTRACTED_DIR" ]; then
echo "ERROR: Could not find extracted bat directory"
exit 1
fi

# Move the binary to /usr/local/bin
echo "Installing bat..."
mv "${EXTRACTED_DIR}/bat" /usr/local/bin/

# Cleanup
cd - || exit
rm -rf "$TMP_DIR"

# Clean up
rm -rf /var/lib/apt/lists/*

# Verify installation
echo "Verifying installation..."
bat --version

echo "Done!"
1 change: 1 addition & 0 deletions test/_global/all-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e
source dev-container-features-test-lib
check "bat" bat --version
check "flux" flux version --client
check "notation" notation version
check "crane" crane version
Expand Down
7 changes: 7 additions & 0 deletions test/_global/bat-specific-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e
source dev-container-features-test-lib
check "bat with specific version" /bin/bash -c "bat --version | grep '0.25.0'"

reportResults
2 changes: 1 addition & 1 deletion test/_global/flux-specific-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -e
source dev-container-features-test-lib
check "flux with specific version" /bin/bash -c "flux version --client | grep 'v0.37.0'"
check "flux with specific version" /bin/bash -c "flux version --client | grep 'v2.6.4'"

reportResults
2 changes: 1 addition & 1 deletion test/_global/gitleaks-specific-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -e
source dev-container-features-test-lib
check "gitleaks with specific version" /bin/bash -c "gitleaks version | grep '8.17.0'"
check "gitleaks with specific version" /bin/bash -c "gitleaks version | grep '8.28.0'"

reportResults
13 changes: 11 additions & 2 deletions test/_global/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"all-tools": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"bat": {},
"copa": {},
"crane": {},
"cyclonedx": {},
Expand All @@ -23,7 +24,7 @@
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"flux": {
"version": "v0.37.0"
"version": "v2.6.4"
}
}
},
Expand Down Expand Up @@ -87,7 +88,7 @@
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"gitleaks": {
"version": "v8.17.0"
"version": "v8.28.0"
}
}
},
Expand Down Expand Up @@ -120,5 +121,13 @@
"version": "v5.6.0"
}
}
},
"bat-specific-version": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"bat": {
"version": "v0.25.0"
}
}
}
}
7 changes: 7 additions & 0 deletions test/bat/test.sh
Comment thread
jsburckhardt marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

source dev-container-features-test-lib
check "bat" bat -h
reportResults