Skip to content

Commit

Permalink
Hardcode default bundle version (#3727)
Browse files Browse the repository at this point in the history
* Hardcode default bundle version

* Fixup
  • Loading branch information
alexweininger authored Jun 26, 2023
1 parent 4dedc34 commit ff5b075
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/utils/bundleFeedUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export namespace bundleFeedUtils {

const feed: IBundleFeed = await getBundleFeed(context, bundleMetadata);
const validVersions: string[] = Object.keys(feed.bundleVersions).filter((v: string) => !!semver.valid(v));
const bundleVersion: string | undefined = nugetUtils.tryGetMaxInRange(bundleMetadata.version || feed.defaultVersionRange, validVersions);
const bundleVersion: string | undefined = nugetUtils.tryGetMaxInRange(bundleMetadata.version || await getLatestVersionRange(context), validVersions);
if (!bundleVersion) {
throw new Error(localize('failedToFindBundleVersion', 'Failed to find bundle version satisfying range "{0}".', bundleMetadata.version));
} else {
Expand All @@ -60,9 +60,12 @@ export namespace bundleFeedUtils {
return (!template.isHttpTrigger && !template.isTimerTrigger) || bundleTemplateTypes.some(t => isTemplateOfType(template, t));
}

export async function getLatestVersionRange(context: IActionContext): Promise<string> {
const feed: IBundleFeed = await getBundleFeed(context, undefined);
return feed.defaultVersionRange;
export async function getLatestVersionRange(_context: IActionContext): Promise<string> {
// const feed: IBundleFeed = await getBundleFeed(context, undefined);
// return feed.defaultVersionRange;
// New default bundle version causes issues (ex: /~https://github.com/microsoft/vscode-azurefunctions/issues/3711)
// Using old version range as seen in /~https://github.com/Azure/azure-functions-host/pull/9324
return '[3.*, 4.0.0)';
}

export async function addDefaultBundle(context: IActionContext, hostJson: IHostJsonV2): Promise<void> {
Expand Down

0 comments on commit ff5b075

Please sign in to comment.