-
Notifications
You must be signed in to change notification settings - Fork 96
fix(vscode): Updated bundle feed to use index.json instead of index-v2.json #8807
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ import { getLocalSettingsJson } from './appSettings/localSettings'; | |
| import { downloadAndExtractDependency } from './binaries'; | ||
| import { getJsonFeed } from './feed'; | ||
| import type { IActionContext } from '@microsoft/vscode-azext-utils'; | ||
| import type { IBundleDependencyFeed, IBundleFeed, IBundleMetadata, IHostJsonV2 } from '@microsoft/vscode-extension-logic-apps'; | ||
| import type { IBundleDependencyFeed, IBundleMetadata, IHostJsonV2 } from '@microsoft/vscode-extension-logic-apps'; | ||
| import * as path from 'path'; | ||
| import * as semver from 'semver'; | ||
| import * as vscode from 'vscode'; | ||
|
|
@@ -16,38 +16,16 @@ import { ext } from '../../extensionVariables'; | |
| import { getFunctionsCommand } from './funcCoreTools/funcVersion'; | ||
| import * as fse from 'fs-extra'; | ||
| import { executeCommand } from './funcCoreTools/cpUtils'; | ||
| /** | ||
| * Gets bundle extension feed. | ||
| * @param {IActionContext} context - Command context. | ||
| * @param {IBundleMetadata | undefined} bundleMetadata - Bundle meta data. | ||
| * @returns {Promise<IBundleFeed>} Returns bundle extension object. | ||
| */ | ||
| async function getBundleFeed(context: IActionContext, bundleMetadata: IBundleMetadata | undefined): Promise<IBundleFeed> { | ||
| const bundleId: string = (bundleMetadata && bundleMetadata.id) || extensionBundleId; | ||
|
|
||
| const envVarUri: string | undefined = process.env.FUNCTIONS_EXTENSIONBUNDLE_SOURCE_URI; | ||
| // Only use an aka.ms link for the most common case, otherwise we will dynamically construct the url | ||
| let url: string; | ||
| if (!envVarUri && bundleId === extensionBundleId) { | ||
| url = 'https://aka.ms/AAqvc78'; | ||
| } else { | ||
| const baseUrl: string = envVarUri || 'https://cdn.functions.azure.com/public'; | ||
| url = `${baseUrl}/ExtensionBundles/${bundleId}/index-v2.json`; | ||
| } | ||
|
|
||
| return getJsonFeed(context, url); | ||
| } | ||
|
|
||
| /** | ||
| * Gets Workflow bundle extension feed. | ||
| * @param {IActionContext} context - Command context. | ||
| * @param {IBundleMetadata | undefined} bundleMetadata - Bundle meta data. | ||
| * @returns {Promise<IBundleFeed>} Returns bundle extension object. | ||
| * @returns {Promise<string[]>} Returns array of available bundle versions. | ||
| */ | ||
| async function getWorkflowBundleFeed(context: IActionContext): Promise<IBundleFeed> { | ||
| async function getWorkflowBundleFeed(context: IActionContext): Promise<string[]> { | ||
| const envVarUri: string | undefined = process.env.FUNCTIONS_EXTENSIONBUNDLE_SOURCE_URI; | ||
| const baseUrl: string = envVarUri || 'https://cdn.functions.azure.com/public'; | ||
| const url = `${baseUrl}/ExtensionBundles/${extensionBundleId}/index-v2.json`; | ||
| const url = `${baseUrl}/ExtensionBundles/${extensionBundleId}/index.json`; | ||
|
|
||
| return getJsonFeed(context, url); | ||
| } | ||
|
Comment on lines
+25
to
31
|
||
|
|
@@ -56,7 +34,7 @@ async function getWorkflowBundleFeed(context: IActionContext): Promise<IBundleFe | |
| * Gets extension bundle dependency feed. | ||
| * @param {IActionContext} context - Command context. | ||
| * @param {IBundleMetadata | undefined} bundleMetadata - Bundle meta data. | ||
| * @returns {Promise<IBundleFeed>} Returns bundle extension object. | ||
| * @returns {Promise<IBundleDependencyFeed>} Returns bundle extension object. | ||
| */ | ||
| async function getBundleDependencyFeed( | ||
| context: IActionContext, | ||
|
|
@@ -77,12 +55,10 @@ async function getBundleDependencyFeed( | |
|
|
||
| /** | ||
| * Gets latest bundle extension version range. | ||
| * @param {IActionContext} context - Command context. | ||
| * @returns {Promise<string>} Returns lates version range. | ||
| * @returns {string} Returns latest version range. | ||
| */ | ||
| export async function getLatestVersionRange(context: IActionContext): Promise<string> { | ||
| const feed: IBundleFeed = await getBundleFeed(context, undefined); | ||
| return feed.defaultVersionRange; | ||
| export function getLatestVersionRange(): string { | ||
| return defaultVersionRange; | ||
| } | ||
|
Comment on lines
56
to
62
|
||
|
|
||
| /** | ||
|
|
@@ -97,20 +73,12 @@ export async function getDependenciesVersion(context: IActionContext): Promise<I | |
|
|
||
| /** | ||
| * Add bundle extension version to host.json configuration. | ||
| * @param {IActionContext} context - Command context. | ||
| * @param {IHostJsonV2} hostJson - Host.json configuration. | ||
| */ | ||
| export async function addDefaultBundle(context: IActionContext, hostJson: IHostJsonV2): Promise<void> { | ||
| let versionRange: string; | ||
| try { | ||
| versionRange = await getLatestVersionRange(context); | ||
| } catch { | ||
| versionRange = defaultVersionRange; | ||
| } | ||
|
|
||
| export function addDefaultBundle(hostJson: IHostJsonV2): void { | ||
| hostJson.extensionBundle = { | ||
| id: extensionBundleId, | ||
| version: versionRange, | ||
| version: defaultVersionRange, | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -191,8 +159,8 @@ export async function downloadExtensionBundle(context: IActionContext): Promise< | |
|
|
||
| // Check the latest from feed. | ||
| let latestFeedBundleVersion = '1.0.0'; | ||
| const feed: IBundleFeed = await getWorkflowBundleFeed(context); | ||
| for (const bundleVersion in feed.bundleVersions) { | ||
| const feedVersions: string[] = await getWorkflowBundleFeed(context); | ||
| for (const bundleVersion of feedVersions) { | ||
| latestFeedBundleVersion = semver.gt(latestFeedBundleVersion, bundleVersion) ? latestFeedBundleVersion : bundleVersion; | ||
| } | ||
|
Comment on lines
+162
to
165
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the "should preserve other host.json properties" test,
hostJsonis typed asIHostJsonV2but theloggingobject you provide useslogLevel.default, which doesn’t match theIHostJsonV2['logging']shape (it expectsapplicationInsights.samplingSettings...). This will fail type-checking; either use a property that exists onIHostJsonV2(e.g.,managedDependency,extensions, or the supportedlogging.applicationInsightsstructure) or relax the test’s typing for that specific case.