Skip to content

Commit 4609ba6

Browse files
edvilmeMirroringvseanreesermsftdotnet-maestro[bot]v-wuzhai
authored
[automated] Merge branch 'release/9.0.2xx' => 'release/9.0.3xx' (#47434)
Co-authored-by: Mirroring <[email protected]> Co-authored-by: ProductConstructionServiceProd <ProductConstructionServiceProd> Co-authored-by: Sean Reeser (CSI Interfusion Inc) <[email protected]> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Jason Zhai <[email protected]> Co-authored-by: Eduardo Villalpando Mello <[email protected]> Co-authored-by: Forgind <[email protected]> Co-authored-by: Noah Gilson <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Nikola Milosavljevic <[email protected]> Co-authored-by: vseanreesermsft <[email protected]> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Marc Paine <[email protected]> Co-authored-by: Noah Gilson <[email protected]>
2 parents fd7c50b + 1828045 commit 4609ba6

File tree

5 files changed

+52
-12
lines changed

5 files changed

+52
-12
lines changed

.github/workflows/pr-analysis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: PR Analysis
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, labeled, unlabeled]
5+
permissions:
6+
contents: read
7+
pull-requests: read
8+
jobs:
9+
allowed-labels:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Return error if branch is in lockdown or 'do not merge' label is present
13+
run: echo "Labels on this PR prevent it from being merged. Please contact the repo owners for more information." && exit 1
14+
if: ${{ contains(github.event.pull_request.labels.*.name, 'Branch Lockdown') || contains(github.event.pull_request.labels.*.name, 'DO NOT MERGE') }}

src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ internal class NuGetPackageDownloader : INuGetPackageDownloader
3838
private readonly Dictionary<PackageSource, SourceRepository> _sourceRepositories;
3939
private readonly bool _shouldUsePackageSourceMapping;
4040

41+
/// <summary>
42+
/// If true, the package downloader will verify the signatures of the packages it downloads.
43+
/// Temporarily disabled for macOS and Linux.
44+
/// </summary>
4145
private readonly bool _verifySignatures;
4246
private readonly VerbosityOptions _verbosityOptions;
4347
private readonly string _currentWorkingDirectory;
@@ -65,7 +69,9 @@ public NuGetPackageDownloader(
6569
_restoreActionConfig = restoreActionConfig ?? new RestoreActionConfig();
6670
_retryTimer = timer;
6771
_sourceRepositories = new();
68-
_verifySignatures = verifySignatures;
72+
// If windows or env variable is set, verify signatures
73+
_verifySignatures = verifySignatures && (OperatingSystem.IsWindows() ? true
74+
: bool.TryParse(Environment.GetEnvironmentVariable(NuGetSignatureVerificationEnabler.DotNetNuGetSignatureVerification), out var shouldVerifySignature) ? shouldVerifySignature : OperatingSystem.IsLinux());
6975

7076
_cacheSettings = new SourceCacheContext
7177
{
@@ -130,8 +136,17 @@ public async Task<string> DownloadPackageAsync(PackageId packageId,
130136
packageVersion.ToNormalizedString()));
131137
}
132138

133-
await VerifySigning(nupkgPath, repository);
134-
139+
// Delete file if verification fails
140+
try
141+
{
142+
await VerifySigning(nupkgPath, repository);
143+
}
144+
catch (NuGetPackageInstallerException)
145+
{
146+
File.Delete(nupkgPath);
147+
throw;
148+
}
149+
135150
return nupkgPath;
136151
}
137152

