Commit c8a4b19
fix(ci): Address semver job issue (#1704)
# What does this PR do?
Adds a `git clone` fallback to `libdd-libunwind-sys/build.rs` for obtaining the libunwind source when the crate is built outside of a git repository.
The source acquisition logic is now structured as three steps:
1. If `libunwind/src` already exists (submodule checked out, or files copied in), do nothing.
2. If inside a git repo (`.git` exists), try `git submodule update --init --recursive`.
3. Otherwise, fall back to `git clone --depth 1` of the libunwind repository directly.
# Motivation
The `semver-check` CI job runs `cargo-semver-checks --baseline-rev origin/main`, which extracts the baseline source into a plain directory under `target/semver-checks/git-origin_main/<commit>/`. This directory has no `.git` — it's a raw file extraction, not a git clone or worktree.
When building the baseline version of `libdd-crashtracker`, cargo needs to compile its dependency `libdd-libunwind-sys`, which triggers `build.rs`. The previous implementation unconditionally ran `git submodule update --init` assuming it was inside a git repo, which failed with:
```
error: pathspec 'libdd-libunwind-sys/libunwind' did not match any file(s) known to git
```
This is not reproducible locally because a normal `git clone` properly initializes the submodule, and `build.rs` skips the git commands entirely when `libunwind/src` is already present.
# Additional Notes
- This fix must land on `main` before other branches that modify `libdd-crashtracker` can pass the `semver-check` CI job. This is because `cargo-semver-checks` uses the **baseline** (main) version of `build.rs` when building the baseline, not the branch's version.
- The libunwind repo URL and branch are extracted into constants (`LIBUNWIND_REPO`, `LIBUNWIND_BRANCH`) to keep them in sync with `.gitmodules`.
- The `git clone` fallback also covers other non-git contexts such as `cargo vendor` or any tool that extracts crate source without preserving git metadata.
# How to test the change?
```
git clone --no-checkout https://github.com/DataDog/libdatadog.git test-full
cd test-full
git checkout --detach origin/gyuheon0h/28.1.1
git submodule update --init --recursive -- libdd-libunwind-sys/libunwind
rm -rf target/semver-checks/
./scripts/semver-level.sh -v libdd-crashtracker main
```
Co-authored-by: gyuheon.oh <gyuheon.oh@datadoghq.com>1 parent b04809b commit c8a4b19
1 file changed
Lines changed: 80 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
13 | 89 | | |
14 | 90 | | |
15 | 91 | | |
16 | 92 | | |
17 | | - | |
18 | | - | |
| 93 | + | |
| 94 | + | |
19 | 95 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 96 | + | |
43 | 97 | | |
44 | 98 | | |
45 | 99 | | |
| |||
0 commit comments