Conversation
Running git is not always possible, either because there's no git checkout, there's no git available, or we're in a git subtree without access to reference git files. Allow passing GIT_COMMIT to cmake to bypass the git invocation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51e5c95792
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if(GIT_COMMIT) | ||
| set(DDWAF_VERSION ${CMAKE_PROJECT_VERSION}) | ||
| execute_process(COMMAND git rev-parse --short HEAD | ||
| string(SUBSTRING "${GIT_COMMIT}" 0 7 SHORT_BUILD_ID) | ||
| else() |
There was a problem hiding this comment.
Preserve tag-based package naming when GIT_COMMIT set
When GIT_COMMIT is provided, the code skips the tag check and always derives DDWAF_VERSION from CMAKE_PROJECT_VERSION while also unconditionally setting SHORT_BUILD_ID, which means CPACK_PACKAGE_FILE_NAME will always get a -<short> suffix even for tagged releases. In environments without a git checkout (the stated use case), this changes the filename format compared to the tagged build path (which previously produced no suffix), so release pipelines or consumers expecting tag-named artifacts can break when they pass GIT_COMMIT (e.g., building from a release tarball). Consider mirroring the tag behavior when GIT_COMMIT is set or making the suffix conditional.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #488 +/- ##
=======================================
Coverage 84.92% 84.92%
=======================================
Files 190 190
Lines 9203 9203
Branches 4143 4143
=======================================
Hits 7816 7816
Misses 509 509
Partials 878 878
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:
|
Dynamic Artifact Size Comparison 📦
Static Artifact Size Comparison 📦
|
Benchmarks clang-pgoBenchmark execution time: 2026-01-27 14:29:38 Comparing candidate commit e7a28f1 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics. |
Running git is not always possible, either because there's no git checkout, there's no git available, or we're in a git subtree without access to reference git files.
Allow passing GIT_COMMIT to cmake to bypass the git invocation.