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

Auto Updating Support #41

Closed
ganapativs opened this issue Oct 12, 2018 · 31 comments · Fixed by #166
Closed

Auto Updating Support #41

ganapativs opened this issue Oct 12, 2018 · 31 comments · Fixed by #166
Labels
discussion could go either way, discussion welcome

Comments

@ganapativs
Copy link

How does auto updating works here? how are we pushing the new update?

also anyone has idea about how to configure custom update.channel?

@JL2210
Copy link
Contributor

JL2210 commented Oct 12, 2018

Use the deb repository. See the README.

@stripedpajamas
Copy link
Member

The deb repository might be a good idea for Linux users. For Mac users we will have to figure something else out. It's not the best experience having to check the repo for updates or ask brew for updates. This could use some discussion.

@stripedpajamas stripedpajamas added the discussion could go either way, discussion welcome label Oct 12, 2018
@JL2210
Copy link
Contributor

JL2210 commented Oct 12, 2018

Homebrew can auto-update. Even in Debian, auto-updates do not happen automatically. You still have to type sudo apt-get update && sudo apt-get upgrade.

@ganapativs
Copy link
Author

But is it possible to get something like this native update notification?

screen shot 2018-10-15 at 9 55 35 am

There must be a way to configure update channel, isn't it?

@stripedpajamas
Copy link
Member

I think we can get something like that working. I need to investigate out it currently works in vscode

@ganapativs
Copy link
Author

Yes, there must be a proper interface for that feature, we need to check how to configure the same. I'll see if I can figure out something.

@tynx
Copy link
Contributor

tynx commented Oct 15, 2018

In case anyone want's to do it with a simple bash-"script", that you can trigger as often as you like...

wget -q -O /tmp/vscodium.deb $(wget -O- -q https://api.github.com/repos/VSCodium/vscodium/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep "amd64.deb") && sudo apt -f install /tmp/vscodium.deb && rm /tmp/vscodium.deb

Note: This Only supports dpkg/apt and amd64... :-)

@tynx
Copy link
Contributor

tynx commented Oct 15, 2018

Out of personal interesst I looked into the source of the updater-mechanism...

https://github.com/Microsoft/vscode/blob/bb23217d1ef48ff6549b214162b36e8b8306e943/build/gulpfile.vscode.linux.js#L84

It seems that the update mechanisms hits this URL. See the following folder for the concrete implementation of the updater-service. the abstract implementation contains the basic URL-schemantics for all platforms and the actual "update-checking" happens in the platform-specific implementations.
https://github.com/Microsoft/vscode/tree/master/src/vs/platform/update/electron-main

for linux:
https://github.com/Microsoft/vscode/blob/ab63c5d4c98a7deaf4974e8a8723f8dd5d7278b9/src/vs/platform/update/electron-main/updateService.linux.ts#L39

I'd probably try to change the update-url in the gulp-build-process to localhost or similar and would see what gets requested and try to respond...

@ganapativs
Copy link
Author

Found some more resources when opened Applications ▸ Visual Studio Code ▸ Show package contents(Right click) ▸ Contents⁩ ▸ ⁨Resources⁩ ▸ ⁨app⁩ ▸ product.json on OSX VSCode.

The product.json file has all the information about the build.
Update points to https://vscode-update.azurewebsites.net and these are the update urls.

https://vscode-update.azurewebsites.net/api/update/darwin/stable/VERSION
https://vscode-update.azurewebsites.net/api/update/darwin/insider/VERSION

If we can configure custom update URL & replicate above response format, things should probably work?

@tynx
Copy link
Contributor

tynx commented Oct 15, 2018

I would guess so as well. I know that you can host static pages on github (??repo??.github.io or something...)

Maye on each build push a file with the necessary information into the repo-root and host it directly from github itself?

@ganapativs
Copy link
Author

ganapativs commented Oct 15, 2018

Yup, that should work. As far as I know build folder of VSCode repo should have most of the necessary scripts to make it work.

Will investigate further.

@paulcarroty
Copy link
Collaborator

I know that you can host static pages on github

We can just host the one json directly in vscodium repo.

@stripedpajamas
Copy link
Member

@ganapativs @tynx thank you both for digging in. Yes-- this is perfect, we can easily host a JSON file that has the latest version with its hash and download link in the repo and update it at build time. When I have a few minutes I'll dig in, but PRs are welcome in the meantime. Again thank you all for digging in, as this is a piece of the vscodium puzzle that was really in need of solving 👍

@stripedpajamas
Copy link
Member

