-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shallow_since appears to be a trap when used with commit, debug line should be removed #12857
Comments
+1 Also git's |
There is no way to persuade git to fetch a specific commit with --depth=1. If you try fetching a commit hash, most servers will just give you "server does not allow request for unadvertised object", and if you fetch a ref name then it can return anything and is not reproducible. shallow_since is the only feature git offers to do this. Unfortunately, it's completely broken. |
Correction: --depth=1 on a single commit only works with protocol v2, see #12199 |
@asuffield I don't think we're on protocol v2 (although I'm not completely sure how to verify that) and we've been using the commit only since I posted the issue without any apparent problems or non-reproducibility. As far as I can tell, the actions bazel is taking are equivalent to the following commands, which appear to work for me.
Do you mean that it doesn't work reliably with all git servers, so maybe it works on github but not elsewhere?
|
It looks like maybe the server config option bazel/tools/build_defs/repo/git_worker.bzl Line 129 in 8346ea4
|
It definitely fails with git 2.18 (ugh, upgrading that right now) against gitlab, I haven't tested exhaustively. But the main problem in the PR linked above is that one of bazel's target platforms has an old git version, and that's going to sabotage us here. |
Are there ways to improve this situation, even given bazel's support for ubuntu 18.04 and its associated git version? One option is simply to drop the warning from this rule (by making the rule output a canonical version that omits Another is to add something like an explicit I think that any change to the canonical form of this rule would involve changing what's returned from the Are there other ideas that could remove warnings from a correct repository setup that's relying on |
Git's `--shallow-since` feature can lead to broken checkouts and a fix isn't likely to happen: https://public-inbox.org/git/CAPSG9dZV2EPpVKkOMcjv5z+NF7rUu=V-ZkZNx47rCv122HsiKg@mail.gmail.com/T/#u This commit removes `shallow_since` from the canonical reproducible form of `git_repository` unless the attribute is provided explicitly. In cases where Bazel's attempt at fetching with `--depth=1` fail, e.g. if there is no server support for shallow fetches of arbitrary commits, the progress message is now used to inform the user about this potential for fetch time optimizations. Fixes bazelbuild#10292 Fixes bazelbuild#12857
Git's `--shallow-since` feature can lead to broken checkouts and a fix isn't likely to happen: https://public-inbox.org/git/CAPSG9dZV2EPpVKkOMcjv5z+NF7rUu=V-ZkZNx47rCv122HsiKg@mail.gmail.com/T/#u This commit removes `shallow_since` from the canonical reproducible form of `git_repository` unless the attribute is provided explicitly. In cases where Bazel's attempt at fetching with `--depth=1` fail, e.g. if there is no server support for shallow fetches of arbitrary commits, the progress message is now used to inform the user about this potential for fetch time optimizations. Fixes bazelbuild#10292 Fixes bazelbuild#12857
Git's `--shallow-since` feature can lead to broken checkouts and a fix isn't likely to happen: https://public-inbox.org/git/CAPSG9dZV2EPpVKkOMcjv5z+NF7rUu=V-ZkZNx47rCv122HsiKg@mail.gmail.com/T/#u This commit removes `shallow_since` from the canonical reproducible form of `git_repository` unless the attribute is provided explicitly. In cases where Bazel's attempt at fetching with `--depth=1` fail, e.g. if there is no server support for shallow fetches of arbitrary commits, the progress message is now used to inform the user about this potential for fetch time optimizations. Fixes bazelbuild#10292 Fixes bazelbuild#12857
Git's `--shallow-since` feature can lead to broken checkouts and a fix isn't likely to happen: https://public-inbox.org/git/CAPSG9dZV2EPpVKkOMcjv5z+NF7rUu=V-ZkZNx47rCv122HsiKg@mail.gmail.com/T/#u This commit removes `shallow_since` from the canonical reproducible form of `git_repository` unless the attribute is provided explicitly. In cases where Bazel's attempt at fetching with `--depth=1` fail, e.g. if there is no server support for shallow fetches of arbitrary commits, the progress message is now used to inform the user about this potential for fetch time optimizations. Fixes #10292 Fixes #12857 Closes #17356. PiperOrigin-RevId: 508569071 Change-Id: I01e6662e38c236d1800d427f66d48a05df818800
Git's `--shallow-since` feature can lead to broken checkouts and a fix isn't likely to happen: https://public-inbox.org/git/CAPSG9dZV2EPpVKkOMcjv5z+NF7rUu=V-ZkZNx47rCv122HsiKg@mail.gmail.com/T/#u This commit removes `shallow_since` from the canonical reproducible form of `git_repository` unless the attribute is provided explicitly. In cases where Bazel's attempt at fetching with `--depth=1` fail, e.g. if there is no server support for shallow fetches of arbitrary commits, the progress message is now used to inform the user about this potential for fetch time optimizations. Fixes #10292 Fixes #12857 Closes #17356. PiperOrigin-RevId: 508569071 Change-Id: I01e6662e38c236d1800d427f66d48a05df818800 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Based on bazelbuild/bazel#12857 shallow_since may actually slow down the build. As of version 6.1.0, bazel no longer prints a warning if shallow_since is absent.
Based on bazelbuild/bazel#12857 shallow_since may actually slow down the build. As of version 6.1.0, bazel no longer prints a warning if shallow_since is absent.
This reverts commit 5e3a41a. Since bazel v6.1.0 the warning about shallow_since has been removed since it was determined [1] to be potentially harmful to build performance and reliability. [1] bazelbuild/bazel#12857 Change-Id: Id9b44d260688b706a15be5df20d5a80e0968c548
This reverts commit a7246ed. Since bazel v6.1.0 the warning about shallow_since has been removed since it was determined [1] to be potentially harmful to build performance and reliability. [1] bazelbuild/bazel#12857 Change-Id: I6003ae03511bdc7b5ba2cbb6b15b928bba18bfb5
Using shallow_since is not recommended, and the attribute is expected to be removed in a future Bazel version: bazelbuild/bazel#17356, bazelbuild/bazel#12857 Change-Id: I3d6daeefad609fc34566b69de67eee2a49f7d5e4 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/193473 Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com> Pigweed-Auto-Submit: Ted Pudlik <tpudlik@google.com> Reviewed-by: Armando Montanez <amontanez@google.com>
Using shallow_since is not recommended, and the attribute is expected to be removed in a future Bazel version: bazelbuild/bazel#17356, bazelbuild/bazel#12857 Original-Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/193473 https://pigweed.googlesource.com/pigweed/pigweed third_party/pigweed Rolled-Commits: 371015e36501c36..9a3bb012f2c6dc4 Roller-URL: https://ci.chromium.org/b/8755460054149076049 GitWatcher: ignore CQ-Do-Not-Cancel-Tryjobs: true Change-Id: I8952a6aa062170a57fca6a2f0420e40d7242d403 Reviewed-on: https://pigweed-review.googlesource.com/c/example/echo/+/193492 Bot-Commit: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com> Commit-Queue: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
Description of the problem / feature request:
The
shallow_since
option tonew_git_repository
appears to be a trap, at least when used with thecommit
option. When shallow_since is provided, instead of usingdepth 1
to check out only the relevant commit, the entire repo state since some timestamp is cloned. On one of our repos, this causes a 25x difference in clone time (7s -> 175s) and presumably a large size disparity as well.Now that we have removed shallow_since, bazel emits a debug line encouraging us to add it back.
This seems wrong -- as far as I understand, the repo at a specific commit hash is a canonical reproducible form, so it seems like bazel should not be suggesting this change.
Feature requests: what underlying problem are you trying to solve with this feature?
Bazel should not recommend adding shallow_since since it is dramatically slower in some cases, and seems generally unnecessary to obtain a snapshot of the repository.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a
new_git_repository
rule for a large git repository at a commit that is not close to HEAD. Providing shallow_since will slow down the clone substantially.What operating system are you running Bazel on?
Linux, Ubuntu 20.04
What's the output of
bazel info release
?If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.n/a
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?n/a (private repo)
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
n/a
The text was updated successfully, but these errors were encountered: