microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.37k stars 28.93k forks source link

code tunnel having issues starting tunnel with user login --provider github #207931

Closed mantrakp04 closed 6 months ago

mantrakp04 commented 7 months ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Have docker
  2. Create a Dockerfile:
    
    FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive

Install dependencies

RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ libgl1-mesa-glx \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ python3 \ python3-pip \ python3-venv \ wget \ nano \ curl \ && rm -rf /var/lib/apt/lists/*

Setup Git

RUN git config --global credential.helper store && \ git config --global user.email "..." && \ git config --global user.name "..."

Install VS Code server

RUN curl -sL "https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64" --output /tmp/vscode-cli.tar.gz && \ tar -xf /tmp/vscode-cli.tar.gz -C /tmp && \ mv /tmp/code /usr/local/bin/code && \ rm -rf /tmp/vscode-cli.tar.gz /tmp/VSCode-linux-x64

Start the code tunnel

WORKDIR /workspace RUN mkdir -p /workspace/.vscode-server/cli CMD ["/bin/bash", "-c", "code tunnel --accept-server-license-terms --disable-telemetry --name dev --cli-data-dir /workspace/.vscode-server/cli user login --provider github"]


3. docker build -t vs-code -f Dockerfile .
4. docker run -it --rm --gpus all vs-code
5. go to https://github.com/login/device and enter the displayed code

the server just quits itself but if you try `code tunnel --accept-server-license-terms --disable-telemetry --cli-data-dir /workspace/.vscode-server/cli` and follow the steps it works.
mantrakp04 commented 7 months ago
root@096f43737635:/workspace# code tunnel --accept-server-license-terms --disable-telemetry --name test --cli-data-dir /workspace/.vscode-server/cli user login --provider github --log trace --verbose
[2024-03-16 20:10:27] debug [reqwest::connect] starting new connection: https://github.com/
To grant access to the server, please log into https://github.com/login/device and use code ****-****
[2024-03-16 20:10:33] trace refresh poll failed, retrying: Error getting authorization: authorization_pending The authorization request is still pending.
[2024-03-16 20:10:38] debug Using file keychain storage due to: error reading keyring: Platform secure storage failure: no secret service provider or dbus session found
root@096f43737635:/workspace#
mantrakp04 commented 6 months ago

Weird fix but

init_script:

#!/bin/bash
code tunnel --accept-server-license-terms --disable-telemetry --name testdev --cli-data-dir /workspace/.vscode-server/cli &

# sleep till infinity helps, found it when i was tinkering around with xdotool
while true; do
  sleep 1000
done

Dockefile snippet:

WORKDIR /workspace
RUN mkdir -p /workspace/.vscode-server/cli

ADD scripts/utils/ai-api/init_script.sh /init_script.sh
RUN chmod +x /init_script.sh

CMD ["/bin/bash", "-c", "bash /init_script.sh"]
connor4312 commented 6 months ago

code tunnel user login just logs in. It doesn't start the server. Exiting after doing so is expected behavior; run just code tunnel if you want a persistent tunnel.