-
-
Notifications
You must be signed in to change notification settings - Fork 537
refa(devcontainer): rework to use mise for fast switching #2948
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
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
43b4e70
refa(devcontainer): rework to use mise for fast switching
solnic 7df491c
fix(ci): update workflows for mise-based devcontainer
solnic d6cd2e6
fix(e2e): use playwright-managed chromium
solnic ced5fca
refa(workflows): update build_images and e2e_tests for Ruby 4.0 and 3.4
solnic c157829
fix(devcontainer): set DEBIAN_FRONTEND to noninteractive for apt-get …
solnic 2cd8c42
fix(devcontainer): correct mise command usage in entrypoint script
solnic fcca3ee
fix(devcontainer): remove unnecessary trust command from entrypoint s…
solnic d4888c1
fix(e2e): use dynamic IMAGE_TAG for Docker image in e2e tests
solnic 4ba7828
fix(devcontainer): set DEBIAN_FRONTEND environment variable before ap…
solnic a184ffb
fix(devcontainer): comment out pull_request trigger in build_images.yml
solnic 3f0330c
fix(devcontainer): update base image and Ruby version in .env.example
solnic 9929d92
fix(devcontainer): versioned containers
solnic 5406008
fix(devcontainer): enable manual workflow dispatch and clean up comments
solnic b6e5dbd
fix(devcontainer): update image tagging to use version from .devconta…
solnic d4b3958
fix(devcontainer): add comments for triggering workflow in topic bran…
solnic 7b423cd
fix(devcontainer): update BASE_IMAGE to use Ubuntu 24.04
solnic 7b6ef3a
fix(devcontainer): clean up .env.example by removing legacy comments …
solnic c5e368a
fix(devcontainer): add e2e profile to sentry-test service and update …
solnic f1827bc
fix(devcontainer): pre-install Java 21 in Dockerfile for JRuby support
solnic 8d20a8c
chore(mise): set ruby version to 'ruby@latest' and add java version t…
solnic 26662b2
fix(devcontainer): pre-install precompiled Ruby version in Dockerfile
solnic 9c27785
chore(devcontainer): remove dead method from setup
solnic 8c37a2a
refa(devcontainer): install ruby only as part of the build process
solnic 3a28d0f
fix(devcontainer): widen glob for finding chrome bin for capybara sym…
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
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 @@ | ||
| 1 |
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,29 @@ | ||
| { | ||
| "features": { | ||
| "ghcr.io/devcontainers-extra/features/npm-packages:latest": { | ||
| "version": "1.0.1", | ||
| "resolved": "ghcr.io/devcontainers-extra/features/npm-packages@sha256:0851cc312204f4044f22230986134026409565f9e632d8ab2b8c639e81cedd7c", | ||
| "integrity": "sha256:0851cc312204f4044f22230986134026409565f9e632d8ab2b8c639e81cedd7c" | ||
| }, | ||
| "ghcr.io/devcontainers/features/github-cli:latest": { | ||
| "version": "1.1.0", | ||
| "resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671", | ||
| "integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671" | ||
| }, | ||
| "ghcr.io/devcontainers/features/node:latest": { | ||
| "version": "2.0.0", | ||
| "resolved": "ghcr.io/devcontainers/features/node@sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f", | ||
| "integrity": "sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f" | ||
| }, | ||
| "ghcr.io/nils-geistmann/devcontainers-features/zsh:latest": { | ||
| "version": "0.0.8", | ||
| "resolved": "ghcr.io/nils-geistmann/devcontainers-features/zsh@sha256:fd57a61a5187480b5e73f8041be5b67005be48f06503736df6cfdd8d0f38f3c4", | ||
| "integrity": "sha256:fd57a61a5187480b5e73f8041be5b67005be48f06503736df6cfdd8d0f38f3c4" | ||
| }, | ||
| "ghcr.io/rocker-org/devcontainer-features/apt-packages:latest": { | ||
| "version": "1.0.2", | ||
| "resolved": "ghcr.io/rocker-org/devcontainer-features/apt-packages@sha256:87a4d7750a596a5db034ba8508782f31aebdc2ffe955c66aaecb33d9de2ecdae", | ||
| "integrity": "sha256:87a4d7750a596a5db034ba8508782f31aebdc2ffe955c66aaecb33d9de2ecdae" | ||
| } | ||
| } | ||
| } |
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
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,92 +1,35 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
| # | ||
| # Container entrypoint. Ruby and other toolchains are pre-installed in the | ||
| # image; this script only handles per-run setup (ownership, mise activation) | ||
| # and hands off to whatever docker-compose passes as `command`. | ||
| # | ||
| set -euo pipefail | ||
|
|
||
| cd /workspace/sentry | ||
|
|
||
| sudo mkdir -p vendor/gems | ||
| sudo chown -R sentry:sentry vendor/gems | ||
|
|
||
| # git config --global --replace-all safe.directory /workspace/sentry | ||
| # git config --global --replace-all 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 | ||
| # In CI the workspace is checked out by the runner user (e.g. UID 1001) and | ||
| # then bind-mounted into the container where we run as sentry (UID 1000). | ||
| # Fix ownership once here so bundler, git, etc. can write freely. | ||
| sudo chown -R sentry:sentry /workspace/sentry 2>/dev/null || true | ||
| MISE_BIN="/home/sentry/.local/bin/mise" | ||
|
|
||
| echo "✅ Setup completed for service: $service" | ||
| } | ||
| # Git also refuses to operate in directories owned by a different user. | ||
| git config --global --add safe.directory /workspace/sentry 2>/dev/null || true | ||
|
|
||
| # 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 | ||
| } | ||
| if [[ ! -x "$MISE_BIN" ]]; then | ||
| echo "❌ mise not found at $MISE_BIN (it should be installed by the Dockerfile)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Parse arguments | ||
| if [ "$1" = "--service" ] && [ -n "$2" ]; then | ||
| service="$2" | ||
| shift 2 | ||
| # Activate mise for this shell so PATH/shims are resolved correctly. | ||
| eval "$("$MISE_BIN" activate bash)" | ||
|
|
||
| run_service_setup "$service" | ||
| # Trust the workspace config so mise will use it without prompting. | ||
| "$MISE_BIN" trust /workspace/sentry >/dev/null | ||
|
|
||
| if [ $# -gt 0 ]; then | ||
| start_services_if_needed "$@" | ||
| exec "$@" | ||
| else | ||
| exec bash | ||
| fi | ||
| if [[ $# -eq 0 ]]; then | ||
| exec sleep infinity | ||
| else | ||
| start_services_if_needed "$@" | ||
| exec "$@" | ||
| fi |
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
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.