Skip to content

Commit a4b87ac

Browse files
committed
Addressing a bunch of PR comments. Testing if xcopy is needed. Changed the drop hashing logic.
1 parent 64a48c0 commit a4b87ac

File tree

6 files changed

+38
-11
lines changed

6 files changed

+38
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ This repository contains the version information for .NET SDK Workloads.
1616
- **Do not** create an AzDO PAT. Leave that entry blank in the darc-authenticate file for it to use local machine auth.
1717
6. Request access to the [.NET Daily Internal Build Access](https://coreidentity.microsoft.com/manage/Entitlement/entitlement/netdailyinte-q2ql) entitlement
1818
- This allows the local AzDO machine auth to gather internal assets from AzDO.
19-
- ***Message Matt Mitchell*** (@mmitche) for approval after requesting access to the entitlement.
19+
- **Send a message** to one of the primary owners on the entitlement page for approval after requesting access to the entitlement.
2020
- Should take about 20 mins for the entitlement process to complete (will appear on your [entitlements list](https://coreidentity.microsoft.com/manage/entitlement)) and another 30 mins the access to propagate to DARC. Basically, after approval, wait an hour until you actually attempt to build.

eng/create-workload-drops.ps1

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Using the downloaded workloads, this creates the VS drops to upload for VS insertion.
2+
# It builds the Microsoft.NET.Workloads.Vsman.vsmanproj per workload ZIP, which creates the appropriate VSMAN file.
3+
4+
# $workloadPath: The path to the directory containing the workload ZIPs, usually the output path used by DARC in the download-workloads.ps1 script.
5+
# - Example Value: "$(RepoRoot)artifacts\workloads"
6+
# $msBuildToolsPath: The path to the MSBuild tools directory, generally $(MSBuildToolsPath) in MSBuild.
7+
# - Example Value: 'C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin'
8+
19
param ([Parameter(Mandatory=$true)] [string] $workloadPath, [Parameter(Mandatory=$true)] [string] $msBuildToolsPath)
210

311
# Extracts the workload drop zips.
@@ -12,18 +20,23 @@ $null = $workloads | ForEach-Object { Expand-Archive -Path $_.FullName -Destinat
1220
$dropInfoRegex = '^Workload\.VSDrop\.(?<full>(?<short>\w*)\..*?(?<type>(pre\.)?components$|packs$))'
1321
$primaryVSComponentJsonValues = ''
1422
$secondaryVSComponentJsonValues = ''
15-
$hashAlgorithm = [System.Security.Cryptography.SHA256]::Create()
1623
Get-ChildItem -Path $workloadDropPath -Directory | ForEach-Object {
1724
$null = $_.Name -match $dropInfoRegex
1825
$assemblyName = "$($Matches.full)"
1926
$dropDir = "$($_.FullName)\"
2027

2128
# Hash the files within the drop folder to create a unique identifier that represents this workload drop.
2229
# Example: 1E3EA4FE202394037253F57436A6EAD5DE1359792B618B9072014A98563A30FB
23-
$fileHashes = [byte[]]@()
30+
# See: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-filehash#example-4-compute-the-hash-of-a-string
31+
$contentStream = [System.IO.MemoryStream]::new()
32+
$writer = [System.IO.StreamWriter]::new($contentStream)
2433
$dropFiles = Get-ChildItem -Path $dropDir | Sort-Object
25-
$null = $dropFiles | Get-Content -Encoding Byte -Raw | ForEach-Object { $fileHashes += $hashAlgorithm.ComputeHash($_) }
26-
$dropHash = [System.BitConverter]::ToString($hashAlgorithm.ComputeHash([byte[]]$fileHashes)).Replace('-','')
34+
# Note: We're using ASCII because when testing between PS 5.1 and PS 7.5, this would result in the same hash. Other encodings arrived at different hashes.
35+
$null = $dropFiles | Get-Content -Encoding ASCII -Raw | ForEach-Object { $writer.Write($_) }
36+
$writer.Flush()
37+
$contentStream.Position = 0
38+
$dropHash = (Get-FileHash -InputStream $contentStream).Hash
39+
$writer.Close()
2740

2841
$vsDropName = "Products/dotnet/workloads/$assemblyName/$dropHash"
2942
# Reads the first line out of the .metadata file in the workload's output folder and sets it to the workload version.
@@ -58,7 +71,7 @@ Get-ChildItem -Path $workloadDropPath -Directory | ForEach-Object {
5871
}
5972
}
6073

61-
Write-Host 'After upload, your workload drop will be available at:'
74+
Write-Host 'After upload, your workload drop will be available at:'
6275
Write-Host "https://devdiv.visualstudio.com/_apps/hub/ms-vscs-artifact.build-tasks.drop-hub-group-explorer-hub?name=$vsDropName"
6376
}
6477

eng/download-workloads.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# This downloads the workloads using DARC.
2+
# In CI, we need to pass PATs to this, so it runs in Azure Pipelines only (not through MSBuild).
3+
# For local builds, some preconfiguration is necessary. Check the README.md for details.
4+
5+
# $workloadPath: The path to the directory as output for the workload ZIPs. This is --output-dir in the DARC command.
6+
# - Example Value: "$(RepoRoot)artifacts\workloads"
7+
# $gitHubPat: The GitHub PAT to use for DARC (CI build only). See workload-build.yml for converting the PAT to SecureString.
8+
# $azDOPat: The Azure DevOps PAT to use for DARC (CI build only). See workload-build.yml for converting the PAT to SecureString.
9+
# $workloadListJson: The JSON string of the list of workload drop names to download. If not provided, all workloads found in Version.Details.xml will be downloaded.
10+
# - See the workloadDropNames parameter in official.yml for the list generally passed to this script.
11+
# - Example Value: '{["emsdk","mono"]}'
12+
# $usePreComponents:
13+
# - If $true, includes *pre.components.zip drops and excludes *components.zip drops.
14+
# - If $false, excludes *pre.components.zip drops and includes *components.zip drops.
15+
116
param ([Parameter(Mandatory=$true)] [string] $workloadPath, [SecureString] $gitHubPat, [SecureString] $azDOPat, [string] $workloadListJson = '', [bool] $usePreComponents = $false)
217

318
### Local Build ###

eng/pipelines/official.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ parameters:
4545
displayName: Primary VS insertion branches
4646
type: object
4747
default:
48+
- main
4849
- rel/d17.12
50+
- rel/d17.13
4951
# These insert packs only into VS [no (pre)components].
5052
- name: secondaryVsInsertionBranches
5153
displayName: 'Secondary VS insertion branches [packs only]'
5254
type: object
53-
default:
54-
- rel/d17.13
55+
default: []
5556

5657
variables:
5758
# Variables used: DncEngInternalBuildPool

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
- task: AzureCLI@2
3737
displayName: 🟣 Download workloads for VS insertion
3838
inputs:
39-
# TODO: Need our own subscription
4039
azureSubscription: DotNetStaging
4140
scriptType: pscore
4241
scriptPath: $(Build.SourcesDirectory)/eng/download-workloads.ps1

global.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"tools": {
3-
"dotnet": "9.0.100",
4-
"xcopy-msbuild": "17.12.0"
3+
"dotnet": "9.0.100"
54
},
65
"msbuild-sdks": {
76
"Microsoft.Build.NoTargets": "3.7.0",

0 commit comments

Comments
 (0)