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

fix: github copilot only shown if non stable release #12843

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
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."
4 changes: 4 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ 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 == 'workflow_dispatch' && (github.event.inputs.preid == 'alpha' || github.event.inputs.preid == 'beta') }}
yuqizhou77 marked this conversation as resolved.
Show resolved Hide resolved
run: bash .github/scripts/prerelease-feature-control.sh

- name: disable chat participant environment variable
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.preid != 'alpha') }}
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 @@ -203,11 +203,20 @@ import { createPluginWithManifest } from "./handlers/createPluginWithManifestHan
import { manifestListener } from "./manifestListener";
import { onSwitchAzureTenant, onSwitchM365Tenant } from "./handlers/accounts/switchTenantHandler";
import { kiotaRegenerate } from "./handlers/kiotaRegenerateHandler";
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 @@ -245,11 +254,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
);

await vscode.commands.executeCommand(
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);
});
});
Loading