diff --git a/scripts/create-net6-preview-flow.ps1 b/scripts/create-net6-preview-flow.ps1 index d67150a11d7..c5a25d9f562 100644 --- a/scripts/create-net6-preview-flow.ps1 +++ b/scripts/create-net6-preview-flow.ps1 @@ -4,7 +4,10 @@ param [Parameter(Mandatory=$true)][string]$SdkChannel, [Parameter(Mandatory=$true)][string]$RuntimeBranch, [Parameter(Mandatory=$true)][string]$SdkBranch, - [Parameter(Mandatory=$true)][string]$VSChannel + [Parameter(Mandatory=$true)][string]$VSChannel, + [switch]$AddInternalFlow, + [string]$InternalRuntimeChannel, + [string]$InternalSdkChannel ) function MakeDefaultChannel($repo, $branch, $channel) @@ -13,18 +16,37 @@ function MakeDefaultChannel($repo, $branch, $channel) & darc add-default-channel --repo "$repo" --branch "$branch" --channel "$channel" --quiet } +function DisableFlow($channel) +{ + Write-Host "Disabling flow on $channel" + & darc subscription-status --disable --channel "$channel" --quiet --exact +} + function AddFlow($sourceRepo, $sourceChannel, $targetRepo, $targetBranch, $frequency) { Write-Host "Adding flow - $sourceRepo @ $sourceChannel -> $targetRepo @ $targetBranch ($frequency)" & darc add-subscription --source-repo "$sourceRepo" --channel "$sourceChannel" --target-repo "$targetRepo" --target-branch "$targetBranch" --update-frequency "$frequency" --quiet --no-trigger --standard-automerge } +function AddBatchedFlow($sourceRepo, $sourceChannel, $targetRepo, $targetBranch, $frequency) +{ + Write-Host "Adding flow - $sourceRepo @ $sourceChannel -> $targetRepo @ $targetBranch ($frequency)" + & darc add-subscription --source-repo "$sourceRepo" --channel "$sourceChannel" --target-repo "$targetRepo" --target-branch "$targetBranch" --update-frequency "$frequency" --quiet --no-trigger --batchable +} + +function AddBatchedMergePolicy($targetRepo, $targetBranch) +{ + Write-Host "Setting batched merge policy for $targetRepo @ $targetBranch" + & darc set-repository-policies --repo "$targetRepo" --branch "$targetBranch" --standard-automerge --quiet +} + function AddArcadeFlow($targetRepo, $targetBranch) { AddFlow https://github.com/dotnet/arcade ".NET Eng - Latest" $targetRepo $targetBranch None } -# Make default channels +$InternalRuntimeBranch = "internal/$RuntimeBranch" +$InternalSdkBranch = "internal/$SdkBranch" Write-Host "Making default channels for runtime repos" MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int $RuntimeBranch $RuntimeChannel @@ -38,15 +60,42 @@ MakeDefaultChannel https://github.com/dotnet/wpf $RuntimeBranch $RuntimeChannel MakeDefaultChannel https://github.com/dotnet/winforms $RuntimeBranch $RuntimeChannel MakeDefaultChannel https://github.com/mono/linker $RuntimeBranch $RuntimeChannel +if ($AddInternalFlow) { + # Because of where internal fixes tend to be, we eliminate some leaves in the graph + # and flow them through the normal public channels: emsdk, icu, linker. + # wpf-int gets assigned to the internal channel in addition (since there is no public->internal merge) + Write-Host "Making default channels for internal branches of runtime repos" + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int $RuntimeBranch $InternalRuntimeChannel + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore $InternalRuntimeBranch $InternalRuntimeChannel + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-efcore $InternalRuntimeBranch $InternalRuntimeChannel + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-runtime $InternalRuntimeBranch $InternalRuntimeChannel + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-windowsdesktop $InternalRuntimeBranch $InternalRuntimeChannel + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-wpf $InternalRuntimeBranch $InternalRuntimeChannel + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-winforms $InternalRuntimeBranch $InternalRuntimeChannel +} + Write-Host "Making default channels for SDK repos" MakeDefaultChannel https://github.com/dotnet/installer $SdkBranch $SdkChannel MakeDefaultChannel https://github.com/dotnet/sdk $SdkBranch $SdkChannel MakeDefaultChannel https://github.com/dotnet/roslyn-analyzers $SdkBranch $SdkChannel MakeDefaultChannel https://github.com/dotnet/templating $SdkBranch $SdkChannel -# Make dependency flow +if ($AddInternalFlow) { + # Because of where internal fixes tend to be, we eliminate some leaves in the sdk graph + # and flow them through the normal public channels: templating, roslyn-analyzers + Write-Host "Making default channels for SDK repos" + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-installer $InternalSdkBranch $InternalSdkChannel + MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-sdk $InternalSdkBranch $InternalSdkChannel +} + +Write-Host "Setting up batched merge policies" +AddBatchedMergePolicy https://github.com/dotnet/aspnetcore $RuntimeBranch -Write-Host "Add arcade flow" +if ($AddInternalFlow) { + AddBatchedMergePolicy https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore $InternalRuntimeBranch +} + +Write-Host "Adding arcade flow" AddArcadeFlow https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int $RuntimeBranch AddArcadeFlow https://github.com/dotnet/aspnetcore $RuntimeBranch AddArcadeFlow https://github.com/dotnet/efcore $RuntimeBranch @@ -62,31 +111,64 @@ AddArcadeFlow https://github.com/dotnet/sdk $SdkBranch AddArcadeFlow https://github.com/dotnet/roslyn-analyzers $SdkBranch AddArcadeFlow https://github.com/dotnet/templating $SdkBranch -Write-Host "Add runtime -> runtime flow" +Write-Host "Adding runtime -> runtime flow" AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int $RuntimeChannel https://github.com/dotnet/wpf $RuntimeBranch EveryBuild -AddFlow https://github.com/dotnet/efcore $RuntimeChannel https://github.com/dotnet/aspnetcore $RuntimeBranch EveryBuild -AddFlow https://github.com/dotnet/emsdk $RuntimeChannel https://github.com/dotnet/aspnetcore $RuntimeBranch EveryBuild +AddBatchedFlow https://github.com/dotnet/efcore $RuntimeChannel https://github.com/dotnet/aspnetcore $RuntimeBranch EveryBuild +AddBatchedFlow https://github.com/dotnet/emsdk $RuntimeChannel https://github.com/dotnet/aspnetcore $RuntimeBranch EveryBuild AddFlow https://github.com/dotnet/emsdk $RuntimeChannel https://github.com/dotnet/runtime $RuntimeBranch EveryBuild AddFlow https://github.com/dotnet/icu $RuntimeChannel https://github.com/dotnet/runtime $RuntimeBranch EveryBuild -AddFlow https://github.com/dotnet/runtime $RuntimeChannel https://github.com/dotnet/aspnetcore $RuntimeBranch EveryBuild +AddBatchedFlow https://github.com/dotnet/runtime $RuntimeChannel https://github.com/dotnet/aspnetcore $RuntimeBranch EveryBuild AddFlow https://github.com/dotnet/runtime $RuntimeChannel https://github.com/dotnet/efcore $RuntimeBranch EveryBuild AddFlow https://github.com/dotnet/runtime $RuntimeChannel https://github.com/dotnet/winforms $RuntimeBranch EveryBuild AddFlow https://github.com/dotnet/winforms $RuntimeChannel https://github.com/dotnet/wpf $RuntimeBranch EveryBuild AddFlow https://github.com/dotnet/wpf $RuntimeChannel https://github.com/dotnet/windowsdesktop $RuntimeBranch EveryBuild AddFlow https://github.com/mono/linker $RuntimeChannel https://github.com/dotnet/runtime $RuntimeBranch EveryBuild +if ($AddInternalFlow) { + Write-Host "Adding internal runtime -> internal runtime flow" + AddBatchedFlow https://dev.azure.com/dnceng/internal/_git/dotnet-efcore $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore $InternalRuntimeBranch EveryBuild + AddBatchedFlow https://dev.azure.com/dnceng/internal/_git/dotnet-runtime $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore $InternalRuntimeBranch EveryBuild + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-wpf $InternalRuntimeBranch EveryBuild + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-runtime $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-efcore $InternalRuntimeBranch EveryBuild + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-runtime $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-winforms $InternalRuntimeBranch EveryBuild + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-winforms $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-wpf $InternalRuntimeBranch EveryBuild + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-wpf $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-windowsdesktop $InternalRuntimeBranch EveryBuild + + Write-Host "Disabling internal runtime -> internal runtime flow" + DisableFlow $InternalRuntimeChannel +} + Write-Host "Add runtime->sdk flow" AddFlow https://github.com/dotnet/aspnetcore $RuntimeChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild AddFlow https://github.com/dotnet/windowsdesktop $RuntimeChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild AddFlow https://github.com/dotnet/runtime $RuntimeChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild AddFlow https://github.com/mono/linker $RuntimeChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild +if ($AddInternalFlow) { + Write-Host "Adding internal runtime->internal sdk flow" + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-sdk $InternalSdkBranch EveryBuild + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-windowsdesktop $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-sdk $InternalSdkBranch EveryBuild + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-runtime $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-sdk $InternalSdkBranch EveryBuild + + Write-Host "Disabling internal runtime->internal sdk flow" + DisableFlow $InternalRuntimeChannel +} + Write-Host "Add sdk->sdk flow" AddFlow https://github.com/dotnet/sdk $SdkChannel https://github.com/dotnet/installer $SdkBranch EveryBuild AddFlow https://github.com/dotnet/roslyn-analyzers $SdkChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild AddFlow https://github.com/dotnet/templating $SdkChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild -Write-Host "Add tooling->sdk flow" +if ($AddInternalFlow) { + Write-Host "Adding internal sdk->internal sdk flow" + # Nothing but SDK->installer flows internally + AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-sdk $InternalSdkChannel https://dev.azure.com/dnceng/internal/_git/dotnet-installer $InternalSdkBranch EveryBuild + + Write-Host "Disabling internal sdk->internal sdk flow" + DisableFlow $InternalSdkChannel +} + +Write-Host "Adding tooling->sdk flow" AddFlow https://github.com/nuget/nuget.client $VSChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild AddFlow https://github.com/dotnet/roslyn $VSChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild AddFlow https://github.com/dotnet/fsharp $VSChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild diff --git a/scripts/flip-previewplus-flow.ps1 b/scripts/flip-previewplus-flow.ps1 new file mode 100644 index 00000000000..00ab240dd8f --- /dev/null +++ b/scripts/flip-previewplus-flow.ps1 @@ -0,0 +1,50 @@ +param +( + [Parameter(Mandatory=$true)][string]"$RuntimeChannel", + [Parameter(Mandatory=$true)][string]"$SdkChannel", + [Parameter(Mandatory=$true)][string]"$InternalRuntimeChannel", + [Parameter(Mandatory=$true)][string]"$InternalSdkChannel", + [Parameter(Mandatory=$true)][ValidateSet('Preview','Preview+')][string]$FlowType, + [switch]$TriggerSubscriptions +) + +Write-Host "Switching flow to $FlowType" + +switch ( $FlowType ) +{ + 'Preview' { + # Switching to public flow is easy. Enable all the subscriptions in the public runtime and SDK channels + # and disable any on the internal channels + & darc subscription-status --disable --channel "$InternalRuntimeChannel" --quiet --exact + & darc subscription-status --disable --channel "$InternalSdkChannel" --quiet --exact + & darc subscription-status --enable --channel "$RuntimeChannel" --quiet --exact + & darc subscription-status --enable --channel "$SdkChannel" --quiet --exact + + # Trigger public subscriptions + if ($TriggerSubscriptions) { + & darc trigger-subscriptions --channel "$RuntimeChannel" --quiet --exact + & darc trigger-subscriptions --channel "$SdkChannel" --quiet --exact + } + } + 'Preview+' { + # Switching to internal flow is a little more subtle. Enable the internal subscriptions, + # then disable the corresponding public subscriptions, which is a subset of the full public channel + & darc subscription-status --enable --channel "$InternalRuntimeChannel" --quiet --exact + & darc subscription-status --enable --channel "$InternalSdkChannel" --quiet --exact + + & darc subscription-status --disable --source-repo https://github.com/dotnet/runtime --channel "$RuntimeChannel" --quiet --exact + & darc subscription-status --disable --source-repo https://github.com/dotnet/winforms --channel "$RuntimeChannel" --quiet --exact + & darc subscription-status --disable --source-repo https://github.com/dotnet/wpf --channel "$RuntimeChannel" --quiet --exact + & darc subscription-status --disable --source-repo https://github.com/dotnet/windowsdesktop --channel "$RuntimeChannel" --quiet --exact + & darc subscription-status --disable --source-repo https://github.com/dotnet/aspnetcore --channel "$RuntimeChannel" --quiet --exact + & darc subscription-status --disable --source-repo https://github.com/dotnet/efcore --channel "$RuntimeChannel" --quiet --exact + & darc subscription-status --disable --source-repo https://github.com/dotnet/sdk --channel "$SdkChannel" --quiet --exact + + # Trigger internal subscriptions + if ($TriggerSubscriptions) { + & darc trigger-subscriptions --channel "$InternalRuntimeChannel" --quiet --exact + & darc trigger-subscriptions --channel "$InternalSdkChannel" --quiet --exact + } + } + default { Write-Error "Unknown flow type $FlowType" } +} \ No newline at end of file