Skip to content

Commit a59cf5f

Browse files
committed
After some investigation, figured out that long commit names would break PublishAssets. Therefore, recalculated the commit message length based on this information.
1 parent 20a8ad4 commit a59cf5f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

eng/pipelines/templates/jobs/workload-build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ jobs:
4141
# Keep only valid characters. Invalid characters include: " / : < > \ | ? @ *
4242
# Also, strip any trailing '.' characters as those are invalid too.
4343
$commitMessage = "$(git log -1 --pretty=%s)".Trim() -replace '["\/:<>\\|?@*]|\.{1,}$', ''
44-
# Lastly, truncate to 255 max characters: 255 - 32 - 14 - 9 = 200
44+
# AzDO only allows 255 characters for the run name. But, the run name is used in PublishAssets to create a path to the assets for DARC.
45+
# The max length for this asset path is 250 characters. An example path is: assets/symbols/dotnet-workload-versions/{RunName}/Microsoft.NET.Workloads.10.0.100.Msi.arm64.10.101.0-servicing.0.25571.5.symbols.nupkg
46+
# To truncate the commit message, let's keep these counts in mind:
47+
# ~130: approximate length for the asset path parts that are not the run name
4548
# 32: for (potential) workloads version and delimiters (last numeric value can be 2 digits long), ex: 10.0.101-servicing.0.25571.3 •
4649
# 14: for build number and delimiter, ex: 20250910.13 •
47-
# 9: just a fudge factor to be safe (and make the result an even 200).
48-
$commitMessage = $commitMessage.Substring(0, [Math]::Min($commitMessage.Length, 200))
50+
# Therefore, 250 - 130 - 32 - 14 = 74 characters. To be extra safe, let's make it 65 characters.
51+
$commitMessage = $commitMessage.Substring(0, [Math]::Min($commitMessage.Length, 65))
4952
# If the build does not succeed, the run name will contain to what is set below.
5053
# If the build does succeed, Workloads.NET.Workloads.csproj will recreate the run name using OfficialBuildId, WorkloadsVersion, and SourceBranchCommitMessage.
5154
Write-Host "##vso[task.setvariable variable=SourceBranchCommitMessage]$commitMessage"

0 commit comments

Comments
 (0)