diff --git a/.github/scripts/prerelease-feature-control.sh b/.github/scripts/prerelease-feature-control.sh new file mode 100644 index 0000000000..2b5d3f73f4 --- /dev/null +++ b/.github/scripts/prerelease-feature-control.sh @@ -0,0 +1,5 @@ +#!/bin/bash +filePath=packages/vscode-extension/src/releaseBasedFeatureSettings.ts +echo "Update feature settings in $filePath if alpha or beta release" +sed -i -e "s@const shouldEnableTeamsCopilotChatUI = false@const shouldEnableTeamsCopilotChatUI = true@g" $filePath +echo "Prerelease feature setting update done." diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1d0c0ae084..2d81704b13 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -174,7 +174,14 @@ jobs: run: | git add packages/fx-core/src/component/m365/serviceConstant.ts git commit -m "build: replace sideloading placeholders" - + + - name: enable prerelease only features + if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && (github.event.inputs.preid == 'alpha' || github.event.inputs.preid == 'beta')) }} + run: | + bash .github/scripts/prerelease-feature-control.sh + git add ./packages/vscode-extension/src/releaseBasedFeatureSettings.ts + git commit -m "build: adjust prerelease feature settings" + - name: disable chat participant environment variable if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.preid != 'alpha') }} run: bash .github/scripts/chat-participant-disabled.sh diff --git a/packages/vscode-extension/src/extension.ts b/packages/vscode-extension/src/extension.ts index 196deb727b..0db53075b5 100644 --- a/packages/vscode-extension/src/extension.ts +++ b/packages/vscode-extension/src/extension.ts @@ -201,11 +201,20 @@ import { getSettingsVersion, projectVersionCheck } from "./utils/telemetryUtils" import { createPluginWithManifest } from "./handlers/createPluginWithManifestHandler"; import { manifestListener } from "./manifestListener"; import { onSwitchAzureTenant, onSwitchM365Tenant } from "./handlers/accounts/switchTenantHandler"; +import { releaseControlledFeatureSettings } from "./releaseBasedFeatureSettings"; export async function activate(context: vscode.ExtensionContext) { const value = IsChatParticipantEnabled && semver.gte(vscode.version, "1.90.0"); featureFlagManager.setBooleanValue(FeatureFlags.ChatParticipant, value); + // control whether to show chat participant ui entries + const shouldEnableChatParticipantUIEntries = + releaseControlledFeatureSettings.shouldEnableTeamsCopilotChatUI; + featureFlagManager.setBooleanValue( + CoreFeatureFlags.ChatParticipantUIEntries, + shouldEnableChatParticipantUIEntries + ); + context.subscriptions.push(new ExtTelemetry.Reporter(context)); configMgr.registerConfigChangeCallback(); @@ -243,11 +252,10 @@ export async function activate(context: vscode.ExtensionContext) { // UI is ready to show & interact await vscode.commands.executeCommand("setContext", "fx-extension.isTeamsFx", isTeamsFxProject); - // control whether to show chat participant ui entries await vscode.commands.executeCommand( "setContext", "fx-extension.isChatParticipantUIEntriesEnabled", - featureFlagManager.getBooleanValue(CoreFeatureFlags.ChatParticipantUIEntries) + shouldEnableChatParticipantUIEntries ); // Flags for "Build Intelligent Apps" walkthrough. diff --git a/packages/vscode-extension/src/releaseBasedFeatureSettings.ts b/packages/vscode-extension/src/releaseBasedFeatureSettings.ts new file mode 100644 index 0000000000..994d8047ee --- /dev/null +++ b/packages/vscode-extension/src/releaseBasedFeatureSettings.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// This file list feature flag settings that should be handled during release. For example, if we want to have a feature being enabled only on alpha and beta version. +// Please do not edit this file except introducing new feature flag settings. +// During cd, we will modify the value of the feature flag settings in this file. +// Please list each setting line by line. The default value should be the expected value in stable release, which is false usually. +const shouldEnableTeamsCopilotChatUI = false; + +export const releaseControlledFeatureSettings = { + shouldEnableTeamsCopilotChatUI, +}; diff --git a/packages/vscode-extension/test/releaseBasedFeatureSettings.test.ts b/packages/vscode-extension/test/releaseBasedFeatureSettings.test.ts new file mode 100644 index 0000000000..b56fd25918 --- /dev/null +++ b/packages/vscode-extension/test/releaseBasedFeatureSettings.test.ts @@ -0,0 +1,9 @@ +import * as chai from "chai"; +import { releaseControlledFeatureSettings } from "../src/releaseBasedFeatureSettings"; + +describe("releaseControlledFeatureSettings", () => { + it("verify default values", async () => { + const settings = releaseControlledFeatureSettings; + chai.assert.isFalse(settings.shouldEnableTeamsCopilotChatUI); + }); +});