Skip to content

Commit a000f25

Browse files
authored
Merge pull request Azure#8193 from markcowl/help-check
ESRP signing for master and fix help check
2 parents ab84c19 + 143a560 commit a000f25

File tree

3 files changed

+104
-110
lines changed

3 files changed

+104
-110
lines changed

CodeSign.targets

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<UsingTask TaskName="ESRPSignTask" AssemblyFile="$(CISignRepoPath)\tools\sdkbuildtools\tasks\MS.Az.Sdk.OnPremise.Build.Tasks.dll" />
5+
6+
<PropertyGroup>
7+
<!-- CISignRepo is an environment variable that points to ci-signing repo clone -->
8+
<CISignRepoPath>$(CISignRepo)</CISignRepoPath>
9+
</PropertyGroup>
10+
11+
<Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">
12+
13+
<Message Text="====> Executing CodeSignBinaries Target..." Importance="high"/>
14+
15+
<PropertyGroup>
16+
<!--public token associated with MSSharedLibKey.snk-->
17+
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
18+
</PropertyGroup>
19+
20+
<Message Text="----> Dlls signing section" Importance="high"/>
21+
22+
<!-- Azure -->
23+
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
24+
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft*Azure*PowerShell*Cmdlets*.dll" />
25+
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft.Azure.Management.Sql.Legacy.dll" />
26+
</ItemGroup>
27+
28+
<Message Importance="high" Text="$(PackageDirectory)\$(Configuration) does not contains any files to sign. Code sign will skip."
29+
Condition="'@(DelaySignedAssembliesToSign)' == ''" />
30+
31+
<ESRPSignTask
32+
CopyBackSignedFilesToOriginalLocation="true"
33+
UnsignedFileList="@(DelaySignedAssembliesToSign)"
34+
SignLogDirPath="$(LibraryRoot)dlls-signing.log"
35+
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>
36+
37+
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) &quot;" />
38+
39+
<!-- Copying shortcut to be signed -->
40+
<Copy SourceFiles="$(LibraryRoot)tools\Az\Az.psm1" DestinationFolder="$(PackageDirectory)\$(Configuration)" Condition="'$(Scope)' == 'Netcore'" />
41+
42+
<Message Text="----> Scripts signing section" Importance="high"/>
43+
44+
<!-- Azure -->
45+
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
46+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1" />
47+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.psm1" />
48+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1xml" />
49+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.js" />
50+
</ItemGroup>
51+
52+
<ESRPSignTask
53+
CopyBackSignedFilesToOriginalLocation="true"
54+
UnsignedFileList="@(ScriptsToSign)"
55+
SignLogDirPath="$(LibraryRoot)scripts-signing.log"
56+
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/>
57+
58+
<!-- RemoveCodeSignArtifacts.ps1 -->
59+
<Message Text="----> Remove artifacts section" Importance="high"/>
60+
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Get-ChildItem -Path $(PackageDirectory) -Recurse -Include 'Signed','Unsigned' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;"
61+
ContinueOnError="WarnAndContinue"
62+
IgnoreExitCode="true" />
63+
64+
<!-- CheckSignature.ps1 -->
65+
<Message Text="----> CheckSignature section" Importance="high"/>
66+
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) &quot;" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" />
67+
68+
<!-- Copy files back after signing -->
69+
<Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" />
70+
</Target>
71+
72+
<Target Name="CodeSignInstaller">
73+
<Message Text="----> CodeSignInstaller section" Importance="high"/>
74+
<PropertyGroup>
75+
<!--public token associated with MSSharedLibKey.snk-->
76+
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
77+
</PropertyGroup>
78+
<GetFrameworkSdkPath>
79+
<Output TaskParameter="Path" PropertyName="WindowsSdkPath"/>
80+
</GetFrameworkSdkPath>
81+
82+
<ItemGroup>
83+
<InstallersToSign Include="$(LibraryRoot)\setup\*.msi" />
84+
</ItemGroup>
85+
86+
<Message Importance="high" Text="$(LibraryRoot)\setup does not contain any installers to sign. Code sign will skip."
87+
Condition="'@(InstallersToSign)' == ''" />
88+
89+
<ESRPSignTask
90+
SignedFilesRootDirPath="$(SignedOutputRootDir)"
91+
UnsignedFileList="@(InstallersToSign)"
92+
SignLogDirPath="$(LibraryRoot)\msi-signing.log"
93+
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/>
94+
95+
<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
96+
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
97+
<SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" />
98+
</Target>
99+
</Project>

build.proj

