Skip to content

Commit 2d6827a

Browse files
authored
Always generate checksums as last part of publish job (#20367)
* Always generate checksums as last part of publish job * Initialize props correctly * Fix wildcard * Import Arcade SDK * Add NoWarn MSB4011 * Make import conditional on GenerateChecksums * Select specific files to checksum * Respond to feedback * AfterTargets -> BeforeTargets
1 parent d2fa99a commit 2d6827a

File tree

6 files changed

+37
-18
lines changed

6 files changed

+37
-18
lines changed

.azure/pipelines/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ variables:
6767
# The following extra properties are not set when testing. Use with final build.[cmd,sh] of asset-producing jobs.
6868
- name: _PublishArgs
6969
value: /p:Publish=true
70+
/p:GenerateChecksums=true
7071
/p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
7172
/p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
7273
/p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed)

Directory.Build.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@
170170

171171
<ArchiveExtension>.tar.gz</ArchiveExtension>
172172
<ArchiveExtension Condition="'$(TargetOsName)' == 'win'">.zip</ArchiveExtension>
173-
<ChecksumExtension>.sha512</ChecksumExtension>
174173
</PropertyGroup>
175174

176175
<Import Project="eng\Workarounds.props" />

eng/AfterSigning.targets

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project>
2+
3+
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(GenerateChecksums)' == 'true'" />
4+
5+
<PropertyGroup Condition="'$(GenerateChecksums)' == 'true'">
6+
<!-- The one use of ArtifactsDir in Publish.proj adds an additional slash, confusing itself. -->
7+
<ArtifactsDir Condition=" HasTrailingSlash('$(ArtifactsDir)') ">$(ArtifactsDir.Substring(0, $([MSBuild]::Subtract($(ArtifactsDir.Length), 1))))</ArtifactsDir>
8+
<!-- $(InstallersOutputPath) is not defined. Root Directory.Build.props is not imported. -->
9+
<InstallersOutputPath>$(ArtifactsDir)\installers\</InstallersOutputPath>
10+
</PropertyGroup>
11+
12+
<Target Name="PopulateGenerateChecksumItems"
13+
Condition="'$(GenerateChecksums)' == 'true'"
14+
AfterTargets="Build"
15+
BeforeTargets="GenerateChecksums" >
16+
17+
<ItemGroup>
18+
<InstallerFiles Include="$(InstallersOutputPath)**\*.msi" />
19+
<InstallerFiles Include="$(InstallersOutputPath)**\*.exe" />
20+
<InstallerFiles Include="$(InstallersOutputPath)**\*.zip" />
21+
<InstallerFiles Include="$(InstallersOutputPath)**\*.tar.gz" />
22+
<InstallerFiles Include="$(InstallersOutputPath)**\*.wixlib" />
23+
<InstallerFiles Include="$(InstallersOutputPath)**\*.rpm" />
24+
<GenerateChecksumItems Include="%(InstallerFiles.Identity)" >
25+
<DestinationPath>%(FullPath).sha512</DestinationPath>
26+
</GenerateChecksumItems>
27+
</ItemGroup>
28+
29+
</Target>
30+
31+
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(GenerateChecksums)' == 'true'" />
32+
33+
</Project>

eng/Publishing.props

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
2-
<PropertyGroup Condition=" HasTrailingSlash('$(ArtifactsDir)') ">
2+
<PropertyGroup>
33
<!-- The one use of ArtifactsDir in Publish.proj adds an additional slash, confusing itself. -->
4-
<ArtifactsDir>$(ArtifactsDir.Substring(0, $([MSBuild]::Subtract($(ArtifactsDir.Length), 1))))</ArtifactsDir>
4+
<ArtifactsDir Condition=" HasTrailingSlash('$(ArtifactsDir)') ">$(ArtifactsDir.Substring(0, $([MSBuild]::Subtract($(ArtifactsDir.Length), 1))))</ArtifactsDir>
55

66
<PublishDependsOnTargets>$(PublishDependsOnTargets);_PublishInstallersAndChecksums</PublishDependsOnTargets>
77

@@ -49,12 +49,10 @@
4949
<!-- Do not push .nupkg files from Linux and macOS builds. They'll be packed up separately and signed on Windows. -->
5050
<ItemsToPushToBlobFeed Remove="@(ItemsToPushToBlobFeed)" Condition="'$(OS)' != 'Windows_NT'" />
5151

52-
<!-- Skip publishing checksums for now - the checksums for the .zip files don't match (https://github.com/dotnet/aspnetcore/issues/18792)
5352
<ItemsToPushToBlobFeed Include="@(_ChecksumsToPublish)">
5453
<PublishFlatContainer>true</PublishFlatContainer>
5554
<RelativeBlobPath>$(_UploadPathRoot)/Runtime/$(_PackageVersion)/%(Filename)%(Extension)</RelativeBlobPath>
5655
</ItemsToPushToBlobFeed>
57-
-->
5856

5957
<ItemsToPushToBlobFeed Include="@(_InstallersToPublish)">
6058
<IsShipping>true</IsShipping>

src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ This package is an internal implementation of the .NET Core SDK and is not meant
154154
<RedistArchiveOutputPath>$(InstallersOutputPath)$(RedistArchiveOutputFileName)</RedistArchiveOutputPath>
155155
</PropertyGroup>
156156

157-
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
158-
<GenerateChecksumItems Include="$(RedistArchiveOutputPath)">
159-
<DestinationPath>$(RedistArchiveOutputPath)$(ChecksumExtension)</DestinationPath>
160-
</GenerateChecksumItems>
161-
</ItemGroup>
162-
163157
<!-- Target chain -->
164158
<PropertyGroup>
165159
<ResolveReferencesDependsOn>

src/Installers/Windows/Wix.targets

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,12 @@
6464

6565
<Target Name="CopyToArtifactsDirectory"
6666
Condition=" '$(IsShipping)' == 'true' AND '$(SkipCopyToArtifactsDirectory)' != 'true' "
67-
AfterTargets="Build" BeforeTargets="GenerateChecksums">
67+
BeforeTargets="Build">
6868
<Copy SourceFiles="$(TargetPath)" DestinationFiles="$(InstallersOutputPath)$(PackageFileName)" />
6969
<ItemGroup>
7070
<_cabs Include="$(TargetDir)**/*.cab" />
7171
</ItemGroup>
7272
<Copy SourceFiles="@(_cabs)" DestinationFolder="$(InstallersOutputPath)" />
7373
</Target>
7474

75-
<ItemGroup Condition=" '$(IsShipping)' == 'true' AND '$(SkipCopyToArtifactsDirectory)' != 'true' ">
76-
<GenerateChecksumItems Include="$(InstallersOutputPath)$(PackageFileName)">
77-
<DestinationPath>$(InstallersOutputPath)$(PackageFileName)$(ChecksumExtension)</DestinationPath>
78-
</GenerateChecksumItems>
79-
</ItemGroup>
80-
8175
</Project>

0 commit comments

Comments
 (0)