Skip to content

Commit e675d77

Browse files
committed
fix(ab): allow REV_A==REV_B and delete temporary branches
Delete temporary branches created during checkout in the A/B process again, to avoid polluting checkouts with weirdly named branches. Fix the CI pre-build step failing if revision A and revision B are the same by only trying to clone once (as otherwise the two clones would use colliding build/ subdirectories. Signed-off-by: Patrick Roy <[email protected]>
1 parent 213fc83 commit e675d77

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.buildkite/common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def ab_revision_build(revision):
188188
"git branch $$branch_name $$commitish",
189189
f"git clone -b $$branch_name . build/{revision}",
190190
f"cd build/{revision} && ./tools/devtool -y build --release && cd -",
191+
"git branch -D $$branch_name",
191192
]
192193

193194

@@ -204,7 +205,9 @@ def shared_build():
204205
if rev_a is not None:
205206
rev_b = os.environ.get("REVISION_B")
206207
assert rev_b is not None, "REVISION_B environment variable not set"
207-
build_cmds = ab_revision_build(rev_a) + ab_revision_build(rev_b)
208+
build_cmds = ab_revision_build(rev_a)
209+
if rev_a != rev_b:
210+
build_cmds += ab_revision_build(rev_b)
208211
elif os.environ.get("BUILDKITE_PULL_REQUEST", "false") != "false":
209212
build_cmds = ab_revision_build(
210213
os.environ.get("BUILDKITE_PULL_REQUEST_BASE_BRANCH", "main")

tests/framework/ab_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def git_clone(clone_path, commitish):
247247
utils.check_output(
248248
f"git clone -b {branch_name} {git_root.strip()} {clone_path}"
249249
)
250+
utils.check_output(f"git branch -D {branch_name}")
250251
return clone_path
251252

252253

0 commit comments

Comments
 (0)