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
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- go-ebpf
- go-mod-upgrade
- goreportcard
- lazygit
- local-pkgsite
- nerdctl
- pin-github-action
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ unfortunately only to the limitation of different distribution support in Dev
Containers features we rely on. In case of Go tools, this unfortunately leaves
out Alpine, because [Microsoft's Go Dev Container feature does not support
Alpine](https://github.com/devcontainers/features/blob/091886b3568dad70f835cc428dad1fdf7bc6a9b3/src/go/install.sh#L32-L44).
Same unfortunate situation Microsoft's node Dev Container feature that also
doesn't support Alpine.

| Feature | Alpine | Alma | Debian | Fedora | Ubuntu |
| ----------------- | ------ | ---- | ------ | ------ | ------ |
| bpftool | ✅ | ✅ | ✅ | ✅ | ✅ |
| cni-plugins | | ✅ | ✅ | ✅ | ✅ |
| docsify | | ✅ | ✅ | ✅ | ✅ |
| go-ebpf | | ✅ | ✅ | ✅ | ✅ |
| go-mod-upgrade | | ✅ | ✅ | ✅ | ✅ |
| gocover | | ✅ | ✅ | ✅ | ✅ |
| goreportcard | | ✅ | ✅ | ✅ | ✅ |
| grafanactl | ✅ | ✅ | ✅ | ✅ | ✅ |
| lazygit | ✅ | ✅ | ✅ | ✅ | ✅ |
| local-pkgsite | | ✅ | ✅ | ✅ | ✅ |
| nerdctl | | ✅ | ✅ | ✅ | ✅ |
| pin-github-action | | ✅ | ✅ | ✅ | ✅ |
| wal-wahl | | ✅ | ✅ | ✅ | ✅ |

- [bpftool](src/bpftool/README.md) – installs `bpftool` directly from upstream
https://github.com/libbpf/bpftool binary releases, especially avoiding the
Expand Down Expand Up @@ -40,6 +58,9 @@ Alpine](https://github.com/devcontainers/features/blob/091886b3568dad70f835cc428
creates a Go report and a `README.md` badge on the code quality of a
repository.

- [lazygit](src/lazygit/README.md) – installs `lazygit` directly from upstream
https://github.com/jesseduffield/lazygit binary releases.

- [local-pkgsite](src/local-pkgsite/README.md) – a local Go pkgsite serving the
module documentation, with automatic project reload and browser refresh.

Expand Down
1 change: 1 addition & 0 deletions src/bpftool/NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## OS Support

Tested with:
- [mcr.microsoft.com/devcontainers/base:alpine](mcr.microsoft.com/devcontainers/base:alpine),
- [ghcr.io/almalinux/almalinux](https://ghcr.io/almalinux/almalinux),
- [mcr.microsoft.com/devcontainers/base:debian](https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/base/about#about:_debian),
- [fedora](https://hub.docker.com/_/fedora),
Expand Down
1 change: 1 addition & 0 deletions src/bpftool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Installs bpftool from upstream https://github.com/libbpf/bpftool binary releases
## OS Support

Tested with:
- [mcr.microsoft.com/devcontainers/base:alpine](mcr.microsoft.com/devcontainers/base:alpine),
- [ghcr.io/almalinux/almalinux](https://ghcr.io/almalinux/almalinux),
- [mcr.microsoft.com/devcontainers/base:debian](https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/base/about#about:_debian),
- [fedora](https://hub.docker.com/_/fedora),
Expand Down
2 changes: 1 addition & 1 deletion src/bpftool/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bpftool",
"id": "bpftool",
"version": "0.0.2",
"version": "0.0.3",
"description": "Installs bpftool from upstream https://github.com/libbpf/bpftool binary releases.",
"options": {
"version": {
Expand Down
32 changes: 28 additions & 4 deletions src/bpftool/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ set -e

BPFTOOL_VERSION="${VERSION:-"latest"}"

REPOSLUG="libbpf/bpftool"
QUERYLATEST_URL="https://api.github.com/repos/${REPOSLUG}/releases/latest"
RELEASE_URL="https://github.com/${REPOSLUG}/releases/download/"

echo "installing feature bpftool..."

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -25,6 +29,8 @@ fi
MAJOR_VERSION_ID=$(echo ${VERSION_ID} | cut -d . -f 1)
if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then
ADJUSTED_ID="debian"
elif [ "${ID}" = "alpine" ]; then
ADJUSTED_ID="alpine"
elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then
ADJUSTED_ID="rhel"
if [[ "${ID}" = "rhel" ]] || [[ "${ID}" = *"alma"* ]] || [[ "${ID}" = *"rocky"* ]]; then
Expand All @@ -49,6 +55,9 @@ fi
if type apt-get > /dev/null 2>&1; then
PKG_MGR_CMD=apt-get
INSTALL_CMD="${PKG_MGR_CMD} -y install --no-install-recommends"
elif type apk > /dev/null 2>&1; then
PKG_MGR_CMD=apk
INSTALL_CMD="${PKG_MGR_CMD} add --no-interactive"
elif type microdnf > /dev/null 2>&1; then
PKG_MGR_CMD=microdnf
INSTALL_CMD="${PKG_MGR_CMD} ${INSTALL_CMD_ADDL_REPOS} -y install --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0"
Expand All @@ -63,6 +72,9 @@ fi
# Clean up
clean_up() {
case ${ADJUSTED_ID} in
alpine)
rm -rf /var/cache/apk/*
;;
debian)
rm -rf /var/lib/apt/lists/*
;;
Expand All @@ -77,6 +89,12 @@ clean_up

pkg_mgr_update() {
case $ADJUSTED_ID in
alpine)
if [ "$(find /var/cache/apk/* | wc -l)" = "0" ]; then
echo "Running apk update..."
${PKG_MGR_CMD} update
fi
;;
debian)
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
Expand Down Expand Up @@ -108,6 +126,9 @@ pkg_mgr_update() {
# Checks if packages are installed and installs them if not
check_packages() {
case ${ADJUSTED_ID} in
alpine)
${INSTALL_CMD} "$@"
;;
debian)
if ! dpkg -s "$@" > /dev/null 2>&1; then
pkg_mgr_update
Expand Down Expand Up @@ -137,13 +158,16 @@ fi

if [ "$BPFTOOL_VERSION" = "latest" ]; then
# get latest release
BPFTOOL_VERSION=$(curl -s https://api.github.com/repos/libbpf/bpftool/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
BPFTOOL_VERSION=$(curl -s ${QUERYLATEST_URL} | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
fi

echo $BPFTOOL_VERSION
echo $ARCH
echo "installing bpftool version: ${BPFTOOL_VERSION}"
echo "for architecture ${ARCH}"

URL="${RELEASE_URL}${BPFTOOL_VERSION}/bpftool-${BPFTOOL_VERSION}-${ARCH}.tar.gz"
echo "from: ${URL}"

curl -sSL -o /tmp/bpftool.tar.gz "https://github.com/libbpf/bpftool/releases/download/${BPFTOOL_VERSION}/bpftool-${BPFTOOL_VERSION}-${ARCH}.tar.gz"
curl -sSL -o /tmp/bpftool.tar.gz "${URL}"
ls -l /tmp/bpftool.tar.gz
tar xzof /tmp/bpftool.tar.gz -C /usr/local/bin/ bpftool
chmod 0755 /usr/local/bin/bpftool
Expand Down
2 changes: 1 addition & 1 deletion src/grafanactl/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grafanactl",
"id": "grafanactl",
"version": "0.0.1",
"version": "0.0.2",
"description": "Installs grafanactl from upstream https://github.com/grafana/grafanactl binary releases.",
"options": {
"version": {
Expand Down
32 changes: 27 additions & 5 deletions src/grafanactl/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ set -e

GRAFANACTL_VERSION="${VERSION:-"latest"}"

REPOSLUG="grafana/grafanactl"
QUERYLATEST_URL="https://api.github.com/repos/${REPOSLUG}/releases/latest"
RELEASE_URL="https://github.com/${REPOSLUG}/releases/download/"

echo "installing feature grafanactl..."

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -25,6 +29,8 @@ fi
MAJOR_VERSION_ID=$(echo ${VERSION_ID} | cut -d . -f 1)
if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then
ADJUSTED_ID="debian"
elif [ "${ID}" = "alpine" ]; then
ADJUSTED_ID="alpine"
elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then
ADJUSTED_ID="rhel"
if [[ "${ID}" = "rhel" ]] || [[ "${ID}" = *"alma"* ]] || [[ "${ID}" = *"rocky"* ]]; then
Expand All @@ -49,6 +55,9 @@ fi
if type apt-get > /dev/null 2>&1; then
PKG_MGR_CMD=apt-get
INSTALL_CMD="${PKG_MGR_CMD} -y install --no-install-recommends"
elif type apk > /dev/null 2>&1; then
PKG_MGR_CMD=apk
INSTALL_CMD="${PKG_MGR_CMD} add --no-interactive"
elif type microdnf > /dev/null 2>&1; then
PKG_MGR_CMD=microdnf
INSTALL_CMD="${PKG_MGR_CMD} ${INSTALL_CMD_ADDL_REPOS} -y install --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0"
Expand All @@ -63,6 +72,9 @@ fi
# Clean up
clean_up() {
case ${ADJUSTED_ID} in
alpine)
rm -rf /var/cache/apk/*
;;
debian)
rm -rf /var/lib/apt/lists/*
;;
Expand All @@ -77,6 +89,12 @@ clean_up

pkg_mgr_update() {
case $ADJUSTED_ID in
alpine)
if [ "$(find /var/cache/apk/* | wc -l)" = "0" ]; then
echo "Running apk update..."
${PKG_MGR_CMD} update
fi
;;
debian)
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
Expand Down Expand Up @@ -108,6 +126,9 @@ pkg_mgr_update() {
# Checks if packages are installed and installs them if not
check_packages() {
case ${ADJUSTED_ID} in
alpine)
${INSTALL_CMD} "$@"
;;
debian)
if ! dpkg -s "$@" > /dev/null 2>&1; then
pkg_mgr_update
Expand Down Expand Up @@ -137,15 +158,16 @@ fi

if [ "$GRAFANACTL_VERSION" = "latest" ]; then
# get latest release
GRAFANACTL_VERSION=$(curl -s https://api.github.com/repos/grafana/grafanactl/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
GRAFANACTL_VERSION=$(curl -s ${QUERYLATEST_URL} | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
fi

echo version: $GRAFANACTL_VERSION
echo for arch: $ARCH
echo "installing grafanactl version: ${GRAFANACTL_VERSION}"
echo "for architecture: ${ARCH}"

echo "https://github.com/grafana/grafanactl/releases/download/${GRAFANACTL_VERSION}/grafanactl_Linux_${ARCH}.tar.gz"
URL="${RELEASE_URL}${GRAFANACTL_VERSION}/grafanactl_Linux_${ARCH}.tar.gz"
echo "from: ${URL}"

curl -sSL -o /tmp/grafanactl.tar.gz "https://github.com/grafana/grafanactl/releases/download/${GRAFANACTL_VERSION}/grafanactl_Linux_${ARCH}.tar.gz"
curl -sSL -o /tmp/grafanactl.tar.gz "${URL}"
ls -lH /tmp/grafanactl.tar.gz
tar xzof /tmp/grafanactl.tar.gz -C /usr/local/bin/ grafanactl
chmod 0755 /usr/local/bin/grafanactl
Expand Down
12 changes: 12 additions & 0 deletions src/lazygit/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## OS Support

Tested with:
- [mcr.microsoft.com/devcontainers/base:alpine](mcr.microsoft.com/devcontainers/base:alpine),
- [ghcr.io/almalinux/almalinux](https://ghcr.io/almalinux/almalinux),
- [mcr.microsoft.com/devcontainers/base:debian](https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/base/about#about:_debian),
- [fedora](https://hub.docker.com/_/fedora),
- [mcr.microsoft.com/devcontainers/base:ubuntu](https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/base/about#about:_ubuntu).

## Acknowledgement

[@bpftool](https://github.com/libbpf/bpftool)
36 changes: 36 additions & 0 deletions src/lazygit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

# lazygit (lazygit)

Installs lazygit from upstream https://github.com/jesseduffield/lazygit binary releases.

## Example Usage

```json
"features": {
"ghcr.io/thediveo/devcontainer-features/lazygit:0": {}
}
```

## Options

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | version of lazygit to install from upstream | string | latest |

## OS Support

Tested with:
- [mcr.microsoft.com/devcontainers/base:alpine](mcr.microsoft.com/devcontainers/base:alpine),
- [ghcr.io/almalinux/almalinux](https://ghcr.io/almalinux/almalinux),
- [mcr.microsoft.com/devcontainers/base:debian](https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/base/about#about:_debian),
- [fedora](https://hub.docker.com/_/fedora),
- [mcr.microsoft.com/devcontainers/base:ubuntu](https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/base/about#about:_ubuntu).

## Acknowledgement

[@bpftool](https://github.com/libbpf/bpftool)


---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/thediveo/devcontainer-features/blob/main/src/lazygit/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
13 changes: 13 additions & 0 deletions src/lazygit/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "lazygit",
"id": "lazygit",
"version": "0.0.1",
"description": "Installs lazygit from upstream https://github.com/jesseduffield/lazygit binary releases.",
"options": {
"version": {
"type": "string",
"default": "latest",
"description": "version of lazygit to install from upstream"
}
}
}
Loading
Loading