Update containers against worktrees#1075
Draft
zancas wants to merge 6 commits into
Draft
Conversation
… vars container-test bind-mounts the host workspace into /home/container_user/zaino. In a git worktree, the workspace's .git is a file containing `gitdir: <host-only-path>`, which the container cannot resolve. So `git rev-parse HEAD` from inside the build script returns empty, and the binary's GIT_COMMIT / BRANCH metadata silently becomes "" on every container build. Capture both values on the host before `podman run` (with `unknown` fallback for repos detached from a checkout) and forward them via `-e GIT_COMMIT=…` / `-e BRANCH=…`. Update zaino-state/build.rs to prefer the env values and shell out to git only as a fallback for direct host invocations of `cargo build`. Add corresponding `cargo:rerun-if-env-changed=` directives so cargo invalidates the crate only when these values actually change. This addresses the in-container half of the spurious-recompile cascade. The host-worktree half (`cargo:rerun-if-changed=../../.git/HEAD` resolving to a non-existent path because `.git` is a file in worktrees) is handled in the follow-up commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…recompile
`cargo:rerun-if-changed=../../.git/HEAD` is correct for a regular
clone but wrong for a git worktree, where `.git` is a file (the
gitdir-pointer) rather than a directory. The hardcoded path resolves
to a non-existent location, which cargo treats as always-changed,
forcing zaino-state (and everything that depends on it — zaino-serve,
zainod) to recompile on every cargo invocation.
Replace the static path with a `git_path("HEAD")` helper that calls
`git rev-parse --git-path HEAD`. Returns:
- `.git/HEAD` for a regular clone,
- `<main>/.git/worktrees/<name>/HEAD` for a worktree,
- None when git can't resolve the repo (e.g. bind-mounted workspace
inside a container with no access to the host gitdir) — in which
case the directive is skipped and the cargo:rerun-if-env-changed=
directives added in the previous commit handle invalidation.
After this commit, `cargo nextest run` on an unmodified worktree
completes with no `Compiling` lines, matching the regular-clone
behavior.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace `portpicker::pick_unused_port()` (random sampling in 15000..25000, ~10k-port range) with `zcash_local_net::network::pick_unused_port`, which delegates to the kernel for an ephemeral port. The portpicker range suffered birthday-paradox collisions under parallel test load, surfacing as `ConnectionRefused` flakes on `zebrad::get::*` and `zebra::lightwallet_indexer::*`. To pick up the helper, switch `zingo_test_vectors` and `zcash_local_net` from git deps to path deps against a sibling `../../../infras/dev` checkout, and have `Makefile.toml` conditionally bind-mount that checkout into the test container when it exists on the host. Drop the now-unused `portpicker` from the workspace and from `zaino-testutils`, and retype `make_uri` to take a plain `u16`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> If you'd rather a terse one-liner in the repo's build(scope): ... style: test(integration): switch to local infras checkout + kernel-assigned ports Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7ceade6 to
fbffdc8
Compare
Member
Author
|
This is blocked on publication of infrastructure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This eliminates unnecessary builds in worktrees that don't contain standard .git sub-directories.