-
-
Notifications
You must be signed in to change notification settings - Fork 516
Improved devcontainer setup with e2e test mini infra #2672
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
Merged
+2,346
−79
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a62b534
Add Gemfile.dev as the shared Gemfile for dev
solnic acb8194
Add e2e mini apps with devcontainer setup
solnic 3e748c7
Add a basic e2e spec for tracing
solnic 723303f
Add build_images workflow
solnic a77d6dd
Add e2e test workflow
solnic 620a5ba
Helpers for e2e tests
solnic d161427
Small clean up
solnic 1203a5a
Bump docker tag
solnic 9cc2d4d
WIP
solnic cb4f086
Update .gitignore
solnic bcf7111
Remove obsolete vite setting
solnic 0e420d4
Fix git dir issue
solnic d2d8608
WIP
solnic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
IMAGE=bitnami/ruby | ||
# Official Ruby images | ||
IMAGE="ruby:3.4.5-slim-bookworm" | ||
VERSION="3.4.5" | ||
|
||
# Adjust as needed | ||
TAG=3.4 | ||
# IMAGE="jruby:latest" | ||
|
||
# IMAGE=jruby | ||
# TAG=latest | ||
# E2E testing | ||
SENTRY_DSN="http://user:[email protected]/project/42" | ||
SENTRY_DSN_JS="http://user:[email protected]/project/43" | ||
|
||
SENTRY_E2E_RAILS_APP_PORT=4000 | ||
SENTRY_E2E_SVELTE_APP_PORT=4001 | ||
|
||
SENTRY_E2E_RAILS_APP_URL="http://localhost:4000" | ||
SENTRY_E2E_SVELTE_APP_URL="http://localhost:4001" | ||
|
||
# Faster builds with compose | ||
COMPOSE_BAKE=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
{ | ||
"name": "sentry-ruby", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"service": "sentry-dev", | ||
"workspaceFolder": "/workspace/sentry", | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli": {}, | ||
"ghcr.io/nils-geistmann/devcontainers-features/zsh": {}, | ||
"ghcr.io/devcontainers-extra/features/npm-packages": {}, | ||
"ghcr.io/rocker-org/devcontainer-features/apt-packages": { | ||
"packages": "inotify-tools" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"sleistner.vscode-fileutils", | ||
"Shopify.ruby-lsp" | ||
], | ||
"settings": {} | ||
}, | ||
"rubyLsp.rubyVersionManager": { | ||
"identifier": "none" | ||
"editor.formatOnSaveMode": "modifications", | ||
"editor.formatOnSave": true, | ||
"rubyLsp.rubyVersionManager": { | ||
"identifier": "auto" | ||
}, | ||
"rubyLsp.formatter": "auto" | ||
} | ||
}, | ||
"remoteUser": "sentry", | ||
"postCreateCommand": "ruby --version" | ||
"remoteUser": "sentry" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd /workspace/sentry | ||
|
||
sudo mkdir -p vendor/gems | ||
sudo chown -R sentry:sentry vendor/gems | ||
|
||
git config --global --add safe.directory /workspace/sentry | ||
git config --global --add safe.directory /workspace/sentry/vendor/gems/* | ||
|
||
sudo chown -R sentry:sentry . | ||
|
||
run_service_setup() { | ||
local service="$1" | ||
|
||
echo "🚀 Running setup for service: $service" | ||
|
||
case "$service" in | ||
"dev") | ||
if ! .devcontainer/setup --with-foreman --only-bundle; then | ||
echo "❌ Setup failed for service: $service" | ||
exit 1 | ||
fi | ||
;; | ||
"test") | ||
if ! .devcontainer/setup --with-foreman --only .,spec/apps/rails-mini; then | ||
echo "❌ Setup failed for service: $service" | ||
exit 1 | ||
fi | ||
;; | ||
*) | ||
echo "❌ Unknown service: $service" | ||
echo "Available services: dev, test" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
echo "✅ Setup completed for service: $service" | ||
} | ||
|
||
# Function to start services in background | ||
start_services_if_needed() { | ||
# Check if we're running tests (bundle exec rake) | ||
if [[ "$*" == *"bundle exec rake"* ]]; then | ||
echo "🚀 Starting e2e services in background for test execution..." | ||
|
||
# Start foreman in background | ||
foreman start & | ||
FOREMAN_PID=$! | ||
|
||
# Wait for services to be ready | ||
echo "⏳ Waiting for services to start..." | ||
for i in {1..30}; do | ||
if curl -f http://localhost:4000/health >/dev/null 2>&1 && \ | ||
curl -f http://localhost:4001/health >/dev/null 2>&1; then | ||
echo "✅ Services are ready!" | ||
break | ||
fi | ||
|
||
if [ $i -eq 30 ]; then | ||
echo "❌ Services failed to start within timeout" | ||
kill $FOREMAN_PID 2>/dev/null || true | ||
exit 1 | ||
fi | ||
|
||
sleep 2 | ||
done | ||
|
||
# Set up cleanup trap | ||
trap "echo '🧹 Stopping services...'; kill $FOREMAN_PID 2>/dev/null || true; wait $FOREMAN_PID 2>/dev/null || true" EXIT | ||
fi | ||
} | ||
|
||
# Parse arguments | ||
if [ "$1" = "--service" ] && [ -n "$2" ]; then | ||
service="$2" | ||
shift 2 | ||
|
||
run_service_setup "$service" | ||
|
||
if [ $# -gt 0 ]; then | ||
start_services_if_needed "$@" | ||
exec "$@" | ||
else | ||
exec bash | ||
fi | ||
else | ||
start_services_if_needed "$@" | ||
exec "$@" | ||
fi |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.