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

SDA-4182: Add GPOs to auto update channel #1896

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

NguyenTranHoangSym
Copy link
Contributor

Description

Auto-update params defined via GPOs
Read channel from registry and apply to SDA

Related PRs

} else if (isWindowsOS) {
this.autoUpdater = new NsisUpdater(opts);
}
this.getGenericServerOptions().then((opts) => {
Copy link
Member

Choose a reason for hiding this comment

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

This is only for Windows right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes windows-only

Copy link
Member

Choose a reason for hiding this comment

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

Then I think you need to wrap RegistryStore.getRegistry and retrieveWindowsRegistry inside isWindowsOS

? 'beta'
: autoUpdateChannel;

const registryAutoUpdate = RegistryStore.getRegistry();
Copy link
Member

Choose a reason for hiding this comment

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

This is also for Windows only

@@ -221,16 +237,24 @@ export class AutoUpdate {
return updateUrl;
};

private getGenericServerOptions = (): GenericServerOptions => {
private getGenericServerOptions = async (): Promise<GenericServerOptions> => {
await retrieveWindowsRegistry();
Copy link
Member

Choose a reason for hiding this comment

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

This is also for Windows only

Comment on lines 63 to 73
const registryAutoUpdate = RegistryStore.getRegistry();
const identifiedChannel = [
EChannelRegistry.BETA,
EChannelRegistry.LATEST,
].includes(registryAutoUpdate.currentChannel)
? registryAutoUpdate.currentChannel
: '';
const finalAutoUpdateChannel =
isWindowsOS && identifiedChannel
? identifiedChannel
: autoUpdateChannel;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const registryAutoUpdate = RegistryStore.getRegistry();
const identifiedChannel = [
EChannelRegistry.BETA,
EChannelRegistry.LATEST,
].includes(registryAutoUpdate.currentChannel)
? registryAutoUpdate.currentChannel
: '';
const finalAutoUpdateChannel =
isWindowsOS && identifiedChannel
? identifiedChannel
: autoUpdateChannel;
let finalAutoUpdateChannel = autoUpdateChannel;
if (isWindowsOS) {
const registryAutoUpdate = RegistryStore.getRegistry();
const identifiedChannel = [
EChannelRegistry.BETA,
EChannelRegistry.LATEST,
].includes(registryAutoUpdate.currentChannel)
? registryAutoUpdate.currentChannel
: '';
if (identifiedChannel) {
finalAutoUpdateChannel = identifiedChannel;
}
}

Copy link
Member

@KiranNiranjan KiranNiranjan left a comment

Choose a reason for hiding this comment

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

on minor change and it LGTM

? registryAutoUpdate.currentChannel
: '';
const channel =
isWindowsOS && identifiedChannel
Copy link
Contributor

Choose a reason for hiding this comment

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

isWindowsOS not needed here

await retrieveWindowsRegistry();

const registryAutoUpdate = RegistryStore.getRegistry();
const identifiedChannel = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const identifiedChannel = [
const identifiedChannelFromRegistry = [

isWindowsOS && identifiedChannel
? identifiedChannel
: autoUpdateChannel;
userAutoUpdateChannel = betaAutoUpdateChannelEnabled ? 'beta' : channel;
Copy link
Contributor

@sbenmoussati sbenmoussati Jul 18, 2023

Choose a reason for hiding this comment

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

GPO has a higher prio than ACP (betaAutoUpdateChannelEnabled), so normally it should be like:

userAutoUpdateChannel = identifiedChannelFromRegistry ? identifiedChannelFromRegistry : betaAutoUpdateChannelEnabled ? 'beta' : channel;

}
if (isMac) {
config.backupGlobalConfig();
const { autoUpdateChannel } = config.getConfigFields([
Copy link
Contributor

@sbenmoussati sbenmoussati Jul 18, 2023

Choose a reason for hiding this comment

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

Duplicated logic here, I would rather put it in a dedicated function that would return the channel.
IMO this function should be called directly in
this.autoUpdater.on('update-available', (info) => { ... })
this.autoUpdater.on('download-progress', (info) => { ... })
this.autoUpdater.on('update-downloaded', (info) => { ... })

@sbenmoussati sbenmoussati merged commit 15056f1 into finos:main Jul 18, 2023
5 of 6 checks passed
NguyenTranHoangSym added a commit to NguyenTranHoangSym/SymphonyElectron that referenced this pull request Sep 5, 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.

None yet

3 participants