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

Local tasks #168

Open
psolyca opened this issue May 6, 2019 · 23 comments
Open

Local tasks #168

psolyca opened this issue May 6, 2019 · 23 comments
Assignees
Labels
feature-request Request for new features or functionality tasks
Milestone

Comments

@psolyca
Copy link

psolyca commented May 6, 2019

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 :

  • open a local terminal to launch some commands locally,
  • use task locally.

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
Copy link
Member

Tyriar commented May 9, 2019

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.

@Tyriar Tyriar added the feature-request Request for new features or functionality label May 9, 2019
@psolyca
Copy link
Author

psolyca commented May 10, 2019

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
Copy link

ardikaveh commented May 10, 2019

+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
Copy link
Member

Tyriar commented May 11, 2019

@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
Copy link

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
Copy link

Tanja-4732 commented Jun 19, 2019

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
Copy link
Member

Tyriar commented Jun 19, 2019

Forked off just terminal into #730, tasks isn't done yet.

@Tyriar Tyriar reopened this Jun 19, 2019
@Tyriar Tyriar removed their assignment Jun 19, 2019
@alexr00 alexr00 added this to the Backlog milestone Jun 20, 2019
@alexr00 alexr00 added the tasks label Jun 20, 2019
@sandorfr
Copy link

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
Copy link
Author

psolyca commented Jul 11, 2019

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
Copy link

sanmai-NL commented May 6, 2020

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
Copy link

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

This comment has been minimized.

@alexr00 alexr00 assigned meganrogge and unassigned alexr00 Sep 7, 2022
@ilyvion
Copy link

ilyvion commented Oct 22, 2022

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
Copy link

thw0rted commented Dec 8, 2022

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
Copy link

g-kartik commented Feb 3, 2023

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

@g-kartik
Copy link

g-kartik commented Feb 3, 2023

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.

  • I created post checkout and post merge git hooks such that on these triggers, docker containers will be rebuilt and restarted within the context of the branch name.
  • I am using volumes suffixed with branch name to persist data for each branch. So switching between branches wouldn't require creating container data.
  • At the end of the hook script, I am launching vs code remote instance via cli and attach it to the running container.
  • Container volume mounts the source code including the git repository with ssh access to remote repo. So, git is accessible within the container.

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
Copy link

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
Copy link

g-kartik commented Apr 1, 2023

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
Copy link

berge472 commented Aug 2, 2023

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
Copy link

mandrewpowers commented Aug 28, 2023

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
Copy link

lfdmn commented Dec 13, 2023

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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality tasks
Projects
None yet
Development

No branches or pull requests