microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.64k stars 285 forks source link

Local tasks #168

Open psolyca opened 5 years ago

psolyca commented 5 years ago

I am using a server under Linux to be able to compile my app (my computers need to be on windows) but I need to transfer the result (a binary file) in local then flash this bin in a microcontroller.

I would like to be able to :

I did not see anything in the documentation for this.

Also, following the architecture of extensions, I do not think it will be possible to have extension which work both sides with remote and local commands i.e. building remotely, retreiving and uploading locally (case of micropython IDE).

Tyriar commented 5 years ago

Right now you can't do this and would need to open a new window. also I'm not sure it makes sense for tasks as they're contained within the folder itself on the remote?

I was discussing the terminal case with @roblourens as we've both felt the need to open a local terminal, the only issue is it could potentially get very confusing which terminal is running on which machine.

psolyca commented 5 years ago

I understand tasks are in the remote folder which can be in a remote workspace.

But, could it be possible to open a folder and/or workspace in both side as in the extension view where you have a remote and a local view ? Thus in the explorer view, you have both workspace local and remote and you choose which one you want to work on !

This could be the same for terminal, linked to the folder/workspace.

Switching from one view to another by the explorer view or by a button in the status bar.
You know you have a remote session open with the left status in the side bar and you can have an other button just near to indicate if you are remote (same color of the remote connection) or local (another color).
This way you know quickly where you are.

ardikaveh commented 5 years ago

+1 for local terminal, this would also solve the issue that ssh agent is not forwarded with current remote terminal. Can't typing 'exit' just fall back to local terminal?

Tyriar commented 5 years ago

@ardikaveh the terminals are run by design on the machine and leverage through the same connection as everything else, that's what makes various terminals features like links and reflow on Windows work. If we were to support something like this it would likely be a special "Open Local Terminal" command.

Infineight commented 5 years ago

I have a workflow where I SSH from my local machine to the production server in order to pull changes from the development server. So a local terminal not being there means I have to open a new window for that as well. Alternatively to allowing a local terminal in the SSH remote session/workspace, in my specific case, it would be nicer to allow opening terminals directly to other SSH hosts in my SSH config file.

Tanja-4732 commented 5 years ago

a special "Open Local Terminal" command

This "special option" is exactly what I've been searching for. I have several extensions installed which can open various shells (PS, CMD, WSL, Git Bash) as a one-off question of which one to open, but this doesn't work while connected to a container.

PGP problems

Similar to what is said in #72, I am not able to utilize the GPG signing of commits (or tags for that matter) inside of containers, for the necessary (key-) files are stored outside of said containers.

Accessing those key-files is crucial when signing ones work, and doing so from within a container would likely require the use of volumes, which would need to be mounted accordingly - a task which has proven to be rather challenging, given the limited configuration options made available to the user by the Remote Development Extention.

SSH problems

Furthermore, an SSH connection must be established (again, using key-files) which have to be mounted, as copying (private-) key-files into a container is unacceptable.

Collaboration-friendly configurations

When collaborating with others, everyone uses their own keys. Everyone has their own Git configurations and everyone has configured their Git installation accordingly.

Which leads us to containers, as they need the mounting of the same files (notably with different contents) by different people. This container configuration (for example the devcontainer.json file) needs to be in the Git repository to allow for effective collaboration. However, it (alongside the also to-be-committed docker-compose.yml file) is also the only place to mount the key- and configuration-files required (see above).

While the Remote Development Extension provides automated configuration of the containers Git installation (via auto-mounting), this only works for the Git configuration.

The paths to the various key- and configuration-files on the devices of all collaborators is unlikely the same amongst all of them. It is thus required to be able to configure the mounting of such files dynamically, for the Remote Development Extension to fulfil its intended


Please provide the functionality to mount the GPG and SSH keys required for development into the containers to be used by the Remote Development Extension.

Being able to open local terminals would be an acceptable workaround for the time being.

Tyriar commented 5 years ago

Forked off just terminal into https://github.com/microsoft/vscode-remote-release/issues/730, tasks isn't done yet.

sandorfr commented 5 years ago

I second this request:

Currently tasks in .vscode/tasks.json tasks will run in the container. It would be great to be able to specify we want to run them in the host. being able to open a terminal on the host would be nice too.

My current use case is pushing a docker image to a private repo without having to login inside of my terminal.

psolyca commented 5 years ago

Thanks @Tyriar for the local terminal.

I can use directly my bat script from the VSCode window. But with tasks it should be better :-)

sanmai-NL commented 4 years ago

The local terminal does not open in the local root directory for a workspace, while in other places in the UI you can switch seamlessly between the local and remote view of the filesystem.