Circling back to this today... I think the next steps are:

I'll start investigating

@stripedpajamas
Copy link
Member

Another step is that updates apparently won't work unless the app is signed. I'm not sure how to sign the app during Travis build so that is something I've got to figure out.

@ganapativs
Copy link
Author

ganapativs commented Dec 12, 2018

Another step is that updates apparently won't work unless the app is signed.

Is it verified? Someone tried it?

We don't sign VSCodium build as of now right?

@stripedpajamas
Copy link
Member

@ganapativs vscode uses electron's autoupdater functionality, and the electron docs here say the app needs to be signed for Mac OS.

We don't currently sign the builds. Do you know how to do this in an safe automated way?

@ganapativs
Copy link
Author

ganapativs commented Dec 13, 2018

@stripedpajamas Okay, I don't know much about signing desktop apps, but found this electron code signing resource, which might help.

@batjko
Copy link

batjko commented Apr 18, 2019

Also, not to be pedantic, but Windows users would surely also appreciate the ability, as they have had it for Standard vsc.

@stripedpajamas
Copy link
Member

Absolutely, @batjko. This is definitely something that should be near the top of the priority list as it is a big shortcoming of VSCodium as compared to VSC.

@JakobFelixJulius
Copy link

Hello!
As a new VSCodium user (awesome project) just my two cents, this functionality is definitively needed! Hope you guys can figure it out :)

@stripedpajamas
Copy link
Member

