NewContents always reads from cache, but it is sometimes useful flush
cache and use NewContents as a way to read the updatedcontents of a
file.
For example, some presubmit checks run formatters and check if any files
are modified. Many of these use `git diff` but that isn't available in
a non-git workspace, so checks will have to rely on reading contents
directly.
Bug: b/333744051
Change-Id: I3b3f4c88cc130607020ad599bbc15616d559725c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5740609
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Adds new Git auth configuration logic which sets up a global config
which applies to all repos for a Gerrit host, as well as a local
config if the current repo has a different user set up (e.g., someone
with multiple emails used across different repos for the same Gerrit
host).
Bug: b/351071334
Change-Id: I3a73a50b7ecc80ba22442de808b7f20a488ffc6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723271
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
In the event that `git-remote-sso` doesn't yield the expected
cookies, run `git ls-remote` on chromium/All-Projects.
This operation is fairly quick and robust - this fallback code
should only execute at most 1/day.
R=ayatane, yiwzhang
Change-Id: I5290f47e56341e9c4fd3b295ae117650f592dc7c
Bug: 342644760
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5741848
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
To use build id/invocation id consistently, reclient_helper will set AUTONINJA_BUILD_ID as RBE_invocation_id as is.
The host name information will be added as a metrics label.
Bug: 355127782
Change-Id: I5609ef38d897b19029795adf1b288898986c7c70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5737676
Auto-Submit: Junji Watanabe <jwata@google.com>
Reviewed-by: Michael Savigny <msavigny@google.com>
Commit-Queue: Michael Savigny <msavigny@google.com>
There's going to be a use case to clear auth configuration even after
we remove the old auth stack.
Renumbering is safe because this enum is not stored outside of runtime.
Bug: b/351071334
Change-Id: Ib6522ffa6f1c8d817a37cce48d1abf2fcd7be339
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5727083
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Currently, {autoninja, autoninja.bat} scripts generate AUTONINJA_BUILD_ID by calling `python3 -c "import uuid; print(uuid.uuid4())"`.
This CL moves the logic at the beginning `autoninja.py`.
This also reduces the overhead of starting Python interpreter, which
takes around 60ms on my Windows workstaion.
```
> hyperfine python3
Benchmark 1: python3
Time (mean ± σ): 63.4 ms ± 7.8 ms [User: 25.7 ms, System: 33.7 ms]
Range (min … max): 51.0 ms … 80.2 ms 41 runs
```
Change-Id: I93d5b65f3c5542c3a93a3de1f27a5aa5d06c09a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5737673
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
It's unclear what the status is.
`build_telemetry status` or just `build_telemetry` prints the status.
Bug: 354726696
Change-Id: Id6d17a263f8ff6bea107499cee3ebe26ee422454
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5732737
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
Buildspecs haven't been used since 2021. Downstream code that sets the
BUILDSPEC_VERSION field has been removed.
Bug: 353561017
Change-Id: Iaf88ec73bed6b371a97fbdb6588a74b34e3b87fc
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited
Recipe-Nontrivial-Roll: chrome_release
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5718628
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Garrett Beaty <gbeaty@google.com>
The current logic checks if the mtime of .ninja_log is 2s older or not
to avoid duplicated uploads. This is problematic if post process takes
longer than 2s. e.g. Siso and/or Reclient's post process.
This CL changes the logic to store the last uploaded mtime as `.ninja_log.last_upload` file.
Bug: 353644846
Fixed: 353644846
Change-Id: I7fb82e43808476174644c50d97e984358a43409e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5724768
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
This CL unifies the opt-in/opt-out handling for build telemetry collections about Reclient and Ninjalog.
The user consent message will be displayed only once at the beginning of a build.
```
❯ autoninja -C out/deterministic-andorid-dbg base
*** NOTICE ***
Google-internal telemetry (including build logs, username, and hostname) is collected on corp machines to diagnose performance and fix build issues. This reminder will be shown 9 more times. See http://go/chrome-build-telemetry for details. Hide this notice or opt out by running: build_telemetry [opt-in] [opt-out]
*** END NOTICE ***
Proxy started successfully.
...
```
Bug: 345113094
Change-Id: Ie5886287c4bd20262be0ff247508ac3869441eb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5669094
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Michael Savigny <msavigny@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
This is a safer default if SSO is available
Bug: b/351071334
Change-Id: I2d6b3b5c0fbe3fb7b9783de3d7548be7f14d7391
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723448
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Make the name more accurate, this mode is specific to auth config
GitAuthConfigMode would be more accurate, but too verbose IMO
Bug: b/351071334
Change-Id: If5c7c07ee5fa62d3ac1026b04654650c1b7043f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723270
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
They weren't testing what they were supposed to be testing and just
happened to pass.
Bug: b/351071334
Change-Id: I2cdd4fe3dc4b09509c73042e81c78949da5f9ac0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723254
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Moves the dependency on Git+cwd up the call stack
Bug: b/351071334
Change-Id: Ia313f9d4720ee10398b757217c333118e9fc7341
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723091
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
We need to be able to do this from different dirs later.
Bug: b/351071334
Change-Id: I18dd2c71ea52d79a56ccaee88a12be97465b9d2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723089
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
If git config set is executed, it writes the new content into
a temp file (but called lock-file) and then replace .gitconfig
with it.
However, if it cannot create the lock file, it returns an error.
With this CL, if git config fails with the lock file error,
depot_tools will retry it at most 5 times with 0.2s interval.
It's found that there are applications, such as vscode extensions,
executes `git config set` frequently, and those could often cause
unexpected interruptions to ongoing `git rebase-updates`
by the lock failure.
Bug: 351950514
Change-Id: I985af0d8b7458dbf47cd6baa857dc5adccf15031
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5705561
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Makes __init__ a bit cleaner, and planning to make _shortname a
property also next, since it can be derived from _remote_url
Bug: b/351071334
Change-Id: I12f4363723172a9cdaba37f6beb8fa37bbf09d72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5718639
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Previously little bits of the scm.GIT were mocked (like SetConfig,
and GetConfig, but not the other config related methods).
This changes things so that the git config state is a class whose
logic is shared between prod and test, with a 'real' and 'test'
implementation which know how to load and save configuration at
a low level.
R=yiwzhang
Change-Id: I1dc11b550908862607ea539de7fa60fbce30e700
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5660891
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Allen Li <ayatane@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
bot_update sets disk usage before checkout in step_text.
This CL adds disk usage after checkout in step_text.
Bug: 351868766
Change-Id: I2d99c8a3e0bd8829df30d349789ac8be7086ccf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5717616
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
This reverts commit 1c0a575c4c.
Reason for revert: Suspected of causing infra failures on
bots like https://ci.chromium.org/ui/p/dawn/builders/try/cmake-linux-clang-dbg-x64/b8742144151501823569/infra.
Long-term should be fixed by removing the invalid configs,
but need to prevent these infra failures for now.
Original change's description:
> Add a recipe property to override bot_update's STALE_PROCESS_DURATION.
>
> Bug: 353444802
> Change-Id: I8d174e28fbbd552be591c8a4c1308a29de47d0b6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5713191
> Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
> Commit-Queue: Brian Ryner <bryner@google.com>
Bug: 353444802
Change-Id: I0a109304c6de16f96ceff7ca1e64e3cd10d6cf4a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5718634
Auto-Submit: Brian Sheedy <bsheedy@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
9eac71489c0776ea43565f9692c96312b2fc1676 3pp: limit the concurrency for compiling pyc to 4
1fadd9de253d2c327a8be880072b80979abe9ae8 cipkg: add support for more cipd package properties
Change-Id: I83bc0ee8a70eba1c4d1ea75e8218369b86418388
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5711210
Commit-Queue: Chenlin Fan <fancl@chromium.org>
Reviewed-by: Brian Ryner <bryner@google.com>