Draft
Conversation
|
Skipping CI for Draft Pull Request. |
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In the
make/env.mkfallback branch,git tag --list '[0-9]*.[0-9]*.x'can return nothing in a shallow clone, producing a version like-0-g<sha>; consider explicitly handling the “no tag found” case (e.g., defaulting to a clearer placeholder or skipping thetag-prefix when empty). - The
job-preamblestep relies ongit ls-remote --tags origin | grep -oP 'refs/tags/\K[0-9]+\.[0-9]+\.x$'which assumes tags with a strict<major>.<minor>.xformat and the availability ofgrep -P; consider making this more robust to different tag naming schemes (e.g.,v1.2.x) and environments wheregrep -Pmay not be present.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the `make/env.mk` fallback branch, `git tag --list '[0-9]*.[0-9]*.x'` can return nothing in a shallow clone, producing a version like `-0-g<sha>`; consider explicitly handling the “no tag found” case (e.g., defaulting to a clearer placeholder or skipping the `tag-` prefix when empty).
- The `job-preamble` step relies on `git ls-remote --tags origin | grep -oP 'refs/tags/\K[0-9]+\.[0-9]+\.x$'` which assumes tags with a strict `<major>.<minor>.x` format and the availability of `grep -P`; consider making this more robust to different tag naming schemes (e.g., `v1.2.x`) and environments where `grep -P` may not be present.
## Individual Comments
### Comment 1
<location path=".github/actions/job-preamble/action.yaml" line_range="156" />
<code_context>
+ echo "::warning::No version tag found via ls-remote"
+ exit 0
+ fi
+ git fetch --shallow-exclude="$tag" origin HEAD 2>/dev/null || true
+ shell: bash
+
</code_context>
<issue_to_address>
**question (bug_risk):** Clarify/verify that `--shallow-exclude` with `HEAD` actually yields enough history for `git describe` in all cases.
This approach assumes `HEAD` is on `origin/HEAD` and that the tag is on the same branch, so that `--shallow-exclude="$tag" origin HEAD` makes the tag an ancestor of `HEAD`.
If tags are created on other branches, this may either fetch much more history than intended or still leave the tag unreachable from `HEAD`. Consider explicitly fetching the expected branch (e.g. `origin/main`/`origin/master`) or resolving the tracked remote ref for `HEAD` and fetching that, to avoid surprises when default branches or tag placement change.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
2227924 to
5bc30cc
Compare
Contributor
|
Images are ready for the commit at ce30ad3. To use with deploy scripts, first |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19294 +/- ##
==========================================
- Coverage 49.62% 49.59% -0.03%
==========================================
Files 2680 2680
Lines 202214 202231 +17
==========================================
- Hits 100346 100306 -40
- Misses 94393 94432 +39
- Partials 7475 7493 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a419396 to
1f6b3ad
Compare
Remove fetch-depth: 0 from all checkout steps. Shallow clones (depth=1, the default) skip git history download, saving ~10s and ~220 MB per job. The job-preamble action resolves version info for shallow clones in ~3s: 1. git ls-remote finds the nearest X.Y.x version tag (~0.4s) 2. git fetch --shallow-exclude deepens history to the tag (~2s) 3. A local tag at the boundary enables git describe and make tag 4. BUILD_TAG env var is set as a fallback for make/env.mk Tries tags in reverse version order to handle both master and release branches. Commit count is off by 1 (--shallow-exclude stops above the tag commit) which is acceptable for version strings. Kept fetch-depth: 0 for misc-checks (git diff --check needs full history), push-scanner-manifests (no preamble), and update_*_periodic workflows (need all branches/tags). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1f6b3ad to
5f5f03e
Compare
Contributor
Author
|
/test all |
ce30ad3 to
f1051af
Compare
e2c3843 to
ef1c51f
Compare
Remove fetch-depth: 0 from all checkout steps. Shallow clones (depth=1, the default) skip git history download, saving ~10s and ~220 MB per job. The job-preamble action resolves version info for shallow clones in ~3s: 1. git ls-remote finds the nearest version tag (~0.4s) 2. git fetch --shallow-exclude deepens history to the tag (~2s) 3. A local tag at the boundary enables git describe and make tag 4. BUILD_TAG env var is set as a fallback for make/env.mk On master: finds the latest X.Y.x tag. On release branches: detects version from branch name and finds the nearest X.Y.Z or RC tag (e.g. release-4.10 finds 4.10.0, not 4.11.x). Kept fetch-depth: 0 for misc-checks (git diff --check needs full history), push-scanner-manifests (no preamble), and update_*_periodic workflows (need all branches/tags). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ef1c51f to
f9ac8d2
Compare
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.
Summary
Remove
fetch-depth: 0from all checkout steps. Shallow clones (depth=1, the default) skip git history download, saving ~10s and ~220 MB per job (~405 MB → ~184 MB checkout).How it works
The
job-preambleaction resolves version info for shallow clones in ~3s:git ls-remote --tagsfinds the nearestX.Y.xversion tag (~0.4s, no download)git fetch --shallow-exclude=<tag>deepens history to that tag (~2s, 39 MB)git describeworksBUILD_TAGenv var as fallback formake/env.mkTries tags in reverse version order to handle both master (
4.11.x) and release branches (4.10.x). Commit count is off by 1 (--shallow-excludestops above the tag commit) — acceptable for version strings.Benchmarked against 14 alternative strategies (test results). This approach is the fastest that produces correct version strings (8s vs 18s full clone).
Changes
fetch-depth: 0No changes to
make/env.mk, Makefiles, scripts, or the release process.Exceptions
Kept
fetch-depth: 0for:misc-checks: needs full history forgit diff --checkpush-scanner-manifests: nojob-preambleto resolve version tagupdate_*_periodicworkflows: need all branches/tags for version bumpsTest plan
4.11.x-241-g<sha>, off by 1 from full clone's 242)🤖 Generated with Claude Code