Some more notes to keep the ball rolling and so I don't forget:

  • the full URL used to check for updates is ${product.updateUrl}/api/update/${platform}/${quality}/${product.commit}, where product.<value> comes from the product.json file
  • product.commit is populated automatically at build time (properly)
  • platform can be darwin, linux-<arch>, win32-[x64]-<archive|user>
  • we aren't currently setting quality and if it isn't set, all the update logic is disabled
  • we can't use a JSON file because response codes are important to this process
    • vscode uses Electron's autoupdater for Mac updates and custom logic for Windows + Linux. All three are expecting 200 if it should download an update and 204 if it shouldn't. On 200, the client expects the JSON blob (this accords with Squirrel, the underlying tech in Electron's autoupdater)
    • this can be seen with the current update API update.code.visualstudio.com (51b0b28134d51361cf996d2f0a1c698247aeabd8 is the commit hash of 1.33.1 in the vscode repo):
    $ curl -I https://update.code.visualstudio.com/api/update/darwin/stable/51b0b28134d51361cf996d2f0a1c698247aeabd8
    HTTP/1.1 204 No Content
    [...]
    $ curl -I https://update.code.visualstudio.com/api/update/darwin/stable/anythingelse
    HTTP/1.1 200 OK
    [...]

So might need to stand up a small update server to handle the details.

This was referenced May 13, 2019
@stripedpajamas
Copy link
Member

Ok I made some progress on this over the past couple of days. Here is an update:

  • created the VSCodium/update-api repo and the VSCodium/versions repo
  • built out a lambda in update-api that responds similarly to update.code.visualstudio.com and set it up with Now to deploy to vscodium.now.sh
    $ curl -I https://vscodium.now.sh/api/update/darwin/stable/some-bogus-commit-hash
    HTTP/2 200
    [...]
    $ curl https://vscodium.now.sh/api/update/darwin/stable/some-bogus-commit-hash | jq
      {
        "url": "https://github.com/VSCodium/vscodium/releases/download/1.34.0/VSCodium-darwin-1.34.0.zip",
        "name": "1.34.0",
        "version": "a622c65b2c713c890fcf4fbf07cf34049d5fe758",
        "productVersion": "1.34.0",
        "hash": "768e876321bf52e337d5f05bc24f06246c8d1877",
        "timestamp": "1558030458353",
        "sha256hash": "b1c3fd7b421d8e97af7e0556956e0d19c06031526a92b3ca19b8103cd167455d"
      }
    $ curl -I https://vscodium.now.sh/api/update/darwin/stable/a622c65b2c713c890fcf4fbf07cf34049d5fe758
    HTTP/2 204
    [...]
    $ curl https://vscodium.now.sh/api/update/darwin/stable/a622c65b2c713c890fcf4fbf07cf34049d5fe758
    [no content]
  • the returned JSON blob is retrieved from VSCodium/versions for the specific os/arch passed into the API
  • I added a script that commits the version JSON file after a successful build+deploy of VSCodium
  • Currently the script is only set up for Linux + Darwin, so I made a new task in the project to get it working for Windows builds as well

Testing everything out is not intuitive, so I will probably have to write up a Contributing Guide pretty soon that covers VSCodium, the update API, and the versions repo.

I will try to test it out with an older version of VSCodium and see how it responds to the API.

@stripedpajamas
Copy link
Member

I was successfully auto-updated on my Mac using the new service 🎉

Testing steps:

  • downloaded an old version (1.33.0) of VSCodium
  • edited product.json to include quality: stable, updateUrl: vscodium.now.sh, and releaseNotesUrl: https://go.microsoft.com/fwlink/?LinkID=533483#vscode (so that updates are not silent)
  • signed the binary (since signing had not been implemented by 1.33.0)
  • opened the app and watched the Output | Log (Main) window
  • it hit the update API (which I could also see from the lambda logs), determined it was out of date, and downloaded the new file
  • I closed/reopened the app and found that I was on version 1.34.0

I updated the project to include adding releaseNotesUrl to the product.json pre-build.

Notes on Linux: I don't know if anyone has had experience with autoupdates on Linux, but since the API returns the tar.gz file link, I am doubtful that it autoupdates. I think with the introduction of the snap package things might have changed, but VSCodium hasn't gotten snap support figured out yet. If anyone has more information about how it works, please comment.

@stripedpajamas
Copy link
Member

Good news -- I updated the version updater to support Windows and then tested auto updating on a Windows machine (x64, user install) -- it worked 🎉

Next step according to the project is to add two fields to the product.json file and then call it a day (wait for the next MS release). Actually will have to wait for two more MS releases -- the first will make VSCodium start checking for updates, the second will be a new version that VSCodium downloads + installs.

@thymbahutymba
Copy link

Check for update return server error 404.

Version: 1.35.0 (system setup)
Commit: db1afbd
Date: 2019-06-11T04:56:38.833Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.18362

image

@stripedpajamas
Copy link
Member

System setup updates are not supported. I'm not certain that they're supported by Microsoft either because it looked like the update code specified user or archive.

@thymbahutymba
Copy link

Yes, they are supported.

I also tried to install the user setup 1.35.0 for check the update of 1.35.1 and the message shown was that vscodium is already updated, it's normal? There even should be a "pop-up message" on bottom right side, like vscode, that alert me about an update?

@resynth1943
Copy link

Is this even supported on Linux with VSCode? When they request you update the software, it navigates you to https://code.visualstudio.com to download a deb / rpm, so I'm not sure if this can be done on Linux.

@fsj-digital
Copy link

hi there - i need to update vscodium on mxlinux

at the moment i am on mx-linux version 19.2

running vscodium: 1.47.3

want to update to the newest vscodium: 1.52.1

saw that we can go probably this way: is this an apropiate way:

https://www.google.com/search?ei=Y9MAYMynNJCZkwXfu6NY&q=how+to+upgrade+vscodium+on+linux&oq=how+to+upgrade+vscodium+on+l&gs_lcp=CgZwc3ktYWIQAxgAMgUIIRCgATIFCCEQoAEyBQghEKABOgQIABBHOgQIABANOgQILhANOgYIABANEAo6CQgAEEMQRhD_AToECAAQQzoECC4QQzoICC4QsQMQgwE6BwgAELEDEEM6AgguOggIABCxAxCDAToCCAA6BggAEBYQHjoECAAQEzoICAAQFhAeEBM6CggAEBYQChAeEBM6CggAEA0QChAeEBM6BAghEBVQsAFYhasCYP_BAmgQcAJ4AIABpgSIAfgvkgEKMzYuNy4yLjUtM5gBAKABAaABAqoBB2d3cy13aXrIAQjAAQE&sclient=psy-ab#kpvalbx=_ldMAYIjbEpqakgXFnZFQ13

the folks there have got a three-step-solution

a. add gpg-key of the repository

b. add the repository

c. update then install vscodium

look forward to hear from you

@resynth1943
Copy link

Hiya,

saw that we can go probably this way: is this an apropiate way:

Not opening that. Instead of sharing mysterious SERP
links, perhaps you could investigate the options made available
by the VSCodium developers? 🙂

I just update VSCodium via my distribution's native package manager.
I would advise disabling the 'auto-update' in most cases, as it does nothing.

  • a. add gpg-key of the repository
  • b. add the repository
  • c. update then install vscodium

I don't know what that means, but I suggest you investigate the packaging
solution for your Linux distribution.

https://github.com/VSCodium/vscodium#install-with-package-manager

P.S. Sending mysterious links is off-putting.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion could go either way, discussion welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants