Skip to content

Commit

Permalink
fix(ab): allow REV_A==REV_B and delete temporary branches
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
roypat committed Aug 1, 2024
1 parent 213fc83 commit e675d77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .buildkite/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def ab_revision_build(revision):
"git branch $$branch_name $$commitish",
f"git clone -b $$branch_name . build/{revision}",
f"cd build/{revision} && ./tools/devtool -y build --release && cd -",
"git branch -D $$branch_name",
]


Expand All @@ -204,7 +205,9 @@ def shared_build():
if rev_a is not None:
rev_b = os.environ.get("REVISION_B")
assert rev_b is not None, "REVISION_B environment variable not set"
build_cmds = ab_revision_build(rev_a) + ab_revision_build(rev_b)
build_cmds = ab_revision_build(rev_a)
if rev_a != rev_b:
build_cmds += ab_revision_build(rev_b)
elif os.environ.get("BUILDKITE_PULL_REQUEST", "false") != "false":
build_cmds = ab_revision_build(
os.environ.get("BUILDKITE_PULL_REQUEST_BASE_BRANCH", "main")
Expand Down
1 change: 1 addition & 0 deletions tests/framework/ab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def git_clone(clone_path, commitish):
utils.check_output(
f"git clone -b {branch_name} {git_root.strip()} {clone_path}"
)
utils.check_output(f"git branch -D {branch_name}")
return clone_path


Expand Down

0 comments on commit e675d77

Please sign in to comment.