Lines changed: 3 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<LocalFeedFolder>$(LibraryToolsFolder)\LocalFeed</LocalFeedFolder>
5252
<PublishDirectory>$(LibrarySourceFolder)\Publish</PublishDirectory>
5353
<Configuration Condition=" '$(Configuration)' != 'Release'">Debug</Configuration>
54-
<CodeSign Condition=" '$(CodeSign)' == '' ">false</CodeSign>
54+
<CodeSign>false</CodeSign>
5555
<!--Set this true only if you want to test the code sign workflow locally-->
5656
<DelaySign Condition =" '$(DelaySign)' == '' ">false</DelaySign>
5757
<SignedOutputRootDir>$(LibraryRoot)signed</SignedOutputRootDir>
@@ -121,9 +121,9 @@
121121
<OnPremiseBuild Condition=" ! Exists($(OnPremiseBuildTasks)) ">false</OnPremiseBuild>
122122
</PropertyGroup>
123123

124-
<UsingTask Condition=" $(OnPremiseBuild) " TaskName="CodeSigningTask" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
125124
<UsingTask Condition=" $(OnPremiseBuild) " TaskName="CorporateValidation" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
126125
<Import Condition=" $(OnPremiseBuild) " Project="$(CIToolsPath)\Microsoft.WindowsAzure.Build.OnPremise.msbuild" />
126+
<Import Project="CodeSign.targets"/>
127127

128128
<UsingTask AssemblyFile="$(MSBuildProjectDirectory)\packages\xunit.runner.msbuild.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit" />
129129

@@ -291,7 +291,7 @@
291291
<CallTarget Targets="RunPoliCheck" Condition="'$(OnPremiseBuild)'" />
292292

293293
<CallTarget Targets="CodeSignBinaries" Condition="'$(CodeSign)' == 'true'" />
294-
294+
295295
<Exec ContinueOnError="false" Command="$(PowerShellCoreCommandPrefix) &quot;. $(LibraryToolsFolder)\NewOutputTypeIndex.ps1 -OutputFile $(PackageDirectory)\outputtypes.json -BuildConfig $(Configuration)&quot;" Condition="('$(Scope)' == 'All' or '$(Scope)' == 'Latest') and $(CodeSign) == 'true'" />
296296

297297
<Message Importance="high" Text="Running Static Analyser" />
@@ -310,118 +310,13 @@
310310
<MSBuild Projects="@(LocalBuildTasks)" Targets="Build" Properties="Configuration=$(Configuration);Platform=Any CPU" />
311311
</Target>
312312

313-
<Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">
314-
<PropertyGroup>
315-
<!--public token associated with MSSharedLibKey.snk-->
316-
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
317-
</PropertyGroup>
318-
<GetFrameworkSdkPath>
319-
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
320-
</GetFrameworkSdkPath>
321-
322-
<!-- Azure -->
323-
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
324-
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft*Azure*PowerShell*Cmdlets*.dll" />
325-
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft.Azure.Management.Sql.Legacy.dll" />
326-
</ItemGroup>
327-
328-
<Message Importance="high" Text="$(PackageDirectory)\$(Configuration) does not contains any files to sign. Code sign will skip." Condition="'@(DelaySignedAssembliesToSign)' == ''" />
329-
330-
<ValidateStrongNameSignatureTask
331-
WindowsSdkPath="$(WindowsSdkPath)"
332-
Assembly="%(DelaySignedAssembliesToSign.Identity)"
333-
ExpectedTokenSignature="$(StrongNameToken)"
334-
ExpectedDelaySigned="true"
335-
ContinueOnError="false"
336-
Condition="'@(DelaySignedAssembliesToSign)' != ''" />
337-
338-
<CodeSigningTask
339-
Description="Microsoft Azure PowerShell"
340-
Keywords="Microsoft Azure PowerShell"
341-
UnsignedFiles="@(DelaySignedAssembliesToSign)"
342-
DestinationPath="$(LibrarySourceFolder)"
343-
BasePath="$(LibrarySourceFolder)"
344-
Certificates="72, 400"
345-
SigningLogPath="$(LibraryRoot)\signing.log"
346-
ToolsPath="$(CIToolsPath)"
347-
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''" />
348-
349-
<ValidateStrongNameSignatureTask
350-
WindowsSdkPath="$(WindowsSdkPath)"
351-
Assembly="%(DelaySignedAssembliesToSign.Identity)"
352-
ExpectedTokenSignature="$(StrongNameToken)"
353-
ExpectedDelaySigned="false"
354-
ContinueOnError="false"
355-
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''" />
356-
357-
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) &quot;" />
358-
359-
<!-- Copying shortcut to be signed -->
360-
<Copy SourceFiles="$(LibraryRoot)tools\Az\Az.psm1" DestinationFolder="$(PackageDirectory)\$(Configuration)" Condition="'$(Scope)' == 'Netcore'" />
361-
362-
<!-- Azure -->
363-
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
364-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1" />
365-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.psm1" />
366-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1xml" />
367-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.js" />
368-
</ItemGroup>
369-
370-
<CodeSigningTask
371-
Description="Microsoft Azure PowerShell"
372-
Keywords="Microsoft Azure PowerShell"
373-
UnsignedFiles="@(ScriptsToSign)"
374-
DestinationPath="$(LibrarySourceFolder)"
375-
BasePath="$(LibrarySourceFolder)"
376-
Certificates="400"
377-
SigningLogPath="$(LibraryRoot)\signing-scripts.log"
378-
ToolsPath="$(CIToolsPath)"
379-
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''" />
380-
381-
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) &quot;" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" />
382-
383-
<!-- Copy files back after signing -->
384-
<Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" />
385-
</Target>
386-
387313
<Target Name="BuildInstaller" Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
388314
<Exec Command="$(PowerShellCommandPrefix) &quot;. Register-PSRepository -Name MSIcreationrepository -SourceLocation $(PackageDirectory) -InstallationPolicy Trusted &quot; " />
389315
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryRoot)\setup\generate.ps1 -repository MSIcreationrepository &quot; " />
390316
<Exec Command="$(PowerShellCommandPrefix) &quot;. Unregister-PSRepository -Name MSIcreationrepository &quot; " />
391317
<CallTarget Targets="CodeSignInstaller" Condition=" '$(CodeSign)' == 'true'" />
392318
</Target>
393319

