From 62276d07b5114968410ef39444a2fdcdea65b426 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 14 Nov 2017 12:05:23 -0800 Subject: [PATCH 1/4] add template xml for package signing --- tools/releaseBuild/packagesigning.xml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tools/releaseBuild/packagesigning.xml diff --git a/tools/releaseBuild/packagesigning.xml b/tools/releaseBuild/packagesigning.xml new file mode 100644 index 00000000000..8dd67835c9c --- /dev/null +++ b/tools/releaseBuild/packagesigning.xml @@ -0,0 +1,6 @@ + + + + + + From 833dc3aafbadda81aba5757c82ef561aeb8c4ed0 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 15 Nov 2017 08:17:55 -0800 Subject: [PATCH 2/4] Add script to generate package signing XML --- tools/releaseBuild/generatePackgeSigning.ps1 | 72 ++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tools/releaseBuild/generatePackgeSigning.ps1 diff --git a/tools/releaseBuild/generatePackgeSigning.ps1 b/tools/releaseBuild/generatePackgeSigning.ps1 new file mode 100644 index 00000000000..b7177ed43b5 --- /dev/null +++ b/tools/releaseBuild/generatePackgeSigning.ps1 @@ -0,0 +1,72 @@ +param( + [Parameter(Mandatory)] + [string] $Path, + [string[]] $AuthenticodeDualFiles, + [string[]] $AuthenticodeFiles +) + +if ((!$AuthenticodeDualFiles -or $AuthenticodeDualFiles.Count -eq 0) -and (!$AuthenticodeFiles -or $AuthenticodeFiles.Count -eq 0)) +{ + throw "At least one file must be specified" +} + +function New-Attribute +{ + param( + [Parameter(Mandatory)] + [string]$Name, + [Parameter(Mandatory)] + [object]$Value, + [Parameter(Mandatory)] + [System.Xml.XmlElement]$Element + ) + + $attribute = $signingXml.CreateAttribute($Name) + $attribute.Value = $value + $null = $fileElement.Attributes.Append($attribute) +} + +function New-FileElement +{ + param( + [Parameter(Mandatory)] + [string]$File, + [Parameter(Mandatory)] + [string]$SignType, + [Parameter(Mandatory)] + [System.Xml.XmlDocument]$XmlDoc, + [Parameter(Mandatory)] + [System.Xml.XmlElement]$Job + ) + + if(Test-Path -Path $file) + { + $name = Split-Path -Leaf -Path $File + $null = $fileElement = $XmlDoc.CreateElement("file") + New-Attribute -Name 'src' -value $file -Element $fileElement + New-Attribute -Name 'signType' -value $SignType -Element $fileElement + New-Attribute -Name 'dest' -value "__OUTPATHROOT__\$name" -Element $fileElement + $null = $job.AppendChild($fileElement) + } + else + { + Write-Warning -Message "Skipping $SignType; $File because it does not exist" + } +} + +[xml]$signingXml = get-content (Join-Path -Path $PSScriptRoot -ChildPath 'packagesigning.xml') +$job = $signingXml.SignConfigXML.job + +foreach($file in $AuthenticodeDualFiles) +{ + New-FileElement -File $file -SignType 'AuthenticodeDual' -XmlDoc $signingXml -Job $job +} + +foreach($file in $AuthenticodeFiles) +{ + New-FileElement -File $file -SignType 'Authenticode' -XmlDoc $signingXml -Job $job +} + +$signingXml.Save($path) +$updateScriptPath = Join-Path -Path $PSScriptRoot -ChildPath 'updateSigning.ps1' +& $updateScriptPath -SigningXmlPath $path \ No newline at end of file From c786a8baaeb6c1112341d8ea5befc98734845d5d Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 15 Nov 2017 08:56:16 -0800 Subject: [PATCH 3/4] Allow the XML to be updated to be specified --- tools/releaseBuild/updateSigning.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/releaseBuild/updateSigning.ps1 b/tools/releaseBuild/updateSigning.ps1 index 8c8f30f7633..185e32d7510 100644 --- a/tools/releaseBuild/updateSigning.ps1 +++ b/tools/releaseBuild/updateSigning.ps1 @@ -1,7 +1,9 @@ +param( + [string] $SigningXmlPath = (Join-Path -Path $PSScriptRoot -ChildPath 'signing.xml') +) # Script for use in VSTS to update signing.xml # Parse the signing xml -$signingXmlPath = Join-Path -Path $PSScriptRoot -ChildPath 'signing.xml' $signingXml = [xml](Get-Content $signingXmlPath) # Get any variables to updating 'signType' in the XML From 30dd5f0ee13fb01d77eaa5de18f3efffdff51ba1 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 15 Nov 2017 08:21:48 -0800 Subject: [PATCH 4/4] remove uploading artifact, it always fails. --- tools/packaging/packaging.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 7c2ae964446..511aa0086fb 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -451,7 +451,6 @@ function New-PSSignedBuildZip $name = split-path -Path $BuildPath -Leaf $zipLocationPath = Join-Path -Path $DestinationFolder -ChildPath "$name-signed.zip" Compress-Archive -Path $BuildPath\* -DestinationPath $zipLocationPath - Write-Host "##vso[artifact.upload containerfolder=results;artifactname=$name]$zipLocationPath" if ($VstsVariableName) { # set VSTS variable with path to package files