Skip to content

Commit 2d16f06

Browse files
committed
fix(tag-repos): take branch from TAG_REPOS entry, not expected_branch
cmd_tag_repos unpacked dev_b/main_b from the TAG_REPOS entry but then re-derived the branch via expected_branch(), which consults the real stack_repos() table. After the pi de-fork, 'pi' is no longer in that table, so test_devstack_tag_repos (which tags a fake 'pi' repo) resolved an empty branch, 'rev-parse origin/' exited 128 while still printing the argument to stdout, the empty-sha guard was bypassed, and the command attempted a garbage 'origin/:refs/tags/...' push — CI test job failed. - select the branch from the TAG_REPOS tuple (mirrors the CI tag-repos job and keeps the command testable with a mocked repo set) - harden the guard: check the rev-parse exit code, not just empty output
1 parent 5d1107f commit 2d16f06

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎scripts/lpb-devstack‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ from localpibox.stack.version import ( # noqa: E402
6767
_find_version_file,
6868
bump_version,
6969
detect_pipeline,
70-
expected_branch,
7170
get_version,
7271
)
7372
from localpibox.stack.workspace import ( # noqa: E402
@@ -207,7 +206,10 @@ def cmd_tag_repos(cons: Console, *, pipeline: str = "dev",
207206

208207
failures = 0
209208
for name, dev_b, main_b in TAG_REPOS:
210-
b = expected_branch(name, pipeline)
209+
# Branch comes from the TAG_REPOS entry (mirrors the CI tag-repos
210+
# job); do not re-derive via expected_branch() — it would ignore
211+
# the actual tagging set and fail for repos no longer in the stack.
212+
b = dev_b if pipeline == "dev" else main_b
211213
path = _resolve_repo_path(name)
212214
if path is None:
213215
cons.error(f" {name}: no local clone at {_tag_repo_hint(name)} — "
@@ -218,8 +220,9 @@ def cmd_tag_repos(cons: Console, *, pipeline: str = "dev",
218220
if code != 0:
219221
cons.error(f" {name}: fetch failed ({(err.strip() or out.strip())[:80]})")
220222
return 1
221-
sha = git(path, "rev-parse", f"origin/{b}")[0].strip()
222-
if not sha:
223+
sha_out, _, sha_code = git(path, "rev-parse", f"origin/{b}")
224+
sha = sha_out.strip()
225+
if sha_code != 0 or not sha:
223226
cons.error(f" {name}: branch '{b}' not found on origin — aborting (fail fast)")
224227
return 1
225228

0 commit comments

Comments
 (0)