Skip to content

Add preference for release channel #7534

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

Merged
merged 2 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/vs/platform/update/common/update.config.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ configurationRegistry.registerConfiguration({
description: localize('updateMode', "Configure whether you receive automatic updates. Requires a restart after change to take effect."),
deprecationMessage: localize('deprecated', "This setting is deprecated, please use '{0}' instead.", 'update.mode')
},
'update.positron.channel': {
type: 'string',
default: 'prereleases',
enum: ['dailies', 'prereleases'],
enumDescriptions: [
localize('dailies', "The latest daily build. This is the most up-to-date version of Positron."),
localize('prereleases', "Receive pre-release updates.")
],
scope: ConfigurationScope.APPLICATION,
description: localize('update.positron.channel', "Configure the release stream for receiving updates. Requires a restart after change to take effect."),
tags: ['usesOnlineServices'],
included: !isWeb
},
'update.primaryLanguageReporting': {
type: 'boolean',
default: true,
Expand Down
12 changes: 4 additions & 8 deletions src/vs/platform/update/electron-main/abstractUpdateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ import { IUpdate } from '../common/update.js';
import { hasUpdate } from '../electron-main/positronVersion.js';
import { INativeHostMainService } from '../../native/electron-main/nativeHostMainService.js';

export const enum UpdateChannel {
Releases = 'releases',
Prereleases = 'prereleases',
Dailies = 'dailies',
Staging = 'staging',
}

export function createUpdateURL(platform: string, channel: string, productService: IProductService): string {
return `${productService.updateUrl}/${channel}/${platform}`;
//--- End Positron ---
Expand Down Expand Up @@ -93,7 +86,10 @@ export abstract class AbstractUpdateService implements IUpdateService {
*/
protected async initialize(): Promise<void> {
// --- Start Positron ---
const updateChannel = process.env.POSITRON_UPDATE_CHANNEL ?? UpdateChannel.Prereleases;
const updateChannel = process.env.POSITRON_UPDATE_CHANNEL ?? this.configurationService.getValue<string>('update.positron.channel');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would recommend emitting a log statement when we ignore the user-set value in favor of the environment variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea!

if (process.env.POSITRON_UPDATE_CHANNEL) {
this.logService.info('update#ctor - using update channel from environment variable', process.env.POSITRON_UPDATE_CHANNEL);
}
this.enableAutoUpdate = this.configurationService.getValue<boolean>('update.autoUpdate');

if (this.environmentMainService.disableUpdates) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { ChatConfiguration } from '../../chat/common/constants.js';

interface IConfiguration extends IWindowsConfiguration {
// --- Start Positron ---
update?: { mode?: string; autoUpdate?: boolean };
update?: { mode?: string; autoUpdate?: boolean; positron: { channel?: string } };
// --- End Positron ---
debug?: { console?: { wordWrap?: boolean } };
editor?: { accessibilitySupport?: 'on' | 'off' | 'auto' };
Expand Down Expand Up @@ -55,6 +55,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
'security.restrictUNCAccess',
// --- Start Positron ---
'update.autoUpdate',
'update.positron.channel',
// --- End Positron ---
'accessibility.verbosity.debug',
ChatConfiguration.UnifiedChatView,
Expand All @@ -80,6 +81,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo

// --- Start Positron ---
private readonly autoUpdate = new ChangeObserver('boolean');
private readonly updateChannel = new ChangeObserver('string');
// --- End Positron ---

constructor(
Expand Down Expand Up @@ -145,6 +147,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo

// --- Start Positron ---
processChanged(this.autoUpdate.handleChange(config.update?.autoUpdate));
processChanged(this.updateChannel.handleChange(config.update?.positron.channel));
// --- End Positron ---

// On linux turning on accessibility support will also pass this flag to the chrome renderer, thus a restart is required
Expand Down