diff --git a/.chronus/changes/disable-vs-build-nuget-audit-2026-8-7.md b/.chronus/changes/disable-vs-build-nuget-audit-2026-8-7.md new file mode 100644 index 00000000000..271c3071fae --- /dev/null +++ b/.chronus/changes/disable-vs-build-nuget-audit-2026-8-7.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "typespec-vs" +--- + +Disable NuGet package auditing during cross-platform Visual Studio extension builds so restores do not fail when the vulnerability feed is unavailable. diff --git a/.chronus/changes/forward-python-package-index-environment-2026-8-7.md b/.chronus/changes/forward-python-package-index-environment-2026-8-7.md new file mode 100644 index 00000000000..1bca0d34314 --- /dev/null +++ b/.chronus/changes/forward-python-package-index-environment-2026-8-7.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-python" +--- + +Forward package index and Python mirror environment variables to tox test environments so tests can install dependencies from configured feeds. diff --git a/cspell.yaml b/cspell.yaml index 4fdbe6d4b2f..fce7a455653 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -229,6 +229,7 @@ words: - pylint - pylintrc - pyodide + - pypi - pyproject - pyright - pyrightconfig diff --git a/eng/common/pipelines/templates/1es-redirect.yml b/eng/common/pipelines/templates/1es-redirect.yml index 7711cb6d7a1..00be16b2438 100644 --- a/eng/common/pipelines/templates/1es-redirect.yml +++ b/eng/common/pipelines/templates/1es-redirect.yml @@ -27,6 +27,7 @@ extends: parameters: settings: skipBuildTagsForGitHubPullRequests: true + networkIsolationPolicy: Permissive, CFSClean sdl: codeql: compiled: diff --git a/eng/common/pipelines/templates/steps/maven-authenticate.yml b/eng/common/pipelines/templates/steps/maven-authenticate.yml new file mode 100644 index 00000000000..1b84e984add --- /dev/null +++ b/eng/common/pipelines/templates/steps/maven-authenticate.yml @@ -0,0 +1,17 @@ +parameters: + SourceDirectory: $(Build.SourcesDirectory) + +steps: + # Copy mirror settings to default Maven location so all requests go through CFS + - pwsh: | + $m2Dir = if ($env:USERPROFILE) { "$env:USERPROFILE\.m2" } else { "$HOME/.m2" } + New-Item -ItemType Directory -Force -Path $m2Dir | Out-Null + Copy-Item -Path "${{ parameters.SourceDirectory }}/eng/settings.xml" -Destination "$m2Dir/settings.xml" + displayName: "Setup Maven mirror settings" + + # Authenticate with Azure Artifacts feeds + # MavenAuthenticate adds entries to ~/.m2/settings.xml matching mirror id 'azure-sdk-for-java' + - task: MavenAuthenticate@0 + displayName: "Maven Authenticate" + inputs: + artifactsFeeds: "azure-sdk-for-java" diff --git a/eng/common/pipelines/templates/steps/pypi-auth-dev-feed.yml b/eng/common/pipelines/templates/steps/pypi-auth-dev-feed.yml new file mode 100644 index 00000000000..fc2396c8448 --- /dev/null +++ b/eng/common/pipelines/templates/steps/pypi-auth-dev-feed.yml @@ -0,0 +1,49 @@ +parameters: + DevFeedName: "public/azure-sdk-for-python" + EnableTwineAuth: true + EnablePipAuth: true + EnableUvAuth: true + +steps: + - pwsh: | + # For safety default to publishing to the private feed. + # Publish to https://dev.azure.com/azure-sdk/internal/_packaging?_a=feed&feed=azure-sdk-for-python-pr + $devopsFeedName = 'internal/azure-sdk-for-python-pr' + if (-not ('$(Build.Repository.Name)').EndsWith('-pr')) { + # Publish to https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-python + $devopsFeedName = '${{ parameters.DevFeedName }}' + } + echo "##vso[task.setvariable variable=DevFeedName]$devopsFeedName" + echo "Using DevopsFeed = $devopsFeedName" + displayName: Setup DevOpsFeedName + + - ${{ if eq(parameters.EnableTwineAuth, true) }}: + - task: TwineAuthenticate@0 + displayName: "Twine Authenticate to feed" + inputs: + artifactFeeds: $(DevFeedName) + + - ${{ if eq(parameters.EnablePipAuth, true) }}: + - task: PipAuthenticate@1 + displayName: "Pip Authenticate to feed" + inputs: + artifactFeeds: $(DevFeedName) + onlyAddExtraIndex: false + + - ${{ if eq(parameters.EnableUvAuth, true) }}: + - pwsh: | + if ($env:PIP_INDEX_URL) { + Write-Host "Found pip index URL: $($env:PIP_INDEX_URL)" + # UV_DEFAULT_INDEX is the canonical replacement for the deprecated UV_INDEX_URL (uv 0.4.23+). + # PIP_INDEX_URL is set by PipAuthenticate@1 and contains embedded credentials, which uv + # will use for Basic auth against the ADO feed (and its PyPI upstream) per astral-sh/uv#12651. + Write-Host "##vso[task.setvariable variable=UV_DEFAULT_INDEX]$($env:PIP_INDEX_URL)" + # Disable keyring so uv uses the URL-embedded credentials directly. + Write-Host "##vso[task.setvariable variable=UV_KEYRING_PROVIDER]disabled" + } else { + Write-Host "##[warning]PIP_INDEX_URL not set - uv will fall back to public PyPI." + } + # Force any managed Python downloads to go directly to GitHub releases + # rather than the default CDN (releases.astral.sh). + Write-Host "##vso[task.setvariable variable=UV_PYTHON_INSTALL_MIRROR]https://github.com/astral-sh/python-build-standalone/releases/download" + displayName: "Configure UV Authentication" diff --git a/eng/emitters/pipelines/templates/steps/build-step.yml b/eng/emitters/pipelines/templates/steps/build-step.yml index d723de94d4b..580889faae7 100644 --- a/eng/emitters/pipelines/templates/steps/build-step.yml +++ b/eng/emitters/pipelines/templates/steps/build-step.yml @@ -61,6 +61,15 @@ steps: - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + - ${{ if eq(parameters.LanguageShortName, 'csharp') }}: + - task: NuGetAuthenticate@1 + + - ${{ if eq(parameters.LanguageShortName, 'python') }}: + - template: /eng/common/pipelines/templates/steps/pypi-auth-dev-feed.yml + + - ${{ if eq(parameters.LanguageShortName, 'java') }}: + - template: /eng/common/pipelines/templates/steps/maven-authenticate.yml + - task: NodeTool@0 displayName: Install Node.js retryCountOnTaskFailure: 3 @@ -68,10 +77,11 @@ steps: versionSpec: ${{ parameters.NodeVersion }} checkLatest: true - - task: UsePythonVersion@0 - displayName: "Use Python ${{ parameters.PythonVersion }}" - inputs: - versionSpec: ${{ parameters.PythonVersion }} + - ${{ if eq(parameters.LanguageShortName, 'python') }}: + - task: UsePythonVersion@0 + displayName: "Use Python ${{ parameters.PythonVersion }}" + inputs: + versionSpec: ${{ parameters.PythonVersion }} - ${{ parameters.AdditionalInitializeSteps }} diff --git a/eng/emitters/pipelines/templates/steps/test-step.yml b/eng/emitters/pipelines/templates/steps/test-step.yml index 59a2beb5689..b7ca2b5a14e 100644 --- a/eng/emitters/pipelines/templates/steps/test-step.yml +++ b/eng/emitters/pipelines/templates/steps/test-step.yml @@ -53,6 +53,15 @@ steps: - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + - ${{ if eq(parameters.LanguageShortName, 'csharp') }}: + - task: NuGetAuthenticate@1 + + - ${{ if eq(parameters.LanguageShortName, 'python') }}: + - template: /eng/common/pipelines/templates/steps/pypi-auth-dev-feed.yml + + - ${{ if eq(parameters.LanguageShortName, 'java') }}: + - template: /eng/common/pipelines/templates/steps/maven-authenticate.yml + - download: current artifact: ${{ parameters.BuildArtifactName }} displayName: Download build artifacts @@ -64,10 +73,11 @@ steps: versionSpec: ${{ parameters.NodeVersion }} checkLatest: true - - task: UsePythonVersion@0 - displayName: "Use Python ${{ parameters.PythonVersion }}" - inputs: - versionSpec: ${{ parameters.PythonVersion }} + - ${{ if eq(parameters.LanguageShortName, 'python') }}: + - task: UsePythonVersion@0 + displayName: "Use Python ${{ parameters.PythonVersion }}" + inputs: + versionSpec: ${{ parameters.PythonVersion }} - ${{ parameters.AdditionalInitializeSteps }} diff --git a/eng/nuget.config b/eng/nuget.config new file mode 100644 index 00000000000..c679a5601f0 --- /dev/null +++ b/eng/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/eng/settings.xml b/eng/settings.xml new file mode 100644 index 00000000000..b1941716f65 --- /dev/null +++ b/eng/settings.xml @@ -0,0 +1,13 @@ + + + + azure-sdk-for-java + Azure Artifacts Maven Mirror + https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-java/maven/v1 + external:* + + + diff --git a/eng/tsp-core/pipelines/pr-tools.yml b/eng/tsp-core/pipelines/pr-tools.yml index 371bcd46340..af7efb8d499 100644 --- a/eng/tsp-core/pipelines/pr-tools.yml +++ b/eng/tsp-core/pipelines/pr-tools.yml @@ -80,6 +80,8 @@ extends: displayName: Create TryIt comment dependsOn: tryit steps: + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + - pwsh: | $curlCommand = 'curl -s -u :$(System.AccessToken) "$(System.TeamFoundationCollectionUri)/$(System.TeamProject)/_apis/build/builds/$(Build.BuildId)/artifacts?artifactName=vscode-extension"' $response = Invoke-Expression $curlCommand diff --git a/eng/tsp-core/pipelines/templates/install.yml b/eng/tsp-core/pipelines/templates/install.yml index 7820c3a411a..07a194615c9 100644 --- a/eng/tsp-core/pipelines/templates/install.yml +++ b/eng/tsp-core/pipelines/templates/install.yml @@ -37,6 +37,6 @@ steps: retryCountOnTaskFailure: 3 - ${{ if parameters.useDotNet }}: - - script: dotnet restore + - script: dotnet restore --configfile "$(Build.SourcesDirectory)/eng/nuget.config" displayName: Restore .NET Dependencies workingDirectory: packages/typespec-vs diff --git a/packages/http-client-csharp/eng/scripts/Build-Packages.ps1 b/packages/http-client-csharp/eng/scripts/Build-Packages.ps1 index e606da1c6f5..69c9e98c52d 100644 --- a/packages/http-client-csharp/eng/scripts/Build-Packages.ps1 +++ b/packages/http-client-csharp/eng/scripts/Build-Packages.ps1 @@ -47,7 +47,10 @@ function Pack-And-Write-Info { ) $versionOption = $BuildNumber ? "/p:Version=$version" : "" - Invoke-LoggedCommand "dotnet pack ./$package/src/$package.csproj $versionOption -c Release -o $outputPath/packages" + $ciNugetAuditArg = $env:TF_BUILD ? "-p:NuGetAudit=false" : "" + $repoRoot = (Resolve-Path "$packageRoot/../..").Path + $nugetConfigPath = (Join-Path $repoRoot "eng/nuget.config") + Invoke-LoggedCommand "dotnet pack ./$package/src/$package.csproj $versionOption -p:RestoreConfigFile=`"$nugetConfigPath`" $ciNugetAuditArg -c Release -o $outputPath/packages" Write-PackageInfo -packageName $package -directoryPath "packages/http-client-csharp/generator/$package/src" -version $version } @@ -109,7 +112,24 @@ Push-Location "$packageRoot" try { Write-Host "Working in $PWD" - Invoke-LoggedCommand "npm run build" -GroupOutput + # Ensure nested dotnet builds (invoked via `npm run build:generator`) use the repo NuGet.Config + # so restore always targets the Azure DevOps feed instead of nuget.org. + $repoRoot = (Resolve-Path "$packageRoot/../..").Path + $nugetConfigPath = (Join-Path $repoRoot "eng/nuget.config") + $previousRestoreConfigFile = $env:RestoreConfigFile + $previousNuGetAudit = $env:NuGetAudit + try { + $env:RestoreConfigFile = $nugetConfigPath + if ($env:TF_BUILD) { + $env:NuGetAudit = "false" + } + + Invoke-LoggedCommand "npm run build" -GroupOutput + } + finally { + $env:RestoreConfigFile = $previousRestoreConfigFile + $env:NuGetAudit = $previousNuGetAudit + } Copy-Item "$packageRoot/emitter/temp/*.api.json" -Destination "$outputPath/packages" diff --git a/packages/http-client-csharp/eng/scripts/Test-Packages.ps1 b/packages/http-client-csharp/eng/scripts/Test-Packages.ps1 index bb0c24c43fe..4a33a3081ef 100644 --- a/packages/http-client-csharp/eng/scripts/Test-Packages.ps1 +++ b/packages/http-client-csharp/eng/scripts/Test-Packages.ps1 @@ -13,10 +13,24 @@ $packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/') Set-ConsoleEncoding Push-Location $packageRoot +$repoRoot = (Resolve-Path "$packageRoot/../..").Path +$nugetConfigPath = (Join-Path $repoRoot "eng/nuget.config") +$ciNugetAuditArg = $env:TF_BUILD ? "-p:NuGetAudit=false" : "" +$previousRestoreConfigFile = $env:RestoreConfigFile +$previousNuGetAudit = $env:NuGetAudit try { + # Ensure all dotnet processes, including those spawned by npm scripts and generation, + # restore through the repository's Azure DevOps feed instead of nuget.org. + $env:RestoreConfigFile = $nugetConfigPath + if ($env:TF_BUILD) { + $env:NuGetAudit = "false" + } + if ($UnitTests) { Push-Location "$packageRoot" try { + Invoke-LoggedCommand "dotnet nuget list source --configfile `"$nugetConfigPath`"" -GroupOutput + # test the emitter Invoke-LoggedCommand "npm run build" -GroupOutput Invoke-LoggedCommand "npm run test:emitter" -GroupOutput @@ -25,7 +39,7 @@ try { Invoke-LoggedCommand "./eng/scripts/Invoke-Cop.ps1" -GroupOutput # test the generator - Invoke-LoggedCommand "dotnet test ./generator" -GroupOutput + Invoke-LoggedCommand "dotnet test ./generator -p:RestoreConfigFile=`"$nugetConfigPath`" $ciNugetAuditArg" -GroupOutput Invoke-LoggedCommand "./eng/scripts/Get-Spector-Coverage.ps1" -GroupOutput } @@ -64,5 +78,7 @@ try { } } finally { + $env:RestoreConfigFile = $previousRestoreConfigFile + $env:NuGetAudit = $previousNuGetAudit Pop-Location } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/GeneratedCodeWorkspaceTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/GeneratedCodeWorkspaceTests.cs index 66ac281be15..b4eaa0446c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/GeneratedCodeWorkspaceTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/GeneratedCodeWorkspaceTests.cs @@ -14,6 +14,7 @@ namespace Microsoft.TypeSpec.Generator.Tests { + [NonParallelizable] public class GeneratedCodeWorkspaceTests { private const string EvaluatedFrameworkTestCategory = "WithEvaluatedFrameworkValue"; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/StartUp/GeneratorHandlerTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/StartUp/GeneratorHandlerTests.cs index 3f21af6cd66..a397a7e1657 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/StartUp/GeneratorHandlerTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/StartUp/GeneratorHandlerTests.cs @@ -251,7 +251,7 @@ public void ReadProcessOutput_DrainsStandardOutputAndErrorConcurrently() Console.Out.Write("stdout"); """); - using var buildProcess = Process.Start(new ProcessStartInfo("dotnet") + var buildStartInfo = new ProcessStartInfo("dotnet") { UseShellExecute = false, ArgumentList = @@ -264,7 +264,11 @@ public void ReadProcessOutput_DrainsStandardOutputAndErrorConcurrently() "--verbosity", "quiet" } - }); + }; + AppendMsBuildPropertyIfSet(buildStartInfo.ArgumentList, "RestoreConfigFile", "RestoreConfigFile"); + AppendMsBuildPropertyIfSet(buildStartInfo.ArgumentList, "NuGetAudit", "NuGetAudit"); + + using var buildProcess = Process.Start(buildStartInfo); Assert.IsNotNull(buildProcess); buildProcess!.WaitForExit(); Assert.AreEqual(0, buildProcess.ExitCode); @@ -940,6 +944,18 @@ namespace Isolated { public class Dummy { } }"); "; + private static void AppendMsBuildPropertyIfSet( + System.Collections.ObjectModel.Collection argumentList, + string envVarName, + string propertyName) + { + var value = Environment.GetEnvironmentVariable(envVarName, EnvironmentVariableTarget.Process); + if (!string.IsNullOrWhiteSpace(value)) + { + argumentList.Add($"-p:{propertyName}={value}"); + } + } + /// Creates a unique temp directory and removes it on dispose. private sealed class TempDirectory : IDisposable { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Utilities/ExternalTypeReferenceResolverTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Utilities/ExternalTypeReferenceResolverTests.cs index 65966107ab2..b94a50c5836 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Utilities/ExternalTypeReferenceResolverTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Utilities/ExternalTypeReferenceResolverTests.cs @@ -21,6 +21,7 @@ public class ExternalTypeReferenceResolverTests { private string? _tempDirectory; private string? _projectDir; + private string? _nugetCacheDir; private string? _originalNugetPackageDir; [SetUp] @@ -28,14 +29,18 @@ public void Setup() { _tempDirectory = Path.Combine(Path.GetTempPath(), "TestArtifacts", Guid.NewGuid().ToString()); _projectDir = Path.Combine(_tempDirectory, "ProjectDir"); - var nugetCacheDir = Path.Combine(_tempDirectory, "NuGetCache"); + _nugetCacheDir = Path.Combine(_tempDirectory, "NuGetCache"); Directory.CreateDirectory(Path.Combine(_projectDir, "src")); - Directory.CreateDirectory(nugetCacheDir); + Directory.CreateDirectory(_nugetCacheDir); + + // Ensure these tests are fully isolated from machine/user NuGet settings and never probe + // external feeds when package lookup falls through to source probing. + WriteLocalNuGetConfig(_projectDir, _nugetCacheDir); _originalNugetPackageDir = Environment.GetEnvironmentVariable("NUGET_PACKAGES", EnvironmentVariableTarget.Process); - Environment.SetEnvironmentVariable("NUGET_PACKAGES", nugetCacheDir, EnvironmentVariableTarget.Process); + Environment.SetEnvironmentVariable("NUGET_PACKAGES", _nugetCacheDir, EnvironmentVariableTarget.Process); - ExternalTypeReferenceResolver.Reset(); + ResetResolverIfInitialized(); MockHelpers.LoadMockGenerator( outputPath: _projectDir, configuration: "{}"); @@ -44,7 +49,7 @@ public void Setup() [TearDown] public void Cleanup() { - ExternalTypeReferenceResolver.Reset(); + ResetResolverIfInitialized(); Directory.Delete(_tempDirectory!, true); Environment.SetEnvironmentVariable("NUGET_PACKAGES", _originalNugetPackageDir, EnvironmentVariableTarget.Process); } @@ -65,10 +70,9 @@ public void TryResolve_ReturnsNullWhenPackageMissing() [Test] public void TryResolve_LoadsTypeFromNuGetCache() { - var nugetCacheDir = Path.Combine(_tempDirectory!, "NuGetCache"); const string pkgName = "Test.External.Loadable"; const string typeName = "Test.External.Loadable.LoadableType"; - CreateFakeNuGetPackage(nugetCacheDir, pkgName, "1.2.3"); + CreateFakeNuGetPackage(_nugetCacheDir!, pkgName, "1.2.3"); var external = new InputExternalTypeMetadata(typeName, pkgName, null); @@ -81,14 +85,13 @@ public void TryResolve_LoadsTypeFromNuGetCache() [Test] public void TryResolve_PrefersHighestCachedVersionAtOrAboveMinVersion() { - var nugetCacheDir = Path.Combine(_tempDirectory!, "NuGetCache"); const string pkgName = "Test.MultiVersion.Package"; const string typeName = "Test.MultiVersion.Package.SomeType"; // Create three cached versions; MinVersion=2.0.0 must skip 1.0.0 and pick 3.0.0 (highest >= MinVersion). - CreateFakeNuGetPackage(nugetCacheDir, pkgName, "1.0.0"); - CreateFakeNuGetPackage(nugetCacheDir, pkgName, "2.5.0"); - CreateFakeNuGetPackage(nugetCacheDir, pkgName, "3.0.0"); + CreateFakeNuGetPackage(_nugetCacheDir!, pkgName, "1.0.0"); + CreateFakeNuGetPackage(_nugetCacheDir!, pkgName, "2.5.0"); + CreateFakeNuGetPackage(_nugetCacheDir!, pkgName, "3.0.0"); var external = new InputExternalTypeMetadata(typeName, pkgName, "2.0.0"); var resolved = ExternalTypeReferenceResolver.TryResolve(external); @@ -105,10 +108,9 @@ public void TryResolve_PrefersHighestCachedVersionAtOrAboveMinVersion() [Test] public void TryResolve_AddsMetadataReferenceOnce() { - var nugetCacheDir = Path.Combine(_tempDirectory!, "NuGetCache"); const string pkgName = "Test.MetadataRef.Package"; const string typeName = "Test.MetadataRef.Package.RefType"; - CreateFakeNuGetPackage(nugetCacheDir, pkgName, "1.0.0"); + CreateFakeNuGetPackage(_nugetCacheDir!, pkgName, "1.0.0"); var external = new InputExternalTypeMetadata(typeName, pkgName, null); @@ -216,10 +218,9 @@ public void TryResolve_ReportsFailureReasonWhenTypeMissingFromAssembly() [Test] public async Task ResolveAllAsync_ResolvesExternalTypesFromInputLibrary() { - var nugetCacheDir = Path.Combine(_tempDirectory!, "NuGetCache"); const string pkgName = "Test.PreWalk.Package"; const string typeName = "Test.PreWalk.Package.PreWalkType"; - CreateFakeNuGetPackage(nugetCacheDir, pkgName, "1.0.0"); + CreateFakeNuGetPackage(_nugetCacheDir!, pkgName, "1.0.0"); var external = new InputExternalTypeMetadata(typeName, pkgName, null); var unionWithExternal = InputFactory.Union( @@ -274,5 +275,35 @@ private static string CreateFakeNuGetPackage( return FakeNuGetPackage.Create( nugetCacheDir, packageName, version, source, referencedAssemblyPaths, dependencies); } + + private static void WriteLocalNuGetConfig(string projectDir, string nugetCacheDir) + { + var nugetConfigPath = Path.Combine(projectDir, "NuGet.Config"); + var normalizedCachePath = nugetCacheDir.Replace("\\", "/"); + var config = $@" + + + + + + + + +"; + + File.WriteAllText(nugetConfigPath, config); + } + + private static void ResetResolverIfInitialized() + { + try + { + ExternalTypeReferenceResolver.Reset(); + } + catch (InvalidOperationException) + { + // CodeModelGenerator may not be initialized yet when this fixture runs in isolation. + } + } } } diff --git a/packages/http-client-python/tests/tox.ini b/packages/http-client-python/tests/tox.ini index b661dd5afcd..29dde03686a 100644 --- a/packages/http-client-python/tests/tox.ini +++ b/packages/http-client-python/tests/tox.ini @@ -12,6 +12,12 @@ setenv = FLAVOR = {envname} passenv = FOLDER + PIP_INDEX_URL + PIP_EXTRA_INDEX_URL + UV_DEFAULT_INDEX + UV_INDEX_URL + UV_KEYRING_PROVIDER + UV_PYTHON_INSTALL_MIRROR # ============================================================================= # Test environments diff --git a/packages/typespec-vs/scripts/build.ts b/packages/typespec-vs/scripts/build.ts index 04d508d2714..34cb07ae94e 100644 --- a/packages/typespec-vs/scripts/build.ts +++ b/packages/typespec-vs/scripts/build.ts @@ -34,7 +34,15 @@ async function main() { if (result.type === "dotnet") { await ensureDotnetVersion({ exitWithSuccessInDevBuilds: true }); await runDotnet( - ["build", "--configuration", "Release", `-p:Version=${version}`, "-clp:NoSummary"], + [ + "build", + "--configuration", + "Release", + `-p:Version=${version}`, + "-clp:NoSummary", + // Restore may fail with NU1900 when vulnerability feed is unavailable. + "-p:NuGetAudit=false", + ], { cwd: pkgRoot, }, @@ -58,7 +66,9 @@ async function buildWithMsbuild(msbuildPath: string, pkgRoot: string, version: s msbuildArgs.push("/restore"); } msbuildArgs.push(join(pkgRoot, "Microsoft.TypeSpec.VS.sln")); - const result = await run(msbuildPath, msbuildArgs, { throwOnNonZeroExit: false }); + const result = await run(msbuildPath, msbuildArgs, { + throwOnNonZeroExit: false, + }); process.exit(result.exitCode); }