@@ -13,13 +13,6 @@ $publishDir = "$outDir\pub\WebJobs.Script.WebHost"
13
13
$extensionVersion = Get-AzureFunctionsVersion $buildNumber $suffix $minorVersionPrefix
14
14
Write-Host " Site extension version: $extensionVersion "
15
15
16
- # Construct variables for strings like "4.1.0-15898" and "4.1.0"
17
- $versionParts = ($extensionVersion -Split " -" )[0 ] -Split " \."
18
- $majorMinorVersion = $versionParts [0 ] + " ." + $versionParts [1 ]
19
- $patchVersion = [int ]$versionParts [2 ]
20
- $isPatch = $patchVersion -gt 0
21
- Write-Host " MajorMinorVersion is '$majorMinorVersion '. Patch version is '$patchVersion '. IsPatch: '$isPatch '"
22
-
23
16
function ZipContent ([string ] $sourceDirectory , [string ] $target ) {
24
17
$stopwatch = [System.Diagnostics.Stopwatch ]::StartNew()
25
18
@@ -117,101 +110,6 @@ function CleanOutput([string] $rootPath) {
117
110
Write-Host " Current size: $ ( GetFolderSizeInMb $rootPath ) Mb"
118
111
}
119
112
120
- function CreatePatchedSiteExtension ([string ] $siteExtensionPath ) {
121
- try {
122
- Write-Host " SiteExtensionPath is $siteExtensionPath "
123
- $officialSiteExtensionPath = " $siteExtensionPath \$extensionVersion "
124
- $baseVersion = " $majorMinorVersion .0"
125
- $baseZipPath = " $publishDir \BaseZipDirectory"
126
- $baseExtractedPath = " $publishDir \BaseZipDirectory\Extracted"
127
-
128
- # Try to download base version
129
- New-Item - Itemtype " directory" - path " $baseZipPath " - Force > $null
130
- New-Item - Itemtype " directory" - path " $baseExtractedPath " - Force > $null
131
- $baseZipUrl = " https://github.com/Azure/azure-functions-host/releases/download/v$majorMinorVersion .0/Functions.$majorMinorVersion .0.zip"
132
-
133
- Write-Host " Downloading from $baseZipUrl "
134
- (New-Object System.Net.WebClient).DownloadFile($baseZipUrl , " $baseZipPath \Functions.$majorMinorVersion .0.zip" )
135
- Write-Host " Download complete"
136
-
137
- # Extract zip
138
- Expand-Archive - LiteralPath " $baseZipPath \Functions.$majorMinorVersion .0.zip" - DestinationPath " $baseExtractedPath "
139
-
140
- # Create directory for patch
141
- $zipOutput = " $publishDir \ZippedPatchSiteExtension"
142
- New-Item - Itemtype directory - path $zipOutput - Force > $null
143
-
144
- # Copy extensions.xml as is
145
- Copy-Item " $siteExtensionPath \extension.xml" - Destination " $patchedContentDirectory \extension.xml"
146
-
147
- # Read hashes.txt for base
148
- $hashForBase = @ {}
149
- foreach ($line in Get-Content " $baseExtractedPath \$baseVersion \hashesForHardlinks.txt" ) {
150
- $lineContents = $line.Split (" " )
151
- $hashKey = $lineContents [1 ].Split(" :" )[1 ]
152
- $hashValue = $lineContents [0 ].Split(" :" )[1 ]
153
-
154
- $hashForBase.Add ($hashKey , $hashValue )
155
- }
156
-
157
- # Read hashes.txt for patched
158
- $hashForPatched = @ {}
159
- foreach ($line in Get-Content " $officialSiteExtensionPath \hashesForHardlinks.txt" ) {
160
- $lineContents = $line.Split (" " )
161
- $hashKey = $lineContents [1 ].Split(" :" )[1 ]
162
- $hashValue = $lineContents [0 ].Split(" :" )[1 ]
163
-
164
- $hashForPatched.Add ($hashKey , $hashValue )
165
- }
166
-
167
- # Iterate over patched to generate the appropriate set of files
168
- $informationJson = New-Object System.Collections.ArrayList
169
- foreach ($key in $hashForPatched.Keys ) {
170
- $infoKeyValuePairs = @ {}
171
-
172
- # If key doesn't exist in base, or if the keys exists but their hashes don't match, copy over.
173
- if ((! $hashForBase.ContainsKey ($key )) -or ($hashForPatched [$key ] -ne $hashForBase [$key ])) {
174
- $filePath = $key.Replace (" .\" , " " )
175
- $sourcePath = " $officialSiteExtensionPath \$filePath "
176
- $destinationPath = " $patchedContentDirectory \$extensionVersion \$filePath "
177
- Write-Host " Copying $sourcePath to $destinationPath "
178
- $ValidPath = Test-Path " $destinationPath "
179
-
180
- If ($ValidPath -eq $False ){
181
- New-Item - Path " $destinationPath " - Force > $null
182
- }
183
-
184
- Copy-Item " $sourcePath " " $destinationPath " - Force > $null
185
-
186
- # Get it into info
187
- $infoKeyValuePairs.Add (" FileName" , $key )
188
- $infoKeyValuePairs.Add (" SourceVersion" , $extensionVersion )
189
- $infoKeyValuePairs.Add (" HashValue" , $hashForPatched [$key ])
190
- $informationJson.Add ($infoKeyValuePairs )
191
- continue
192
- }
193
-
194
- # Add info that would help get this file from base
195
- $infoKeyValuePairs.Add (" FileName" , $key )
196
- $infoKeyValuePairs.Add (" SourceVersion" , $baseVersion )
197
- $infoKeyValuePairs.Add (" HashValue" , $hashForBase [$key ])
198
- $informationJson.Add ($infoKeyValuePairs )
199
- }
200
- $informationJson | ConvertTo-Json - depth 100 | Out-File " $patchedContentDirectory \$extensionVersion \HardlinksMetadata.json"
201
-
202
- # Zip it up
203
- ZipContent $patchedContentDirectory " $zipOutput \Functions.$extensionVersion .zip"
204
-
205
- # Clean up
206
- Remove-Item $patchedContentDirectory - Recurse - Force > $null
207
- }
208
- catch {
209
- Write-Host $_.Exception
210
- $statusCode = $_.Exception.Response.StatusCode.Value__
211
- Write-Host " Invoking url $baseZipUrl returned status code of $statusCode which could mean that no base version exists. The full version needs to be deployed"
212
- }
213
- }
214
-
215
113
function CreateSiteExtensions () {
216
114
$stopwatch = [System.Diagnostics.Stopwatch ]::StartNew()
217
115
$siteExtensionPath = " $publishDir \temp_extension"
@@ -278,21 +176,6 @@ function CreateSiteExtensions() {
278
176
ZipContent $siteExtensionPath " $zipOutput \FunctionsInProc.$extensionVersion .zip"
279
177
}
280
178
281
- # Create directory for content even if there is no patch build. This makes artifact uploading easier.
282
- $patchedContentDirectory = " $publishDir \PatchedSiteExtension"
283
- New-Item - Itemtype directory - path $patchedContentDirectory - Force > $null
284
-
285
- # Construct patch
286
- if ($isPatch )
287
- {
288
- Write-Host " ======================================"
289
- Write-Host " Generating patch file"
290
- CreatePatchedSiteExtension $siteExtensionPath
291
- Write-Host " Done generating patch files"
292
- Write-Host " ======================================"
293
- Write-Host
294
- }
295
-
296
179
Remove-Item $siteExtensionPath - Recurse - Force > $null
297
180
298
181
Write-Host " ======================================"
0 commit comments