Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add internal-introspection feature #419

Merged
merged 1 commit into from
Mar 21, 2025
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/features-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- dev-tools
- elasticsearch
- entrypoints
- internal-introspection
- php
- mailpit
- mariadb
Expand Down
12 changes: 12 additions & 0 deletions features/src/internal-introspection/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"id": "internal-introspection",
"name": "Internal Introspection",
"description": "For internal use only! Do not use!",
"version": "1.0.0",
"entrypoint": "/usr/local/bin/internal-introspection-ep.sh",
"onCreateCommand": "/usr/local/bin/internal-introspection-on-create.sh",
"postCreateCommand": "/usr/local/bin/internal-introspection-post-create.sh",
"postStartCommand": "/usr/local/bin/internal-introspection-post-start.sh",
"postAttachCommand": "/usr/local/bin/internal-introspection-post-attach.sh",
"updateContentCommand": "/usr/local/bin/internal-introspection-update-content.sh"
}
14 changes: 14 additions & 0 deletions features/src/internal-introspection/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin

if [ "$(id -u || true)" -ne 0 ]; then
echo 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi

install -m 0755 -o root -g root internal-introspection-ep.sh internal-introspection-on-create.sh internal-introspection-post-create.sh internal-introspection-post-start.sh internal-introspection-post-attach.sh internal-introspection-update-content.sh /usr/local/bin/

install -d -D -m 0777 /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection
env | sort > /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/build.env
pwd > /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/build.pwd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

env | sort > /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/entrypoint.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

{ env | sort; echo; echo; } >> /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/on-create.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

{ env | sort; echo; echo; } >> /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/post-attach.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

{ env | sort; echo; echo; } >> /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/post-create.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

{ env | sort; echo; echo; } >> /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/post-start.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

{ env | sort; echo; echo; } >> /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/update-content.env
19 changes: 19 additions & 0 deletions features/test/internal-introspection/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# shellcheck source=/dev/null
source dev-container-features-test-lib

check "/usr/local/bin/internal-introspection-ep.sh exists and is executable" test -x /usr/local/bin/internal-introspection-ep.sh
check "/usr/local/bin/internal-introspection-on-create.sh exists and is executable" test -x /usr/local/bin/internal-introspection-on-create.sh
check "/usr/local/bin/internal-introspection-post-create.sh exists and is executable" test -x /usr/local/bin/internal-introspection-post-create.sh
check "/usr/local/bin/internal-introspection-post-start.sh exists and is executable" test -x /usr/local/bin/internal-introspection-post-start.sh
check "/usr/local/bin/internal-introspection-post-attach.sh exists and is executable" test -x /usr/local/bin/internal-introspection-post-attach.sh
check "/usr/local/bin/internal-introspection-update-content.sh exists and is executable" test -x /usr/local/bin/internal-introspection-update-content.sh

for i in /usr/local/etc/vscode-dev-containers/vip-codespaces/internal-introspection/*.env; do
echo "=== ${i}"
cat "${i}"
echo
done

reportResults