Skip to content

Add Flat flow preview flow script #15841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 138 additions & 65 deletions scripts/create-preview-flow.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,96 @@ param
[Parameter(Mandatory=$true)][string]$VSChannel,
[switch]$AddInternalFlow,
[string]$InternalRuntimeChannel,
[string]$InternalSdkChannel
[string]$InternalSdkChannel,
[switch]$DryRun
)

$publicVMR = "https://github.com/dotnet/dotnet"
$internalVMR = "https://dev.azure.com/dnceng/internal/_git/dotnet-dotnet"

# Make a default channel for a repo+branch
function MakeDefaultChannel($repo, $branch, $channel)
{
Write-Host "Making default channel - $repo @ $branch -> $channel"
& darc add-default-channel --repo "$repo" --branch "$branch" --channel "$channel" --quiet
if (!$DryRun) {
& darc add-default-channel --repo "$repo" --branch "$branch" --channel "$channel" --quiet
}
}

# Disable flow on a channel
function DisableFlow($channel)
{
Write-Host "Disabling flow on $channel"
& darc subscription-status --disable --channel "$channel" --quiet --exact
if (!$DryRun) {
& darc subscription-status --disable --channel "$channel" --quiet --exact
}
}

function AddFlow($sourceRepo, $sourceChannel, $targetRepo, $targetBranch, $frequency)
# Add non-source flow. This is for traditional style (package only) dependency updates.
function AddPackageOnlyFlow($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
if (!$DryRun) {
& 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)
# Add batched non-source-only flow. This is for traditional style (package only) dependency updates.
function AddBatchedPackageOnlyFlow($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
if (!$DryRun) {
& darc add-subscription --source-repo "$sourceRepo" --channel "$sourceChannel" --target-repo "$targetRepo" --target-branch "$targetBranch" --update-frequency "$frequency" --quiet --no-trigger --batchable
}
}

# Add forward flow for sources.
function AddForwardFlow($sourceRepo, $sourceChannel, $targetVmr, $mapping, $targetBranch, $frequency)
{
Write-Host "Adding forward flow - $sourceRepo @ $sourceChannel -> $targetVmr ($mapping) @ $targetBranch ($frequency)"
if (!$DryRun) {
& darc add-subscription --source-repo "$sourceRepo" --channel "$sourceChannel" --target-repo "$targetVmr" --target-branch "$targetBranch" --source-enabled true --target-directory $mapping --update-frequency "$frequency" --quiet --no-trigger --standard-automerge
}
}

# Adds batched forward flow for sources. Used for SDK to have NuGet and SDK flow in parallel.
function AddBatchedForwardFlow($sourceRepo, $sourceChannel, $targetVmr, $mapping, $targetBranch, $frequency)
{
Write-Host "Adding batched forward flow - $sourceRepo @ $sourceChannel -> $targetVmr @ $targetBranch ($frequency)"
if (!$DryRun) {
& darc add-subscription --source-repo "$sourceRepo" --channel "$sourceChannel" --target-repo "$targetVmr" --target-branch "$targetBranch" --source-enabled true --target-directory $mapping --update-frequency "$frequency" --quiet --no-trigger --batchable
}
}

# Adds merge policy for batched subscriptions
function AddBatchedMergePolicy($targetRepo, $targetBranch)
{
Write-Host "Setting batched merge policy for $targetRepo @ $targetBranch"
& darc set-repository-policies --repo "$targetRepo" --branch "$targetBranch" --standard-automerge --quiet
if (!$DryRun) {
& darc set-repository-policies --repo "$targetRepo" --branch "$targetBranch" --standard-automerge --quiet
}
}

# Adds flow from a VMR back to a source repo. Source+packages
function AddBackwardsFlow($sourceVmr, $sourceChannel, $targetRepo, $mapping, $targetBranch, $frequency)
{
# Update splatting: use an array for extra arguments
$mainSubscriptionObject = & darc get-subscriptions --source-repo "$sourceVmr" --channel ".NET 10.0.1xx SDK" --target-repo "$targetRepo" --output-format json | ConvertFrom-Json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I wonder if we would want a a darc copy-subscription --id X command that would allow overriding parameters.

$excludedAssets = $mainSubscriptionObject.excludedAssets -join ";"
$excludedAssetsArg = @()
if ($excludedAssets) {
$excludedAssetsArg = @("--excluded-assets", $excludedAssets)
}
Write-Host "Adding backflow - $sourceVmr @ $sourceChannel -> $targetRepo @ $targetBranch ($frequency) with excluded assets ($excludedAssets)"
if (!$DryRun) {
& darc add-subscription --source-repo "$sourceVmr" --channel "$sourceChannel" --target-repo "$targetRepo" --target-branch "$targetBranch" --source-enabled true --source-directory $mapping $excludedAssetsArg --update-frequency "$frequency" --quiet --no-trigger --standard-automerge
}
}

# Adds a package only flow for arcade.
function AddArcadeFlow($targetRepo, $targetBranch)
{
AddFlow https://github.com/dotnet/arcade ".NET Eng - Latest" $targetRepo $targetBranch None
AddPackageOnlyFlow https://github.com/dotnet/arcade ".NET Eng - Latest" $targetRepo $targetBranch None
}

$InternalRuntimeBranch = "internal/$RuntimeBranch"
Expand Down Expand Up @@ -119,85 +173,104 @@ if ($AddInternalFlow) {
MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-templating $InternalSdkBranch $InternalSdkChannel
}

Write-Host "Make default channel for the VMR"
MakeDefaultChannel https://github.com/dotnet/dotnet $SdkBranch $SdkBranch

if ($AddInternalFlow) {
Write-Host "Make internal default channel for the VMR"
MakeDefaultChannel https://dev.azure.com/dnceng/internal/_git/dotnet-dotnet $InternalSdkBranch $InternalSdkChannel
}

Write-Host "Setting up batched merge policies"
AddBatchedMergePolicy https://github.com/dotnet/aspnetcore $RuntimeBranch

if ($AddInternalFlow) {
AddBatchedMergePolicy https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore $InternalRuntimeBranch
}

Write-Host "Adding arcade flow"
Write-Host "Adding arcade flow to repos not building in the VMR"
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
AddArcadeFlow https://github.com/dotnet/emsdk $RuntimeBranch
AddArcadeFlow https://github.com/dotnet/icu "dotnet/$RuntimeBranch"
AddArcadeFlow https://github.com/dotnet/runtime $RuntimeBranch
AddArcadeFlow https://github.com/dotnet/windowsdesktop $RuntimeBranch
AddArcadeFlow https://github.com/dotnet/wpf $RuntimeBranch
AddArcadeFlow https://github.com/dotnet/winforms $RuntimeBranch
AddArcadeFlow https://github.com/dotnet/sdk $SdkBranch
AddArcadeFlow https://github.com/dotnet/roslyn-analyzers $SdkBranch
AddArcadeFlow https://github.com/dotnet/templating $SdkBranch

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
AddBatchedFlow https://github.com/dotnet/efcore $RuntimeChannel https://github.com/dotnet/aspnetcore $RuntimeBranch EveryBuild
AddFlow https://github.com/dotnet/icu $RuntimeChannel https://github.com/dotnet/runtime $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

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-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 "Adding non-VMR runtime flow"
AddPackageOnlyFlow https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int $RuntimeChannel https://github.com/dotnet/wpf $RuntimeBranch EveryBuild
AddPackageOnlyFlow https://github.com/dotnet/icu $RuntimeChannel https://github.com/dotnet/runtime $RuntimeBranch EveryBuild

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/dotnet/emsdk $RuntimeChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild
Write-Host "Adding arcade VMR forward flow (non-automatic)"
AddForwardFlow https://github.com/dotnet/arcade $RuntimeChannel $publicVMR arcade $SdkBranch None

Write-Host "Adding VMR runtime repo forward flow"
AddForwardFlow https://github.com/dotnet/aspnetcore $RuntimeChannel $publicVMR aspnetcore $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/efcore $RuntimeChannel $publicVMR efcore $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/emsdk $RuntimeChannel $publicVMR emsdk $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/runtime $RuntimeChannel $publicVMR runtime $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/winforms $RuntimeChannel $publicVMR winforms $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/windowsdesktop $RuntimeChannel $publicVMR windowsdesktop $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/wpf $RuntimeChannel $publicVMR wpf $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
AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-runtime $InternalRuntimeChannel https://dev.azure.com/dnceng/internal/_git/dotnet-templating $InternalSdkBranch EveryBuild
Write-Host "Adding internal VMR runtime repo forward flow"
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore $InternalRuntimeChannel $internalVMR aspnetcore $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-efcore $InternalRuntimeChannel $internalVMR efcore $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-emsdk $InternalRuntimeChannel $internalVMR emsdk $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-runtime $InternalRuntimeChannel $internalVMR runtime $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-winforms $InternalRuntimeChannel $internalVMR winforms $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-windowsdesktop $InternalRuntimeChannel $internalVMR windowsdesktop $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-wpf $InternalRuntimeChannel $internalVMR wpf $InternalSdkBranch EveryBuild

Write-Host "Disabling internal runtime->internal sdk flow"
Write-Host "Disabling internal VMR runtime repo forward flow"
DisableFlow $InternalRuntimeChannel
}

