Skip to content
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

Add DevContainer #1608

Merged
merged 5 commits into from Jul 28, 2022
Merged

Add DevContainer #1608

merged 5 commits into from Jul 28, 2022

Conversation

cyw3
Copy link
Contributor

@cyw3 cyw3 commented Jul 23, 2022

With DevContainer, developers can join the project without deploy the build env.

@google-cla
Copy link

google-cla bot commented Jul 23, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@anton-roos
Copy link
Contributor

This would really be a cool addition.

@jonmeow
Copy link
Contributor

jonmeow commented Jul 24, 2022

I'm not too familiar with DevContainer, how is it used? Would it make sense to add some notes about this on the contribution tools page, e.g. under VS Code or generally optional tools?

@cyw3
Copy link
Contributor Author

cyw3 commented Jul 25, 2022

I'm not too familiar with DevContainer, how is it used? Would it make sense to add some notes about this on the contribution tools page, e.g. under VS Code or generally optional tools?

DONE!

@JochenHiller
Copy link

This PR did not work for me running VSCode on macOS on ARM platform (MacBookPro with M1).

I think problem is that linuxbrew does not support aarch64 architecture by default. See https://docs.brew.sh/Homebrew-on-Linux#arm as well. There needs to be ruby 2.6.8_1 installed before installing linuxbrew. I was NOT able to successfully install ruby and linuxbrew to get it running. Any hints how to do that?

See log from VSCode:

#0 113.6 Homebrew on Linux is not supported on ARM processors.
#0 113.6 You can try an alternate installation method instead:
#0 113.6   https://docs.brew.sh/Homebrew-on-Linux#arm
------
error: failed to solve: executor failed running [/bin/sh -c source /opt/rh/devtoolset-7/enable     && gcc --version     && cd /data/App/git-2.37.1     && make prefix=/usr/local/git all     && make prefix=/usr/local/git install     && cd ../curl-7.70.0     && ./configure --prefix=/usr/local/curl     && make && make install     && cd ..     && export PATH=/usr/local/git/bin:/usr/local/curl/bin:$PATH     && NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"     && echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /root/.bash_profile     && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"]: exit code: 1
[116165 ms] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f .../carbon-lang/.devcontainer/Dockerfile -t vsc-carbon-lang-dc59747797416345b405ebe9c1b85d8d .../carbon-lang/.devcontainer
[116165 ms]     at GR (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:240:1436)
[116165 ms]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[116165 ms]     at async Hu (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:2796)
[116165 ms]     at async tb (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:1779)
[116165 ms]     at async QR (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:2006)
[116165 ms]     at async cb (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:3110)
[116165 ms]     at async i_ (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:13194)
[116165 ms]     at async n_ (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:12950)
[116167 ms] Exit code 1
[116169 ms] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/jhiller/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder ...carbon-lang --workspace-mount-consistency cached --id-label devcontainer.local_folder=.../carbon-lang --log-level debug --log-format json --config .../carbon-lang/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[116169 ms] Exit code 1

@cyw3
Copy link
Contributor Author

cyw3 commented Jul 26, 2022

This PR did not work for me running VSCode on macOS on ARM platform (MacBookPro with M1).

I think problem is that linuxbrew does not support aarch64 architecture by default. See https://docs.brew.sh/Homebrew-on-Linux#arm as well. There needs to be ruby 2.6.8_1 installed before installing linuxbrew. I was NOT able to successfully install ruby and linuxbrew to get it running. Any hints how to do that?

See log from VSCode:

#0 113.6 Homebrew on Linux is not supported on ARM processors.
#0 113.6 You can try an alternate installation method instead:
#0 113.6   https://docs.brew.sh/Homebrew-on-Linux#arm
------
error: failed to solve: executor failed running [/bin/sh -c source /opt/rh/devtoolset-7/enable     && gcc --version     && cd /data/App/git-2.37.1     && make prefix=/usr/local/git all     && make prefix=/usr/local/git install     && cd ../curl-7.70.0     && ./configure --prefix=/usr/local/curl     && make && make install     && cd ..     && export PATH=/usr/local/git/bin:/usr/local/curl/bin:$PATH     && NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"     && echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /root/.bash_profile     && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"]: exit code: 1
[116165 ms] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f .../carbon-lang/.devcontainer/Dockerfile -t vsc-carbon-lang-dc59747797416345b405ebe9c1b85d8d .../carbon-lang/.devcontainer
[116165 ms]     at GR (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:240:1436)
[116165 ms]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[116165 ms]     at async Hu (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:2796)
[116165 ms]     at async tb (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:1779)
[116165 ms]     at async QR (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:2006)
[116165 ms]     at async cb (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:3110)
[116165 ms]     at async i_ (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:13194)
[116165 ms]     at async n_ (/Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:12950)
[116167 ms] Exit code 1
[116169 ms] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/jhiller/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/jhiller/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder ...carbon-lang --workspace-mount-consistency cached --id-label devcontainer.local_folder=.../carbon-lang --log-level debug --log-format json --config .../carbon-lang/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[116169 ms] Exit code 1

The build env is referenced from article.

If have a better way, you can update the article, and I will update the corresponding devcontainer synchronously.

To support developers join the project without deploying the build env, we
provide VSCode `DevContainer`.

- Install VSCode and Docker;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting, I think we should work on the doc formatting (these should really be written more as sentences, 1. 2. 3., instead of a bullet sequence with semicolons). But I feel awkward having forgotten this PR for a week so I'm just going to approve, and worry about the docs later.

Copy link
Contributor

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's try this out.

@jonmeow jonmeow merged commit 85cb70c into carbon-language:trunk Jul 28, 2022
@cyw3
Copy link
Contributor Author

cyw3 commented Jul 29, 2022

Thanks!

@beryll1um
Copy link
Contributor

With DevContainer, developers can join the project without deploy the build env.

Hello. Please take a look #1817
There is some questions and proposals related with this feature.

SlaterLatiao pushed a commit to SlaterLatiao/carbon-lang that referenced this pull request Aug 3, 2022
With DevContainer, developers can join the project without deploy the build env.

Signed-off-by: cyw3 <2927096163@qq.com>
@chandlerc chandlerc added the documentation An issue or proposed change to our documentation label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation An issue or proposed change to our documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants