Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rapids-cmake can generate pinned versions file #530

Conversation

robertmaynard
Copy link
Contributor

Description

Add rapids_cpm_generate_pinned_versions to support reproducible builds

rapids-cmake can now generate a versions.json that contains the exact git SHA1 used by depdendencies which can be re-used
to construct reproducible builds.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.
  • The cmake-format.json is up to date with these changes.
  • I have added new files under rapids-cmake/
    • I have added include guards (include_guard(GLOBAL))
    • I have added the associated docs/ rst file and update the api.rst

@robertmaynard robertmaynard requested a review from a team as a code owner January 30, 2024 21:13
@robertmaynard robertmaynard changed the title Fea/generate pinned manifest file rapids-cmake can generate pinned versions file Jan 30, 2024
rapids-cmake can now generate a `versions.json` that contains
the exact git SHA1 used by depdendencies which can be re-used
to construct reproducible builds.
@robertmaynard robertmaynard force-pushed the fea/generate_pinned_manifest_file branch from ec84328 to cbba2a0 Compare January 31, 2024 20:54
@robertmaynard robertmaynard added feature request New feature or request non-breaking Introduces a non-breaking change labels Jan 31, 2024
@robertmaynard robertmaynard force-pushed the fea/generate_pinned_manifest_file branch from bfd2ffc to 0d0111e Compare January 31, 2024 21:41
rapids-cmake/cpm/detail/gpv_root_dir_hook.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/gpv_root_dir_hook.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/gpv_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/gpv_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/gpv_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/init.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/init.cmake Outdated Show resolved Hide resolved
testing/cpm/cpm_generate_pins-format-patches/override.json Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/generate_pinned_versions.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/generate_pinned_versions.cmake Outdated Show resolved Hide resolved
Co-authored-by: Bradley Dice <bdice@bradleydice.com>
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! Thanks so much for your hard work and many iterations. This has improved a lot from the initial draft. 🙇‍♂️

Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make rapids-cpm-init respect an environment variable/CMake option so that users can do something like cmake ... -DRAPIDS_CMAKE_GENERATE_PINNED_VERSIONS (name TBD)? Or do we expect that consumers of this feature will modify their calls to rapids_cpm_init?

I haven't reviewed tests yet, will do that in a second pass after we get through this first round of questions.

rapids-cmake/cpm/generate_pinned_versions.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/generate_pinned_versions.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/generate_pinned_versions.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My question on the overall review (not tied to any line) from the last review remains outstanding, but I don't think it's super important. The other remaining items are pretty small and we should be good to finish this up in one more round.

rapids-cmake/cpm/detail/pinning_write_file.cmake Outdated Show resolved Hide resolved
testing/utils/fill_cache/CMakeLists.txt Show resolved Hide resolved
testing/other/CMakeLists.txt Show resolved Hide resolved
testing/cpm/cpm_generate_pins-nested/verify/CMakeLists.txt Outdated Show resolved Hide resolved
Comment on lines 45 to 49
# Everything should have shallow marked as false
# so that clones by SHA1 work
if(${proj}_shallow)
message(FATAL_ERROR "${proj}_shallow} is expected to be false, but got ${${proj}_shallow}")
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for this PR, but given the amount of duplication required to write CMake tests it might be good for us to centralize helpers that get used in multiple tests.

testing/cpm/cpm_generate_pins-nested/verify/CMakeLists.txt Outdated Show resolved Hide resolved
@robertmaynard
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 0bb862c into rapidsai:branch-24.04 Mar 5, 2024
15 checks passed
@robertmaynard robertmaynard deleted the fea/generate_pinned_manifest_file branch March 5, 2024 13:54
rapids-bot bot pushed a commit that referenced this pull request May 1, 2024
Modifies pinning tests from #530:
* to only test projects that were downloaded by CPM (e.g. ignoring the `fmt` that might already exist in the build environment)
* to echo out `pinned_versions.json` and `versions.json` in logs from failed tests, to make debugging faster

## Notes for Reviewers

#592 proposes some testing changes that aren't specific to the goals of that PR.

Since that PR might be stuck for a bit (rapidsai/build-planning#56 (comment)), this proposes pulling those out into a separate PR:

* so that other changes in this project benefit from them
* to shrink the diff of #592 and therefore the risk of merge conflicts

### How I tested this

Pushed a commit with the new test error message content changes but keeping `fmt` in the failing tests, to confirm that the expected tests failed.

<details><summary>got the expected outputs (click me)</summary>

```text
The following tests FAILED:
	698 - cpm_generate_pins-nested-makefile (Failed)
	700 - cpm_generate_pins-nested-ninja (Failed)
	702 - cpm_generate_pins-nested-ninja_multi-config (Failed)
	722 - cpm_generate_pins-simple-makefile (Failed)
	724 - cpm_generate_pins-simple-ninja (Failed)
	726 - cpm_generate_pins-simple-ninja_multi-config (Failed)
```

And they failed in the expected way more informative logs!

```text
CMake Error at CMakeLists.txt:51 (message):
  pinned fmt tag (10.2.1) should differ compared to baseline 10.2.1

  pinned_versions.json:

  {

    "always_download" : true,
    "git_shallow" : false,
    "git_tag" : "${version}",
    "git_url" : "https://github.com/fmtlib/fmt.git",
    "version" : "10.2.1"

  }

  versions.json:

  {

    "git_tag" : "${version}",
    "git_url" : "https://github.com/fmtlib/fmt.git",
    "version" : "10.2.1"

  }
```

([build link](https://github.com/rapidsai/rapids-cmake/actions/runs/8837613213/job/24267079292?pr=592))

</details>

#

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)

URL: #599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants