Skip to content

Commit 4c91a33

Browse files
committed
chore: add integration branch update scripts for release/next-gen
1 parent 9f0c5b3 commit 4c91a33

File tree

2 files changed

+173
-0
lines changed

2 files changed

+173
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# delete-me-update-all-integration-branches.ps1
2+
# Updates ALL integration branches from their component branches.
3+
# Run from any branch -- it will stash changes, update each integration branch, then return.
4+
5+
$ErrorActionPreference = 'Stop'
6+
7+
$originalBranch = git rev-parse --abbrev-ref HEAD
8+
$stashed = $false
9+
10+
# Stash any uncommitted changes
11+
$status = git status --porcelain
12+
if ($status) {
13+
Write-Host "Stashing uncommitted changes..." -ForegroundColor Cyan
14+
git stash push -m "auto-stash before integration branch update"
15+
$stashed = $true
16+
}
17+
18+
Write-Host "Fetching all branches from origin..." -ForegroundColor Cyan
19+
git fetch origin
20+
21+
$integrationBranches = @(
22+
@{
23+
Name = 'release/next-gen'
24+
Branches = @(
25+
'feature/test-workflow-engine'
26+
'feature/hot-runner-protocol'
27+
'feature/generic-artifact-system'
28+
'feature/incremental-sync-protocol'
29+
'feature/community-plugin-validation'
30+
'feature/cli-support'
31+
)
32+
}
33+
@{
34+
Name = 'release/lts-2.0.0'
35+
Branches = @(
36+
# Infrastructure
37+
'feature/orchestrator-enterprise-support'
38+
'feature/cloud-run-azure-providers'
39+
'feature/provider-load-balancing'
40+
'feature/orchestrator-unit-tests'
41+
'fix/secure-git-token-usage'
42+
'feature/premade-secret-sources'
43+
'feature/ci-platform-providers'
44+
'feature/build-reliability'
45+
'ci/orchestrator-integrity-speedup'
46+
# Next-gen
47+
'feature/test-workflow-engine'
48+
'feature/hot-runner-protocol'
49+
'feature/generic-artifact-system'
50+
'feature/incremental-sync-protocol'
51+
'feature/community-plugin-validation'
52+
'feature/cli-support'
53+
)
54+
}
55+
)
56+
57+
foreach ($integration in $integrationBranches) {
58+
$name = $integration.Name
59+
Write-Host "`n========================================" -ForegroundColor Cyan
60+
Write-Host "Updating $name" -ForegroundColor Cyan
61+
Write-Host "========================================" -ForegroundColor Cyan
62+
63+
# Check if branch exists locally
64+
$exists = git branch --list $name
65+
if (-not $exists) {
66+
Write-Host "Creating local branch from origin/$name..." -ForegroundColor Yellow
67+
git checkout -b $name "origin/$name"
68+
} else {
69+
git checkout $name
70+
git pull origin $name --ff-only 2>$null
71+
if ($LASTEXITCODE -ne 0) {
72+
git pull origin $name --no-edit
73+
}
74+
}
75+
76+
$failed = @()
77+
foreach ($branch in $integration.Branches) {
78+
$remoteBranch = "origin/$branch"
79+
# Check if remote branch exists
80+
$refExists = git rev-parse --verify $remoteBranch 2>$null
81+
if ($LASTEXITCODE -ne 0) {
82+
Write-Host " Skipping $branch (not found on remote)" -ForegroundColor DarkGray
83+
continue
84+
}
85+
86+
# Check if already merged
87+
$mergeBase = git merge-base HEAD $remoteBranch 2>$null
88+
$remoteHead = git rev-parse $remoteBranch 2>$null
89+
if ($mergeBase -eq $remoteHead) {
90+
Write-Host " $branch - already up to date" -ForegroundColor DarkGray
91+
continue
92+
}
93+
94+
Write-Host " Merging $branch..." -ForegroundColor Yellow
95+
$result = git merge $remoteBranch --no-edit 2>&1
96+
if ($LASTEXITCODE -ne 0) {
97+
Write-Host " CONFLICT - skipped (resolve manually)" -ForegroundColor Red
98+
$failed += $branch
99+
git merge --abort
100+
} else {
101+
Write-Host " OK" -ForegroundColor Green
102+
}
103+
}
104+
105+
if ($failed.Count -gt 0) {
106+
Write-Host "`n Conflicts in:" -ForegroundColor Red
107+
$failed | ForEach-Object { Write-Host " - $_" -ForegroundColor Red }
108+
}
109+
110+
# Push
111+
Write-Host " Pushing $name to origin..." -ForegroundColor Cyan
112+
git push origin $name
113+
}
114+
115+
# Return to original branch
116+
Write-Host "`nReturning to $originalBranch..." -ForegroundColor Cyan
117+
git checkout $originalBranch
118+
119+
if ($stashed) {
120+
Write-Host "Restoring stashed changes..." -ForegroundColor Cyan
121+
git stash pop
122+
}
123+
124+
Write-Host "`nDone!" -ForegroundColor Green
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# delete-me-update-this-integration-branch.ps1
2+
# Run this script from the repo root while on the release/next-gen branch.
3+
# It merges the latest from each component branch to keep this integration branch current.
4+
# After running, review any conflicts, then commit and push.
5+
6+
$ErrorActionPreference = 'Stop'
7+
8+
$branchName = git rev-parse --abbrev-ref HEAD
9+
if ($branchName -ne 'release/next-gen') {
10+
Write-Error "Must be on release/next-gen branch. Currently on: $branchName"
11+
exit 1
12+
}
13+
14+
# Component branches for this integration branch
15+
$branches = @(
16+
'feature/test-workflow-engine'
17+
'feature/hot-runner-protocol'
18+
'feature/generic-artifact-system'
19+
'feature/incremental-sync-protocol'
20+
'feature/community-plugin-validation'
21+
'feature/cli-support'
22+
)
23+
24+
Write-Host "Fetching latest from origin..." -ForegroundColor Cyan
25+
git fetch origin
26+
27+
$failed = @()
28+
foreach ($branch in $branches) {
29+
Write-Host "`nMerging origin/$branch..." -ForegroundColor Yellow
30+
$result = git merge "origin/$branch" --no-edit 2>&1
31+
if ($LASTEXITCODE -ne 0) {
32+
Write-Host " CONFLICT merging $branch - resolve manually" -ForegroundColor Red
33+
$failed += $branch
34+
# Abort this merge so we can continue with others
35+
git merge --abort
36+
} else {
37+
Write-Host " Merged successfully" -ForegroundColor Green
38+
}
39+
}
40+
41+
if ($failed.Count -gt 0) {
42+
Write-Host "`nThe following branches had conflicts and were skipped:" -ForegroundColor Red
43+
$failed | ForEach-Object { Write-Host " - $_" -ForegroundColor Red }
44+
Write-Host "`nRe-run after resolving, or merge them manually:" -ForegroundColor Yellow
45+
$failed | ForEach-Object { Write-Host " git merge origin/$_" -ForegroundColor Yellow }
46+
} else {
47+
Write-Host "`nAll branches merged successfully!" -ForegroundColor Green
48+
Write-Host "Run 'git push origin release/next-gen' to update the remote." -ForegroundColor Cyan
49+
}

0 commit comments

Comments
 (0)