Write-Host "Add sdk->sdk flow"
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 VMR sdk repo forward flow"
AddForwardFlow https://github.com/dotnet/roslyn-analyzers $SdkChannel $publicVMR roslyn-analyzers $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/templating $SdkChannel $publicVMR templating $SdkBranch EveryBuild
# SDK is batched so that it batches alongside NuGet for a cohesive set of changes.
AddBatchedForwardFlow https://github.com/dotnet/sdk $SdkChannel $publicVMR sdk $SdkBranch EveryBuild

if ($AddInternalFlow) {
Write-Host "Adding internal sdk->internal sdk flow"
AddFlow https://dev.azure.com/dnceng/internal/_git/dotnet-templating $InternalSdkChannel https://dev.azure.com/dnceng/internal/_git/dotnet-sdk $InternalSdkBranch EveryBuild
Write-Host "Adding internal VMR sdk repo forward flow"
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-roslyn-analyzers $InternalSdkChannel $internalVMR roslyn-analyzers $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-sdk $InternalSdkChannel $internalVMR sdk $InternalSdkBranch EveryBuild
AddForwardFlow https://dev.azure.com/dnceng/internal/_git/dotnet-templating $InternalSdkChannel $internalVMR templating $InternalSdkBranch EveryBuild

Write-Host "Disabling internal sdk->internal sdk flow"
Write-Host "Disabling internal sdk repo forward 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
AddFlow https://github.com/dotnet/msbuild $VSChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild
AddFlow https://github.com/dotnet/razor $VSChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild
Write-Host "Adding tooling repo VMR forward flow"
# NuGet is special in that it flows into the SDK and then batched source into the VMR
# Change to traditional flow when https://github.com/dotnet/arcade-services/issues/4665 is resolved
AddPackageOnlyFlow https://github.com/nuget/nuget.client $VSChannel https://github.com/dotnet/sdk $SdkBranch EveryBuild
AddBatchedForwardFlow https://github.com/nuget/nuget.client $VSChannel $publicVMR nuget-client $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/roslyn $VSChannel $publicVMR roslyn $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/fsharp $VSChannel $publicVMR fsharp $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/msbuild $VSChannel $publicVMR msbuild $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/razor $VSChannel $publicVMR razor $SdkBranch EveryBuild
AddForwardFlow https://github.com/dotnet/vstest $VSChannel $publicVMR vstest $SdkBranch EveryBuild

if ($AddInternalFlow) {
Write-Host "Adding internal VMR sdk repo forward flow"
# It's not quite yet clear what the flow will look like for internal VMR flow.
throw "NYI"
}

Write-Host "Adding VMR->repo backflow."
# Only repos that branch for a release get backflow
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/runtime runtime $RuntimeBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/aspnetcore aspnetcore $RuntimeBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/efcore efcore $RuntimeBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/emsdk emsdk $RuntimeBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/windowsdesktop windowsdesktop $RuntimeBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/winforms winforms $RuntimeBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/wpf wpf $RuntimeBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/roslyn-analyzers templating $SdkBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/sdk sdk $SdkBranch EveryBuild
AddBackwardsFlow $publicVMR $SdkChannel https://github.com/dotnet/templating templating $SdkBranch EveryBuild

if ($AddInternalFlow) {
Write-Host "Adding internal VMR sdk repo backflow"

# It's not quite yet clear what the flow will look like for internal VMR backflow.
throw "NYI"
}
Loading