Conversation
|
Hi @Tema. Thanks for your PR. I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
📝 WalkthroughWalkthroughThe Makefile now computes Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Makefile`:
- Around line 70-71: GITHASH and GITBRANCH are being eagerly evaluated with :=
causing git commands to run at Makefile parse time; change their assignment to
conditional/simple assignment (use ?= like RELEASE_VERSION) and provide safe
fallback defaults (e.g., "unknown" or empty) so that git rev-parse is only
executed when requested and not during every make invocation; update the lines
that define GITHASH and GITBRANCH to mirror the RELEASE_VERSION pattern so they
don't fail in non-git or shallow-clone environments.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| GITHASH := $(shell git rev-parse HEAD) | ||
| GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify current assignment flavor and linker-flag usage (read-only).
rg -n '^(GITHASH|GITBRANCH)\s*[:?]?=' Makefile -C2
rg -n 'PDGitHash|PDGitBranch' Makefile -C2Repository: tikv/pd
Length of output: 630
🏁 Script executed:
#!/bin/bash
# Check for other assignments to GITHASH or GITBRANCH
rg -n 'GITHASH|GITBRANCH' Makefile
# Check how other shell-based assignments are handled in Makefile
rg -n 'shell.*git|:=.*\$\(shell' Makefile | head -20Repository: tikv/pd
Length of output: 899
🏁 Script executed:
#!/bin/bash
# Check for CI guards or checks for git context
rg -n '\.git|GIT_DIR|git.*error|non-git' Makefile -C1
# Check if any targets skip git operations
rg -n 'ifeq.*git|ifdef.*GIT' MakefileRepository: tikv/pd
Length of output: 511
Avoid eager git command execution during Makefile parse.
On Lines 70-71, := runs git rev-parse for every make invocation (including non-build targets), which can fail in non-git contexts (shallow clones, docker builds) and inject empty values. Use ?= with fallbacks to match the pattern already established by RELEASE_VERSION on Line 65.
🔧 Suggested change
-GITHASH := $(shell git rev-parse HEAD)
-GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD)
+GITHASH ?= $(shell git rev-parse HEAD 2>/dev/null || echo None)
+GITBRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo None)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| GITHASH := $(shell git rev-parse HEAD) | |
| GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD) | |
| GITHASH ?= $(shell git rev-parse HEAD 2>/dev/null || echo None) | |
| GITBRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo None) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Makefile` around lines 70 - 71, GITHASH and GITBRANCH are being eagerly
evaluated with := causing git commands to run at Makefile parse time; change
their assignment to conditional/simple assignment (use ?= like RELEASE_VERSION)
and provide safe fallback defaults (e.g., "unknown" or empty) so that git
rev-parse is only executed when requested and not during every make invocation;
update the lines that define GITHASH and GITBRANCH to mirror the RELEASE_VERSION
pattern so they don't fail in non-git or shallow-clone environments.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10514 +/- ##
==========================================
+ Coverage 78.88% 78.92% +0.03%
==========================================
Files 530 531 +1
Lines 71548 71632 +84
==========================================
+ Hits 56439 56533 +94
+ Misses 11092 11071 -21
- Partials 4017 4028 +11
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Signed-off-by: artem_danilov <artem.danilov@airbnb.com>
|
What's the difference? |
@bufferflies no-op for you, but our internal infra now can pass GITHASH and GITBRANCH same way as RELEASE_VERSION. This allows our CI to work with shallow git layers. Please treat it as an enhancement for periphery infra I have the same for TiDB: pingcap/tidb#67437 |
|
/retest |
|
@Tema: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: okJiang The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/retest-required |
|
/retest-required |
|
@rleungx tests are passed. PTAL |
| LDFLAGS += -X "github.com/pingcap/tidb-dashboard/pkg/utils/version.InternalVersion=$(shell scripts/describe-dashboard.sh internal-version)" | ||
| LDFLAGS += -X "github.com/pingcap/tidb-dashboard/pkg/utils/version.Standalone=No" | ||
| LDFLAGS += -X "github.com/pingcap/tidb-dashboard/pkg/utils/version.PDVersion=$(shell git describe --tags --dirty --always)" | ||
| LDFLAGS += -X "github.com/pingcap/tidb-dashboard/pkg/utils/version.PDVersion=$(RELEASE_VERSION)" |
There was a problem hiding this comment.
If RUN_CI is equal to 1, will the PDVersion turn into None?
What problem does this PR solve?
Issue Number: Close #10525
What is changed and how does it work?
Check List
Tests
Code changes
Side effects
Related changes
pingcap/docs/pingcap/docs-cn:pingcap/tiup:Release note
Summary by CodeRabbit