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

refactor: modify manifests for PY templates, add CEAEnabled consume logic and add test case #12512

Merged
merged 3 commits into from
Oct 25, 2024
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
1 change: 1 addition & 0 deletions packages/fx-core/src/component/generator/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class Generator {
: "",
NewProjectTypeName: process.env.TEAMSFX_NEW_PROJECT_TYPE_NAME ?? "TeamsApp",
NewProjectTypeExt: process.env.TEAMSFX_NEW_PROJECT_TYPE_EXTENSION ?? "ttkproj",
CEAEnabled: featureFlagManager.getBooleanValue(FeatureFlags.CEAEnabled) ? "true" : "",
};
}
@hooks([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ export function getTemplateReplaceMap(inputs: Inputs): { [key: string]: string }
: "",
NewProjectTypeName: process.env.TEAMSFX_NEW_PROJECT_TYPE_NAME ?? "TeamsApp",
NewProjectTypeExt: process.env.TEAMSFX_NEW_PROJECT_TYPE_EXTENSION ?? "ttkproj",
CEAEnabled: featureFlagManager.getBooleanValue(FeatureFlags.CEAEnabled) ? "true" : "",
};
}
16 changes: 16 additions & 0 deletions packages/fx-core/tests/component/generator/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,22 @@ describe("render template", () => {
`${templateName}-${commonTemplateName}`
);
});

it("template variables when CEA enabled", async () => {
sandbox.stub(process, "env").value({ TEAMSFX_CEA_ENABLED: "true" });
const vars = newGeneratorFlag
? getTemplateReplaceMap(inputs)
: Generator.getDefaultVariables("test");
assert.equal(vars.CEAEnabled, "true");
});

it("template variables when CEA disabled", async () => {
sandbox.stub(process, "env").value({ TEAMSFX_CEA_ENABLED: "false" });
const vars = newGeneratorFlag
? getTemplateReplaceMap(inputs)
: Generator.getDefaultVariables("test");
assert.equal(vars.CEAEnabled, "");
});
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
{{#CEAEnabled}}
"$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json",
"manifestVersion": "devPreview",
"version": "1.0.0",
{{/CEAEnabled}}
{{^CEAEnabled}}
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json",
"manifestVersion": "1.17",
"version": "1.0.0",
{{/CEAEnabled}}
"id": "${{TEAMS_APP_ID}}",
"developer": {
"name": "Teams App, Inc.",
Expand All @@ -22,6 +29,16 @@
"full": "full description for {{appName}}"
},
"accentColor": "#FFFFFF",
{{#CEAEnabled}}
"copilotAgents": {
"customEngineAgents": [
{
"type": "bot",
"id": "${{BOT_ID}}"
}
]
},
{{/CEAEnabled}}
"bots": [
{
"botId": "${{BOT_ID}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ provision:
channels:
- name: msteams

{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}

# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
Expand All @@ -52,11 +54,13 @@ provision:
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}

# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,27 @@ provision:
# will use bicep CLI in PATH if you remove this config.
bicepCliVersion: v0.9.1

{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}
# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}
# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
Expand All @@ -100,23 +104,27 @@ deploy:

# Triggered when 'teamsapp publish' is executed
publish:
{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}
# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}
# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
{{#CEAEnabled}}
"$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json",
"manifestVersion": "devPreview",
"version": "1.0.0",
{{/CEAEnabled}}
{{^CEAEnabled}}
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json",
"manifestVersion": "1.17",
"version": "1.0.0",
{{/CEAEnabled}}
"id": "${{TEAMS_APP_ID}}",
"developer": {
"name": "Teams App, Inc.",
Expand All @@ -22,6 +29,16 @@
"full": "full description for {{appName}}"
},
"accentColor": "#FFFFFF",
{{#CEAEnabled}}
"copilotAgents": {
"customEngineAgents": [
{
"type": "bot",
"id": "${{BOT_ID}}"
}
]
},
{{/CEAEnabled}}
"bots": [
{
"botId": "${{BOT_ID}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ provision:
channels:
- name: msteams

{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}

# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
Expand All @@ -52,11 +54,13 @@ provision:
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}

# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,27 @@ provision:
# will use bicep CLI in PATH if you remove this config.
bicepCliVersion: v0.9.1

{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}
# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}
# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
Expand All @@ -100,23 +104,27 @@ deploy:

# Triggered when 'teamsapp publish' is executed
publish:
{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}
# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}
# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
{{#CEAEnabled}}
"$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json",
"manifestVersion": "devPreview",
"version": "1.0.0",
{{/CEAEnabled}}
{{^CEAEnabled}}
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json",
"manifestVersion": "1.17",
"version": "1.0.0",
{{/CEAEnabled}}
"id": "${{TEAMS_APP_ID}}",
"developer": {
"name": "Teams App, Inc.",
Expand All @@ -22,6 +29,16 @@
"full": "full description for {{appName}}"
},
"accentColor": "#FFFFFF",
{{#CEAEnabled}}
"copilotAgents": {
"customEngineAgents": [
{
"type": "bot",
"id": "${{BOT_ID}}"
}
]
},
{{/CEAEnabled}}
"bots": [
{
"botId": "${{BOT_ID}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ provision:
channels:
- name: msteams

{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}

# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
Expand All @@ -52,11 +54,13 @@ provision:
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}

# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
Expand Down
8 changes: 8 additions & 0 deletions templates/python/custom-copilot-basic/teamsapp.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,27 @@ provision:
# will use bicep CLI in PATH if you remove this config.
bicepCliVersion: v0.9.1

{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}
# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}
# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
Expand All @@ -100,23 +104,27 @@ deploy:

# Triggered when 'teamsapp publish' is executed
publish:
{{^CEAEnabled}}
# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
{{/CEAEnabled}}
# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputFolder: ./appPackage/build
{{^CEAEnabled}}
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/CEAEnabled}}
# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
Expand Down
Loading
Loading