-
Notifications
You must be signed in to change notification settings - Fork 4.1k
ESRP codesign master branch #8170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
vladimir-shcherbakov
wants to merge
9
commits into
Azure:master
from
vladimir-shcherbakov:master-ESRP
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b4be72a
ESRP codesign task
vladimir-shcherbakov 228782c
Merge remote-tracking branch 'ustr/master'
vladimir-shcherbakov c525b2f
Switch to ESRP codesign target
vladimir-shcherbakov 2879a32
master branch aligned
vladimir-shcherbakov 60a1e6b
Suffix ESRP removed
vladimir-shcherbakov f16444e
debug message added
vladimir-shcherbakov 333e004
Merge branch 'master' into master-ESRP
markcowl 18f5b75
Merge branch 'master' into master-ESRP
markcowl 6691fe1
Merge branch 'master' into master-ESRP
markcowl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
|
||
| <UsingTask TaskName="ESRPSignTask" AssemblyFile="$(CISignRepoPath)\tools\sdkbuildtools\tasks\MS.Az.Sdk.OnPremise.Build.Tasks.dll" /> | ||
|
|
||
| <PropertyGroup> | ||
| <!-- CISignRepo is an environment variable that points to ci-signing repo clone --> | ||
| <CISignRepoPath>$(CISignRepo)</CISignRepoPath> | ||
| </PropertyGroup> | ||
|
|
||
| <Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask"> | ||
|
|
||
| <Message Text="====> Executing CodeSignBinaries Target..." Importance="high"/> | ||
|
|
||
| <PropertyGroup> | ||
| <!--public token associated with MSSharedLibKey.snk--> | ||
| <StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken> | ||
| </PropertyGroup> | ||
|
|
||
| <Message Text="----> Dlls signing section" Importance="high"/> | ||
|
|
||
| <!-- Azure --> | ||
| <ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'"> | ||
| <DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft*Azure*PowerShell*Cmdlets*.dll" /> | ||
| <DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft.Azure.Management.Sql.Legacy.dll" /> | ||
| </ItemGroup> | ||
|
|
||
| <Message Importance="high" Text="$(PackageDirectory)\$(Configuration) does not contains any files to sign. Code sign will skip." | ||
| Condition="'@(DelaySignedAssembliesToSign)' == ''" /> | ||
|
|
||
| <ESRPSignTask | ||
| CopyBackSignedFilesToOriginalLocation="true" | ||
| UnsignedFileList="@(DelaySignedAssembliesToSign)" | ||
| SignLogDirPath="$(LibraryRoot)dlls-signing.log" | ||
| Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/> | ||
|
|
||
| <Exec Command="$(PowerShellCommandPrefix) ". $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) "" /> | ||
|
|
||
| <!-- Copying shortcut to be signed --> | ||
| <Copy SourceFiles="$(LibraryRoot)tools\Az\Az.psm1" DestinationFolder="$(PackageDirectory)\$(Configuration)" Condition="'$(Scope)' == 'Netcore'" /> | ||
|
|
||
| <Message Text="----> Scripts signing section" Importance="high"/> | ||
|
|
||
| <!-- Azure --> | ||
| <ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'"> | ||
| <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1" /> | ||
| <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.psm1" /> | ||
| <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1xml" /> | ||
| <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.js" /> | ||
| </ItemGroup> | ||
|
|
||
| <ESRPSignTask | ||
| CopyBackSignedFilesToOriginalLocation="true" | ||
| UnsignedFileList="@(ScriptsToSign)" | ||
| SignLogDirPath="$(LibraryRoot)scripts-signing.log" | ||
| Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/> | ||
|
|
||
| <!-- RemoveCodeSignArtifacts.ps1 --> | ||
| <Message Text="----> Remove artifacts section" Importance="high"/> | ||
| <Exec Command="$(PowerShellCommandPrefix) ". $(LibraryToolsFolder)\RemoveCodeSignArtifacts.ps1 -Path $(PackageDirectory)\$(Configuration) "" | ||
| Condition="'$(Scope)' != 'Stack'" | ||
| ContinueOnError="ErrorAndContinue" /> | ||
|
|
||
| <!-- CheckSignature.ps1 --> | ||
| <Message Text="----> CheckSignature section" Importance="high"/> | ||
| <Exec Command="$(PowerShellCommandPrefix) ". $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) "" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" /> | ||
|
|
||
| <!-- Copy files back after signing --> | ||
| <Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" /> | ||
| </Target> | ||
|
|
||
| <Target Name="CodeSignInstaller"> | ||
| <Message Text="----> CodeSignInstaller section" Importance="high"/> | ||
| <PropertyGroup> | ||
| <!--public token associated with MSSharedLibKey.snk--> | ||
| <StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken> | ||
| </PropertyGroup> | ||
| <GetFrameworkSdkPath> | ||
| <Output TaskParameter="Path" PropertyName="WindowsSdkPath"/> | ||
| </GetFrameworkSdkPath> | ||
|
|
||
| <ItemGroup> | ||
| <InstallersToSign Include="$(LibraryRoot)\setup\*.msi" /> | ||
| </ItemGroup> | ||
|
|
||
| <Message Importance="high" Text="$(LibraryRoot)\setup does not contain any installers to sign. Code sign will skip." | ||
| Condition="'@(InstallersToSign)' == ''" /> | ||
|
|
||
| <ESRPSignTask | ||
| SignedFilesRootDirPath="$(SignedOutputRootDir)" | ||
| UnsignedFileList="@(InstallersToSign)" | ||
| SignLogDirPath="$(LibraryRoot)\msi-signing.log" | ||
| Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/> | ||
|
|
||
| <!--If we are testing locally then we copy the binaries and do not submit to the code sign server--> | ||
| <Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" /> | ||
| <SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" /> | ||
| </Target> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| param( | ||
| [Parameter(Position=0)] | ||
| [string]$Path | ||
| ) | ||
|
|
||
| if ($Path -eq $null) { | ||
| $Path=$PSScriptRoot | ||
| } else { | ||
| $Path = Resolve-Path $Path | ||
| } | ||
|
|
||
| Write-Output "Under the'$Path' folder" | ||
|
|
||
| "Signed","Unsigned" | ForEach-Object { | ||
| Write-Output "'$_' artifacts deletion..." | ||
| $foldersToDelete = Get-ChildItem -Path $Path -filter $_ -Directory -Recurse | ||
| $itemsQnty = $foldersToDelete.Count | ||
| Write-Output "Number of folders found: $itemsQnty" | ||
| if ($itemsQnty -gt 0) { | ||
| Write-Output "Folders list:" | ||
| $foldersToDelete | ForEach-Object { | ||
| $_.FullName | ||
| } | ||
| $foldersToDelete | ForEach-Object { | ||
| Remove-Item (Join-Path $_.FullName *.*) -Force | ||
| } | ||
| $foldersToDelete | ForEach-Object { | ||
| Remove-Item $_.FullName -Force | ||
| } | ||
| Write-Output "Deleted" | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as in the PR below, this needs to be conditional so we can sign bits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get the comment. To change the default
CodeSignproperty value we can use/p:CodeSign=trueswitch.Experiment
Targets file
DoSomething.targetscontent:Show property
CodeSighdefault value:Change property
CodeSighvalue to true: