Skip to content

Commit

Permalink
Merge pull request #12885 from OfficeDev/yuqzho/stable-gce
Browse files Browse the repository at this point in the history
build: GitHub Copilot feature only in prerelease version
  • Loading branch information
MSFT-yiz authored Dec 10, 2024
2 parents b44a1ea + b128602 commit c9080aa
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/scripts/prerelease-feature-control.sh
Original file line number Diff line number Diff line change
@@ -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."
9 changes: 8 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions packages/vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions packages/vscode-extension/src/releaseBasedFeatureSettings.ts
Original file line number Diff line number Diff line change
@@ -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,
};
Original file line number Diff line number Diff line change
@@ -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);
});
});

0 comments on commit c9080aa

Please sign in to comment.