394-
<Target Name="CodeSignInstaller">
395-
<PropertyGroup>
396-
<!--public token associated with MSSharedLibKey.snk-->
397-
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
398-
</PropertyGroup>
399-
<GetFrameworkSdkPath>
400-
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
401-
</GetFrameworkSdkPath>
402-
403-
<ItemGroup>
404-
<InstallersToSign Include="$(LibraryRoot)\setup\*.msi" />
405-
</ItemGroup>
406-
407-
<Message Importance="high" Text="$(LibraryRoot)\setup does not contain any installers to sign. Code sign will skip."
408-
Condition="'@(InstallersToSign)' == ''" />
409-
410-
<CodeSigningTask
411-
Description="Microsoft Azure PowerShell"
412-
Keywords="Microsoft Azure PowerShell"
413-
UnsignedFiles="@(InstallersToSign)"
414-
DestinationPath="$(SignedOutputRootDir)"
415-
SigningLogPath="$(LibraryRoot)\msi-signing.log"
416-
Certificates="402"
417-
ToolsPath="$(CIToolsPath)"
418-
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''" />
419-
420-
<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
421-
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
422-
<SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" />
423-
</Target>
424-
425320
<!-- Run Validation -->
426321
<Target Name="DependencyAnalysis" Condition="'$(SkipDependencyAnalysis)' == 'false'">
427322
<Message Importance="high" Text="Running dependency analysis..." />

tools/GenerateHelp.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Param(
1111
[string]$FilteredModules
1212
)
1313

14-
$ResourceManagerFolders = Get-ChildItem -Path ".\src\ResourceManager"
14+
$ResourceManagerFolders = Get-ChildItem -Path "$PSScriptRoot\..\src\ResourceManager"
1515
Import-Module "$PSScriptRoot\HelpGeneration\HelpGeneration.psm1"
1616
$UnfilteredHelpFolders = Get-ChildItem "help" -Recurse -Directory | where { $_.FullName -like "*$BuildConfig*" -and $_.FullName -notlike "*Stack*" }
1717
$FilteredHelpFolders = $UnfilteredHelpFolders
@@ -40,7 +40,7 @@ if ($ValidateMarkdownHelp)
4040
$Exceptions = @()
4141
foreach ($ServiceFolder in $ResourceManagerFolders)
4242
{
43-
$HelpFolder = Get-ChildItem -Path $ServiceFolder -Filter "help" -Recurse -Directory
43+
$HelpFolder = (Get-ChildItem -Path $ServiceFolder.FullName -Filter "help" -Recurse -Directory)
4444
if ($HelpFolder -eq $null)
4545
{
4646
$Exceptions += $ServiceFolder.Name

0 commit comments

Comments
 (0)