Skip to content

Commit

Permalink
chore: setup devcontainer for CLI contributions (#6905)
Browse files Browse the repository at this point in the history
# Description

- This PR adds a new devconatiner configuration with the basic setup to
contribute to the radius project esp. the CLI. It contains the necessary
tools to allow a quick starting point for contributions and bug analysis
and fixing. This complements the setup already available for the
tutorials
- In order to make the debug experience easier, a launch configuration
was added to enable a direct entry into the CLI commands

## Type of change

- This pull request is a minor refactor, code cleanup, test improvement,
or other maintenance task and doesn't change the functionality of
Radius.

Fixes: #6904

## Auto-generated summary

<!--
GitHub Copilot for docs will auto-generate a summary of the PR
-->

<!--
copilot:all
-->
### <samp>🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset)
Generated by Copilot at 40d49d3</samp>

### Summary
🐳🛠️🐛

<!--
1. 🐳 - This emoji represents the use of Docker and devcontainers, as
well as the docker-in-docker feature that allows the devcontainer to run
minikube and other docker commands.
2. 🛠️ - This emoji represents the installation of various tools and
features that enhance the development and testing experience, such as
Go, golangci-lint, git, GitHub CLI, kubectl, helm, and minikube.
3. 🐛 - This emoji represents the ability to debug the Radius CLI using
the Go debugger and the VS Code settings that enable this feature.
-->
This pull request adds new VS Code and devcontainer settings to improve
the development and debugging experience for the Radius CLI project. It
allows contributors to run and debug the `radius` command with different
arguments, and to use various tools and features in a consistent and
isolated environment.

> _We are the coders of the Radius CLI_
> _We build and debug with Go and VS Code_
> _We unleash the power of devcontainer_
> _We run `init --full` to start the adventure_

### Walkthrough
* Add a devcontainer configuration for contributors
([link](https://github.com/radius-project/radius/pull/6905/files?diff=unified&w=0#diff-935f2b2e55e0ab1017fd1c544b9191e499e90e473ece926f8e65e95ddfbb1b1eL1-R30))
* Add a launch configuration for debugging the Radius CLI
([link](https://github.com/radius-project/radius/pull/6905/files?diff=unified&w=0#diff-bd5430ee7c51dc892a67b3f2829d1f5b6d223f0fd48b82322cfd45baf9f5e945R8-R16),
[link](https://github.com/radius-project/radius/pull/6905/files?diff=unified&w=0#diff-bd5430ee7c51dc892a67b3f2829d1f5b6d223f0fd48b82322cfd45baf9f5e945L92-R107))

---------

Signed-off-by: Christian Lechner <[email protected]>
  • Loading branch information
lechnerc77 authored Dec 6, 2023
1 parent ef5c28c commit 84c6a1f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
26 changes: 26 additions & 0 deletions .devcontainer/contributor/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Radius - Contributor",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"minikube": "none"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true
}
},
"customizations": {
"vscode": {
"extensions": [
"redhat.vscode-yaml",
"golang.go",
"ms-azuretools.rad-vscode-bicep",
"ms-kubernetes-tools.vscode-kubernetes-tools"
]
}
}
}
38 changes: 28 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug rad CLI",
"type": "go",
"request": "launch",
"mode": "auto",
"preLaunchTask": "Build Radius (all)",
"program": "${workspaceFolder}/cmd/rad/main.go",
"cwd": "${workspaceFolder}",
"args": [],
},
{
"name": "Debug rad CLI (prompt for args)",
"type": "go",
"request": "launch",
"mode": "debug",
"preLaunchTask": "Build Radius (all)",
"program": "${workspaceFolder}/cmd/rad",
"args": "${input:cliArgs}",
"console": "integratedTerminal",
},
{
"name": "Launch Applications RP",
"type": "go",
Expand Down Expand Up @@ -51,16 +71,6 @@
"RADIUS_ENV": "self-hosted"
}
},
{
"name": "Launch rad CLI",
"type": "go",
"request": "launch",
"mode": "auto",
"preLaunchTask": "Build Radius (all)",
"program": "${workspaceFolder}/cmd/rad/main.go",
"cwd": "${workspaceFolder}",
"args": [],
},
{
"name": "Launch Deployment Engine",
"type": "coreclr",
Expand Down Expand Up @@ -89,5 +99,13 @@
],
"stopAll": true
}
],
"inputs": [
{
"id": "cliArgs",
"type": "promptString",
"description": "Args for launching Radius cli. Use --cwd to set the working directory.",
"default": "init --full"
}
]
}

0 comments on commit 84c6a1f

Please sign in to comment.