devpod icon indicating copy to clipboard operation
devpod copied to clipboard

DevPod quick launch http shortcut more prefill options

Open martinbiard opened this issue 1 year ago • 6 comments

I haven't been able to find out much documentation about the feature where devpod can be launched through a http link like this:

https://devpod.sh/open#[email protected]:my-org/my-repo.git

I've tested it with the creation of a new workspace, it works well but it is missing a few prefill options for my ideal use case.

In my use case, we support 2 IDEs for our developpers, VSCode and JetBrains WebStorm. I would like the be able to create devpod launch links that prefill everything (optionally, if those params are added to the link) that I could add to my README.md such that our devs could simply click the link that launches devpod in their preferred IDE, and then just click "Create Workspace" in devpod without having to tell them to fill out the Provider, IDE, Workspace Name, Prebuild Repository, and Devcontainer Path manually.

Somewhat related, while searching for quick launch link options for devpod, I came accros this github issue #748 which references how to create deeplinks. I've tried with links like these but couldn't get it to work at all:

devpod://[email protected]:my-org/my-repo.git&workspace=svg-io&provider=docker&ide=vscode devpod://open?git%40github.com%3Amy-org%2Fmy-repo.git&workspace=my-workspace&provider=docker&ide=vscode

And, finally, another small suggestion. Right now, when you open the devpod.sh launch shortcut, it's named "Open Spin up dev environments in any infra" but I think it should mostly just say "DevPod" or "Open with DevPod".

Screenshot 2024-04-25 143531

For reference my OS where devpod is installed is Windows 11, and my browser is Chrome.

martinbiard avatar Apr 25 '24 18:04 martinbiard

source was the parameter that I found to put the URL in that would result in the repository being passed in.

shanman190 avatar Apr 26 '24 01:04 shanman190

Hey @martinbiard, thanks for opening the issue. The current format for deeplinks is documented here, the only difference when relaying through devpod.sh/open is that you can omit the source parameter name. The rest works the same. The deeplink devpod://open?source=your-url-encoded-source&workspace=my-workspace&provider=docker&ide=vscode becomes https://devpod.sh/open#your-url-encoded-source&workspace=my-workspace&provider=docker&ide=vscode

Another neat trick is to just omit the source for github based repos, devpod.sh figures it out via the referrer header

As for the popup, that looks weird indeed, I'm wondering what windows is up to this time 🙃 it's not reproducible on linux or macOS for me

pascalbreuninger avatar Apr 26 '24 07:04 pascalbreuninger

Thanks @pascalbreuninger

Yes, those are the links I tried, but I have these issues:

  • The devpod:// url scheme does not work at all, I can paste it in chrome and chrome asks if I want to open it with devpod but if I accept, it never makes it to the devpod app (not sure how to debug this further).
  • The https url scheme going through the devpod.sh website works better, it will actually bring up devpod and prefill the source with my github repo url. However, as mentioned in my original post, it won't prefill anything else even though I'm passing them as parameters (workspace, provider, ide).

martinbiard avatar Apr 26 '24 19:04 martinbiard

@martinbiard I can't repro this on macOS, maybe it's a windows issue - we'll look into it. Could you paste the updated url you're trying it with here please?

pascalbreuninger avatar Apr 27 '24 05:04 pascalbreuninger

@pascalbreuninger

You're right, it's working. I took your urls and carefully recreated mine and both worked. I'm working on a private repo so I can't share exact links but those are the formats that worked:

devpod://[email protected]:my-org/my-repo.git&workspace=my-workspace&provider=docker&ide=vscode
https://devpod.sh/open#[email protected]:my-org/my-repo.git&workspace=my-workspace&provider=docker&ide=vscode

I'm not yet using the prebuild feature, but is there a parameter to pass this value into the urls as well?

Another thing I noticed, is that prefilling the workspace input with the above urls works as long as devpod is already running. When devpod is not running, then the links will open devpod to the workspaces list section in the app, but not to the prefilled create workspace page.

martinbiard avatar Apr 27 '24 19:04 martinbiard

@martinbiard

I'm not yet using the prebuild feature, but is there a parameter to pass this value into the urls as well?

Not a URL parameter but it's available as a customization in the devcontainer.json

"customizations": {
  "devpod": {
      "prebuildRepository": "ghcr.io/my-org/my-repo"
  }
}

pascalbreuninger avatar Apr 28 '24 08:04 pascalbreuninger