src/Cli/dotnet/ReleasePropertyProjectLocator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public IEnumerable<string> GetCustomDefaultConfigurationValueIfSpecified()
176176
Parallel.ForEach(sln.SolutionProjects.AsEnumerable(), (project, state) =>
177177
{
178178
#pragma warning disable CS8604 // Possible null reference argument.
179-
string projectFullPath = Path.Combine(Path.GetDirectoryName(slnFullPath), project.FilePath);
179+
string projectFullPath = Path.GetFullPath(project.FilePath, Path.GetDirectoryName(slnFullPath));
180180
#pragma warning restore CS8604 // Possible null reference argument.
181181
if (IsUnanalyzableProjectInSolution(project, projectFullPath))
182182
return;
@@ -220,7 +220,7 @@ public IEnumerable<string> GetCustomDefaultConfigurationValueIfSpecified()
220220
foreach (var project in sln.SolutionProjects.AsEnumerable())
221221
{
222222
#pragma warning disable CS8604 // Possible null reference argument.
223-
string projectFullPath = Path.Combine(Path.GetDirectoryName(slnPath), project.FilePath);
223+
string projectFullPath = Path.GetFullPath(project.FilePath, Path.GetDirectoryName(slnPath));
224224
#pragma warning restore CS8604 // Possible null reference argument.
225225
if (IsUnanalyzableProjectInSolution(project, projectFullPath))
226226
continue;

src/Cli/dotnet/commands/dotnet-workload/restore/WorkloadRestoreCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ internal static List<string> DiscoverAllProjects(string currentDirectory,
136136
.Select(Path.GetFullPath).ToList();
137137
}
138138

139-
foreach (string file in slnFiles)
139+
foreach (string solutionFilePath in slnFiles)
140140
{
141-
var solutionFile = SlnFileFactory.CreateFromFileOrDirectory(file);
142-
projectFiles.AddRange(solutionFile.SolutionProjects.Select(p => p.FilePath));
141+
var solutionFile = SlnFileFactory.CreateFromFileOrDirectory(solutionFilePath);
142+
projectFiles.AddRange(solutionFile.SolutionProjects.Select(
143+
p => Path.GetFullPath(p.FilePath, Path.GetDirectoryName(solutionFilePath))));
143144
}
144145

145146
if (projectFiles.Count == 0)

src/SourceBuild/content/eng/finish-source-only.proj

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,22 @@
114114
Outputs="$(BaseIntermediateOutputPath)ReportPoisonUsage.complete" >
115115
<ItemGroup>
116116
<!-- Exclude the Private.SourceBuilt.Artifacts archive from poison usage scan. -->
117-
<PoisonFileToCheck Include="$(ArtifactsAssetsDir)*$(ArchiveExtension)" />
118-
<PoisonFileToCheck Remove="$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName)*" />
117+
<AssetToCheck Include="$(ArtifactsAssetsDir)*$(ArchiveExtension)" />
118+
<AssetToCheck Remove="$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName)*" />
119119
<!-- Include shipping nuget packages. -->
120-
<PoisonFileToCheck Include="$(ArtifactsShippingPackagesDir)*.nupkg" />
120+
<ShippingPackageToCheck Include="$(ArtifactsShippingPackagesDir)**/*.nupkg" />
121121
<!-- Add and mark SBRP packages to validate that they have the correct poison attribute. -->
122-
<PoisonFileToCheck Include="$(ReferencePackagesDir)**\*.nupkg" IsSourceBuildReferencePackage="true" />
122+
<SbrpPackageToCheck Include="$(ReferencePackagesDir)**\*.nupkg" IsSourceBuildReferencePackage="true" />
123+
</ItemGroup>
124+
125+
<Error Condition="'@(AssetToCheck)' == ''" Text="No assets will be poison checked - this is unexpected!" />
126+
<Error Condition="'@(ShippingPackageToCheck)' == ''" Text="No shipping packages will be poison checked - this is unexpected!" />
127+
<Error Condition="'@(SbrpPackageToCheck)' == ''" Text="No SBRP packages will be poison checked - this is unexpected!" />
128+
129+
<ItemGroup>
130+
<PoisonFileToCheck Include="@(AssetToCheck)" />
131+
<PoisonFileToCheck Include="@(ShippingPackageToCheck)" />
132+
<PoisonFileToCheck Include="@(SbrpPackageToCheck)" />
123133
</ItemGroup>
124134

125135
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Checking @(PoisonFileToCheck) for poisoned files." />

0 commit comments

Comments
 (0)