Skip to content

Commit c3972eb

Browse files
authored
Fix minified build so workers directory doesn't have content (#4609)
1 parent 06d479a commit c3972eb

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed

eng/build/Minified.targets

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22

33
<!-- Workers to delete in minified builds -->
44
<ItemGroup Condition="'$(IsMinified)' == 'true'">
5-
<_LanguageWorkers Include="$(PublishDir)workers\python" />
6-
<_LanguageWorkers Include="$(PublishDir)workers\java" />
7-
<_LanguageWorkers Include="$(PublishDir)workers\powershell" />
8-
<_LanguageWorkers Include="$(PublishDir)workers\node" />
5+
<_LanguageWorkers Include="$(PublishDir)\workers\python" />
6+
<_LanguageWorkers Include="$(PublishDir)\workers\java" />
7+
<_LanguageWorkers Include="$(PublishDir)\workers\powershell" />
8+
<_LanguageWorkers Include="$(PublishDir)\workers\node" />
99
</ItemGroup>
1010

1111
<!-- Remove worker directories from minified builds -->
1212
<!-- Cannot remove entire directory due to this bug: https://github.com/Azure/azure-functions-core-tools/issues/2380 -->
1313
<Target Name="RemoveLanguageWorkersForMin" AfterTargets="Publish" BeforeTargets="PrepareZipArtifacts" Condition="'$(RuntimeIdentifier)' != ''">
1414
<Message Importance="low" Text="Removing language workers for minified build..." />
1515
<RemoveDir Directories="@(_LanguageWorkers)" />
16+
17+
<!-- Check if any directories still exist and fail the build -->
18+
<ItemGroup>
19+
<_FailedToDelete Include="@(_LanguageWorkers)" Condition="Exists('%(Identity)')" />
20+
</ItemGroup>
21+
22+
<Error Text="Failed to delete one or more language worker directories: %(Identity)" Condition="'@(_FailedToDelete)' != ''" />
1623
</Target>
1724

1825
<!-- Write artifactsconfig.json for minified builds -->

eng/ci/templates/official/jobs/test-consolidated-cli-artifacts.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ jobs:
4040
displayName: 'Download artifact'
4141
artifact: func-cli-${{ parameters.arch }}
4242

43+
- ${{ if startsWith(parameters.arch, 'min.') }}:
44+
- task: ExtractFiles@1
45+
displayName: 'Unzip func-cli (minified)'
46+
inputs:
47+
archiveFilePatterns: '$(Pipeline.Workspace)/func-cli-${{ parameters.arch }}/func-cli/*.zip'
48+
destinationFolder: '$(Pipeline.Workspace)/minified-test'
49+
cleanDestinationFolder: true
50+
overwriteExistingFiles: true
51+
52+
- task: PowerShell@2
53+
displayName: 'Verify workers directory is empty for minified build'
54+
inputs:
55+
targetType: filePath
56+
filePath: '$(Build.SourcesDirectory)/eng/scripts/artifact-assembler/check-minified-dir-exists.ps1'
57+
arguments: '-workersPath "$(Pipeline.Workspace)/minified-test/workers"'
58+
4359
# Testing for non-min versions of the CLI as some of the tests require the workers.
4460
- ${{ if not(startsWith(parameters.arch, 'min.')) }}:
4561
- task: ExtractFiles@1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
param (
2+
[string]$workersPath
3+
)
4+
5+
if (-Not (Test-Path $workersPath)) {
6+
Write-Error "Workers directory is missing at $workersPath. It must exist in minified builds."
7+
}
8+
9+
$contents = Get-ChildItem -Path $workersPath
10+
11+
# Filter out placeholder.txt
12+
$nonPlaceholderContents = $contents | Where-Object { $_.Name -ne "placeholder.txt" }
13+
14+
if ($nonPlaceholderContents.Count -ne 0) {
15+
Write-Error "Workers directory contains unexpected files. Only 'placeholder.txt' is allowed in minified builds."
16+
}

release_notes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Azure Functions CLI 4.2.0
1+
# Azure Functions CLI 4.2.1
22

33
#### Host Version
44

@@ -9,3 +9,4 @@
99

1010
- Add support for .NET 10 isolated model (#4589)
1111
- Update log streaming to support both connection string and instrumentation Key (#4586)
12+
- Remove content of workers dir from minified versions (#4609)

src/Cli/func/Directory.Version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>4.2.0</VersionPrefix>
4+
<VersionPrefix>4.2.1</VersionPrefix>
55
<VersionSuffix></VersionSuffix>
66
<UpdateBuildNumber>true</UpdateBuildNumber>
77
</PropertyGroup>

0 commit comments

Comments
 (0)