-
Notifications
You must be signed in to change notification settings - Fork 120
Automated debug environment #10054
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
base: main
Are you sure you want to change the base?
Automated debug environment #10054
Conversation
63884e3 to
75be672
Compare
Radius functional test overview
Click here to see the list of tools in the current test run
Test Status⌛ Building Radius and pushing container images for functional tests... |
f30f6b8 to
94e224e
Compare
94e224e to
3acaa26
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10054 +/- ##
=======================================
Coverage 50.43% 50.44%
=======================================
Files 672 672
Lines 42057 42057
=======================================
+ Hits 21213 21217 +4
+ Misses 18788 18786 -2
+ Partials 2056 2054 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
brooke-hamilton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR creates a /build/scripts folder for scripts used by the Make commands. Let's move all the scripts to that folder as part of this PR so that the pattern is consistently implemented.
Running make debug-start resulted in an error. The end of the console output is below. Is this a side-effect of me not having Postgres set up as a local service? Should we run Postgres in the cluster, or is there an advantage to having it running as a local service?
Starting Radius components as OS processes...
🚀 Starting Radius components...
Checking for existing components and stopping them...
✅ Cleanup complete
🗄️ Initializing PostgreSQL database...
⚠️ psql not available - database may not be properly initialized
Starting UCP with dlv on port 40001...
build/scripts/start-radius.sh: line 108: /workspace/radius-project/pr-10054/debug_files/logs/ucp.pid: No such file or directory
make: *** [build/debug.mk:141: debug-start] Error 1
I added some comments to the files. I will finish reviewing it when I get the debugging process to work.
.../contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
Show resolved
Hide resolved
.../contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
Outdated
Show resolved
Hide resolved
.../contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
Outdated
Show resolved
Hide resolved
.../contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
Outdated
Show resolved
Hide resolved
40cbe4a to
f88b8d2
Compare
f88b8d2 to
ac8ad38
Compare
ac8ad38 to
4d6feb9
Compare
|
@brooke-hamilton did a major doc overhaul, cleaned up make targets, answered some questions, I think the doc overhaul answers a lot too as I ended up cutting half of it because I automated away most of the steps I had documented early on. |
Radius functional test overview
Click here to see the list of tools in the current test run
Test Status⌛ Building Radius and pushing container images for functional tests... |
brooke-hamilton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇 I was able to reliably run make debug-start, make debug-status, and make debug-stop. The drad command works very well. Just a few very minor comments below.
|
|
||
| 3. **Code Changes**: | ||
| - Make your code changes | ||
| - Use rebuild/restart tasks: Ctrl+Shift+P → "Tasks: Run Task" → "Rebuild and Restart [Component]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a task named "Rebuild and Restart [Component]"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to attach a debugger to the CLI using the configurations in this file, but I was not able to effectively debug any CLI command that has interactive input, like rad init. This may be an issue with the CLI framework we use rather than this particular configuration. (This is just a comment, not a request for a fix.)
|
|
||
| **CLI Debugging Options:** | ||
| - **Use `./drad` for convenience**: When you only need to test CLI commands against the debug environment without debugging the CLI code itself | ||
| - **Use "Debug drad CLI (debug environment)" in VS Code**: When you need to debug CLI code with breakpoints, variable inspection, and step-through debugging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the debug configurations "Debug rad CLI" and "Debug rad CLI (prompt for args)" used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the legacy launch config I have no idea why there's a non prompt version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: If we have something legacy that probably nobody using, lets remove it from the codebase.
|
|
||
| **Method A: VS Code Process Picker** | ||
| - Open Debug panel and select "Attach to [Component]" | ||
| - Press F5 - VS Code will show a process picker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A process picker does not open for me, but VS code appears to be running with the debugger attached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the "Attach to..." with dlv port options, maybe the process picker is a confusing term?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: when running make debug-start there are a few console messages like this:
make[3]: Leaving directory '/mnt/wsl/workspace/radius-project/radius'
make[3]: Entering directory '/mnt/wsl/workspace/radius-project/radius'Adding this to the top of debug.mk would suppress them:
MAKEFLAGS += --no-print-directory|
Tested existing debug method: UCP service is started up successfully but the remaining Applications RP, Controller and Dynamic RP all fail at startup with error messages (clipped): |
Co-authored-by: Brooke Hamilton <[email protected]> Signed-off-by: Sylvain Niles <[email protected]>
…o automated-debug-environment
DariuszPorowski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments in the code, and I was unsuccessful to attach/debug :( I tried basic CLI drad version and set the breakpoint the main.go (for rad cmd).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick(style): lint/format of this file will cause better readability, now big one-liners are hard to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: Love it!
| ### Setup Commands | ||
| ```bash | ||
| # Start all components as OS processes with debugging (Checks prereqs and creates necessary folders) | ||
| make debug-start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Have you considered (or maybe even tried?) to skip this manual step? and have "F5" experience only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to require contributors to use VS Code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do have F5 tasks for stop and start though.
| echo " Please ensure:"; \ | ||
| echo " 1. PostgreSQL is running on localhost:5432"; \ | ||
| echo " 2. Either Docker PostgreSQL (postgres/radius_pass) or local user access"; \ | ||
| echo " 3. Quick start: docker run --name radius-postgres -e POSTGRES_PASSWORD=radius_pass -p 5432:5432 -d postgres:15"; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: postgres 15 is quite old... (5 years or more?), the current one is 18 - maybe you can consider the latest one if it is compatible with radius. postgres:15, postgres:14 and even postgres:latest exist in a few places in the codebase.
|
|
||
| **CLI Debugging Options:** | ||
| - **Use `./drad` for convenience**: When you only need to test CLI commands against the debug environment without debugging the CLI code itself | ||
| - **Use "Debug drad CLI (debug environment)" in VS Code**: When you need to debug CLI code with breakpoints, variable inspection, and step-through debugging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: If we have something legacy that probably nobody using, lets remove it from the codebase.
.../contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
Outdated
Show resolved
Hide resolved
.../contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
Outdated
Show resolved
Hide resolved
.../contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Sylvain Niles <[email protected]>
…g/radius-os-processes-debugging.md Co-authored-by: Dariusz Porowski <[email protected]> Signed-off-by: Sylvain Niles <[email protected]>
Signed-off-by: Sylvain Niles <[email protected]>
…o automated-debug-environment
Signed-off-by: Sylvain Niles <[email protected]>
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Description
This branch introduces a comprehensive local debugging environment for Radius, designed to streamline the development workflow by running core Go components as local OS processes. Instead of deploying services like UCP and the various resource providers into a Kubernetes cluster, the make debug-start command compiles them with debug symbols and runs them directly on your machine. This approach provides developers with the powerful ability to attach a debugger, such as Delve, to any running Radius component, enabling live code inspection, breakpoint debugging, and rapid iteration without the overhead of container builds and deployments. Additionally it has a fully-integrated VS Code debugging experience for Radius development. Just run
make debug-startset your breakpoints, and attach the debugger to whichever component you're working on. The system still leverages a lightweight k3d cluster for Kubernetes-native dependencies, providing a hybrid environment that combines the fidelity of a real cluster with the convenience of local process debugging.The debug environment is engineered to be fully automated and idempotent, ensuring a consistent and clean state with every run. The debug-start target handles all setup, from creating the k3d cluster and building binaries to starting processes and initializing the Radius environment. Furthermore it creates an alias
dradto the debugger compiled CLI in order to not interfere with your installed rad CLI. To guarantee a pristine workspace, the make debug-stop command completely tears down all components, including the cluster and its associated data, preventing state-related bugs between debugging sessions. This repeatable and reliable workflow significantly enhances productivity by providing a fast and simple "inner loop" for development and testing. For detailed usage instructions see local debuggingType of change