From 6016160e17feafafe816adde89f359c2080201ed Mon Sep 17 00:00:00 2001 From: Christian Lechner Date: Thu, 14 Dec 2023 19:20:41 +0100 Subject: [PATCH] chore: improve setup of devconatiner for contributions (#6954) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description This PR contains an enhancement of the devcontainer definition as described in #6923 based on the setup list from [here](https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites). All tools and the corresponding extensions are integrated in the devcontainer. The following commands have been tested and get executed without errors: - `make build && make lint` - `make generate` ## Type of change - This pull request adds or changes features of Radius and has an approved issue (issue link required). Connected to: #6923 - issue si not yet resolved as update of documentation is missing ## Auto-generated summary ### 🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset) Generated by Copilot at 05c1e92 ### Summary 🛠️🌐📚 Enhance devcontainer configuration for contributors. Add features, extensions, and commands for `dapr` and other languages and tools. Specify memory requirement in `.devcontainer/contributor/devcontainer.json`. > _To make devcontainer more complete_ > _They added features, tools, and cheats_ > _With extensions galore_ > _And commands to explore_ > _And a comment to help and a `hostRequirements` repeat_ ### Walkthrough * Add comment with link to contributing code prerequisites and expand features and extensions for various programming languages and tools in `.devcontainer/contributor/devcontainer.json` ([link](https://github.com/radius-project/radius/pull/6954/files?diff=unified&w=0#diff-935f2b2e55e0ab1017fd1c544b9191e499e90e473ece926f8e65e95ddfbb1b1eL3-R15), [link](https://github.com/radius-project/radius/pull/6954/files?diff=unified&w=0#diff-935f2b2e55e0ab1017fd1c544b9191e499e90e473ece926f8e65e95ddfbb1b1eL14-R28), [link](https://github.com/radius-project/radius/pull/6954/files?diff=unified&w=0#diff-935f2b2e55e0ab1017fd1c544b9191e499e90e473ece926f8e65e95ddfbb1b1eL21-R48)) * Add postCreateCommand to run code generation commands in `.devcontainer/contributor/devcontainer.json` ([link](https://github.com/radius-project/radius/pull/6954/files?diff=unified&w=0#diff-935f2b2e55e0ab1017fd1c544b9191e499e90e473ece926f8e65e95ddfbb1b1eL21-R48)) * Add hostRequirements to specify minimum memory for devcontainer in `.devcontainer/contributor/devcontainer.json` ([link](https://github.com/radius-project/radius/pull/6954/files?diff=unified&w=0#diff-935f2b2e55e0ab1017fd1c544b9191e499e90e473ece926f8e65e95ddfbb1b1eL21-R48)) Signed-off-by: Christian Lechner --- .devcontainer/contributor/devcontainer.json | 32 ++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.devcontainer/contributor/devcontainer.json b/.devcontainer/contributor/devcontainer.json index 9b8beea23d..1603e805c6 100644 --- a/.devcontainer/contributor/devcontainer.json +++ b/.devcontainer/contributor/devcontainer.json @@ -1,26 +1,50 @@ { "name": "Radius - Contributor", + // For details see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { - "ghcr.io/devcontainers/features/go:1": {}, + //Git and GitHub Setup "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/github-cli:1": {}, + //Programming languages + "ghcr.io/devcontainers/features/go:1": {}, + "ghcr.io/guiyomh/features/gotestsum:0.1.1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers-contrib/features/typescript:2": {}, + "ghcr.io/devcontainers/features/python:1": {}, + //Container and K8s "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { "minikube": "none" }, "ghcr.io/devcontainers/features/docker-in-docker:2": { "version": "latest", "moby": true - } + }, + //Tools + "ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {}, + "ghcr.io/mpriscella/features/kind:1": {}, + "ghcr.io/dhoeric/features/stern:1": {}, + //Dapr + "ghcr.io/dapr/cli/dapr-cli:0": {} }, "customizations": { "vscode": { "extensions": [ "redhat.vscode-yaml", "golang.go", + "ms-python.python", + "ms-python.vscode-pylance", "ms-azuretools.rad-vscode-bicep", - "ms-kubernetes-tools.vscode-kubernetes-tools" + "ms-kubernetes-tools.vscode-kubernetes-tools", + "ms-azuretools.vscode-dapr", + "ms-vscode.makefile-tools" ] } - } + }, + // Prerequisite for Code Generation, see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites#code-generation + // Adding workspace as safe directory to avoid permission issues + "postCreateCommand": "git config --global --add safe.directory /workspaces/radius && cd typespec && npm ci && npm install -g autorest && npm install -g oav && go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.1 && go install github.com/golang/mock/mockgen@v1.5.0", + "hostRequirements": { + "memory": "8gb" + }, } \ No newline at end of file