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

Modify Upgrade Responder client code to prepare for future changes #4062

Merged

Conversation

adamkpickering
Copy link
Member

Closes #4036.

@adamkpickering adamkpickering force-pushed the 4036-update-update-client branch from 4cad6be to 4eafdb6 Compare February 28, 2023 17:02
@adamkpickering adamkpickering marked this pull request as ready for review February 28, 2023 17:02
@adamkpickering adamkpickering requested a review from mook-as March 1, 2023 00:00
Copy link
Contributor

@mook-as mook-as left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically just for lint issues.

@adamkpickering adamkpickering force-pushed the 4036-update-update-client branch from 2af08cd to cc7a04a Compare March 1, 2023 16:53
@adamkpickering adamkpickering requested a review from mook-as March 1, 2023 16:53
mook-as
mook-as previously approved these changes Mar 1, 2023
mook-as
mook-as previously approved these changes Mar 1, 2023
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I haven't finished my review, but I'm running out of time right now.

I did find one or two places that look like bugs though, so submitting partial review now.

background.ts Show resolved Hide resolved
pkg/rancher-desktop/components/UpdateStatus.vue Outdated Show resolved Hide resolved
pkg/rancher-desktop/components/UpdateStatus.vue Outdated Show resolved Hide resolved
pkg/rancher-desktop/utils/osVersion.ts Outdated Show resolved Hide resolved
pkg/rancher-desktop/main/update/LonghornProvider.ts Outdated Show resolved Hide resolved
@adamkpickering adamkpickering force-pushed the 4036-update-update-client branch 2 times, most recently from 6adb259 to a052bbc Compare March 8, 2023 19:45
@adamkpickering adamkpickering marked this pull request as draft March 24, 2023 18:12
@adamkpickering adamkpickering force-pushed the 4036-update-update-client branch 2 times, most recently from 58deb61 to f4c6ff2 Compare April 20, 2023 17:37
@adamkpickering adamkpickering marked this pull request as ready for review April 21, 2023 16:13
@adamkpickering
Copy link
Member Author

adamkpickering commented Apr 21, 2023

Marking as ready for review because it's getting too big. Also, it was mostly reviewed already and I don't want to confuse anyone by making more changes (more than I already have).

I'm planning on adding wslVersion to the request body in a future PR.

@gaktive gaktive requested a review from jandubois April 21, 2023 18:15
@adamkpickering adamkpickering force-pushed the 4036-update-update-client branch from 38ce4c2 to b028f54 Compare April 28, 2023 21:57
@adamkpickering adamkpickering force-pushed the 4036-update-update-client branch from b028f54 to 4e4afc1 Compare May 3, 2023 16:29
@adamkpickering adamkpickering requested a review from jandubois May 3, 2023 16:30
@adamkpickering adamkpickering force-pushed the 4036-update-update-client branch from 4e4afc1 to e7857ec Compare May 3, 2023 18:19
@jandubois
Copy link
Member

Sorry, I haven't finished the testing, and am offline for the next 4 days, so wanted to leave a few notes:

I'm running influxdb in a separate VM, and the upgrade responder locally.

I set the following environment variables:

export RD_FORCE_UPDATES_ENABLED=1
export RD_MOCK_VERSION=1.6.0
export RD_UPGRADE_RESPONDER_URL=http://localhost:8314/v1/checkupgrade

Using the lower mock version is so that the upgrade responder can suggest newer versions that actually exist as Github releases and can be downloaded.

I added the following patch so that the version is passed to the upgrade responder:

--- pkg/rancher-desktop/main/update/LonghornProvider.ts
+++ pkg/rancher-desktop/main/update/LonghornProvider.ts
@@ -350,7 +350,16 @@ export default class LonghornProvider extends Provider<LonghornUpdateInfo> {
       }
     }

-    const queryResult = await queryUpgradeResponder(this.configuration.upgradeServer, this.updater.currentVersion);
+    let currentVersion = this.updater.currentVersion;
+
+    if (process.env.RD_MOCK_VERSION) {
+      const mockVersion = semver.coerce(process.env.RD_MOCK_VERSION);
+
+      if (mockVersion) {
+        currentVersion = mockVersion;
+      }
+    }
+    const queryResult = await queryUpgradeResponder(this.configuration.upgradeServer, currentVersion);
     const { latest, unsupportedUpdateAvailable } = queryResult;
     const requestIntervalInMinutes = queryResult.requestIntervalInMinutes || defaultUpdateIntervalInMinutes;
     const requestIntervalInMs = requestIntervalInMinutes * 1000 * 60;

I do get the following error on the console:

(node:37083) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'find')
    at LonghornProvider.checkForUpdates (/Volumes/ThunderBlade/suse/rd/dist/app/background.js:37395:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async LonghornProvider.getLatestVersion (/Volumes/ThunderBlade/suse/rd/dist/app/background.js:37425:23)
    at async MacUpdater.getUpdateInfoAndProvider (/Volumes/ThunderBlade/suse/rd/node_modules/electron-updater/out/AppUpdater.js:319:19)
    at async MacUpdater.doCheckForUpdates (/Volumes/ThunderBlade/suse/rd/node_modules/electron-updater/out/AppUpdater.js:333:24)
    at async triggerUpdateCheck (/Volumes/ThunderBlade/suse/rd/dist/app/background.js:37883:24)

jandubois
jandubois previously approved these changes May 23, 2023
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving after rebase

@jandubois jandubois merged commit 6be0fc2 into rancher-sandbox:main May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make changes to Rancher Desktop to allow preventing automatic updates on specific OS versions
3 participants