Skip to content

Commit f05cfe7

Browse files
committed
chore: add integration branch update scripts for release/lts-infrastructure
1 parent 18e20aa commit f05cfe7

File tree

2 files changed

+190
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)