CRodriguez25 commented 3 years ago

This feature would be great for my workflow. I'm using the Remote Tools to edit python files within a container in a docker-compose network, and I'd like to be able to use tasks to configure and control aspects of other containers.

Scherlac commented 3 years ago

I agree, this feature would be great for dev containers. For this case the repository is already available locally and mounted inside the container. In our team we have all tools configured inside the container, witch is important to test the project on the same environment than our build system works. But some tools are much faster on local system. Right now I can start the entire project inside the container OR locally. Depending witch part I working on, I prefer to start some things inside the container others locally. To switch between local and remote mode I need to close VSCode and reopen it differently.

EDIT: I was not careful to read the logs: this is already done: Command palette (F1) / Terminal: Create new Integrated Terminal (Local) link

ilyvion commented 1 year ago

To give my justification for why I want the ability to do this: I'm coding within a docker image that was specially designed to offer the ability to compile C/Rust to a somewhat obscure platform, and rather than having to do all the clunky configuration and extra work it would be to set this up locally, I just do my VSCode dev within this image.

The emulator for the platform, however, is a GUI program that runs natively/locally on my host machine. As it is now, I have to compile the program in the dev container, then switch to a separate terminal on my host machine and run the emulator on the output. What I would like would be a complete set of "build in dev container and then run on local machine" chain of tasks/launch configurations.

This currently seems unattainable, and it's making my work more tedious.

thw0rted commented 1 year ago

If use cases help: I inherited a project that includes local development scaffolding via a series of Docker containers, which I run under WSL2. I opened the workspace in a WSL window (based on the remote extension), and I can write tasks that run in WSL. Now, I want to connect to these running containers from a browser on the local desktop.

Normally, I make a task in Code that launches Chrome with a dev/debug profile, separate from my day to day browser. I don't want to install Chrome under WSL (is that even supported?), I just want to hit the "launch task" shortcut I'm used to, pick the "Debug Chrome" task, and have it run chrome from the (Windows-side) PATH with a couple extra arguments. It looks like that's still unsupported.

g-kartik commented 1 year ago

Curious to know when this feature request shall go on-deck!

g-kartik commented 1 year ago

My use case related to this feature is creating dev containers using git hooks. I am writing it, if in case anybody is interested in it and may be someone can help me with some alternative methods.

Now here is the problem; inside the container post-checkout and post-merge triggers won't work. Its because they run in the context of the container's terminal and they can't find docker or code. So either the user has to select and open Create New Integrated Terminal (Local) from the command palette or use external terminal for just executing git checkout or git merge. Both are not user friendly.

It would be nice if we can pipe commands from container terminal to local terminal and view its output, without opening a separate local terminal. As per this feature request, we have been talking about local tasks, so that can be a subset of it I guess.

BillDenton commented 1 year ago

I do a mixture of local (Windows) and remote (Windows) development on the same code. I have build tasks that I want to run locally or remotely depending on if I'm working locally or remotely. I also have some other tasks that can only run on the local machine (Windows). These tasks are stored in user tasks.json so are available in all workspaces. Hence I'd like a way of specifying that a task always be run locally.

g-kartik commented 1 year ago

I have Django server container to which I have attached the vs code instance. My plan with local tasks is to run docker logs command in the local terminal automatically as the remote vscode instance starts up.

berge472 commented 1 year ago

This feature would also really benefit those doing embedded work in VS Code. When I want to debug something on a device, I have to start something like OpenOCD on the host machine, and then my launch.json attaches to that. It would be nice if I could have a task that starts OpenOCD on the host machine with the proper settings for my project, and just have the launch script run that task.

mandrewpowers commented 1 year ago

I'd also love to run local tasks when connected to a remote container!

My use case is that I don't want to clutter my local machine with various development environments and would rather cross-compile inside of a dev container. The current problem with this is I have to manually download and run the build on the destination host. If I could execute a local task I could rsync and run locally which would greatly improve cycle times.

For now I may setup a task to push code to my destination machine from the container then manually run it, or something similar, but it'd be great to run local build task to do it all at once.

lfdmn commented 10 months ago

I do lots of Yocto build on a server with lots of resource but need to download back the generated images (long complicated paths) to my local host where the boards are connected, flash them, etc.

I'd like to be able to have a single workspace where all the tasks are defined, but be able to specify in the tasks if they should run on the remote or the host.

adamgreg commented 10 months ago

I think this would help for my use case too. I'm developing a full-stack web app inside a dev container, and want to be able to launch a browser on the host, configured for remote debugging in VS Code.

Benjamin-Tan commented 7 months ago

There seems to be several requests over time, is there any plan to support this feature in the near future? I think this would be very helpful for many people.