Skip to content

rapids-cmake can generate pinned versions file#530

Merged
rapids-bot[bot] merged 36 commits intorapidsai:branch-24.04from
robertmaynard:fea/generate_pinned_manifest_file
Mar 5, 2024
Merged

rapids-cmake can generate pinned versions file#530
rapids-bot[bot] merged 36 commits intorapidsai:branch-24.04from
robertmaynard:fea/generate_pinned_manifest_file

Conversation

@robertmaynard
Copy link
Copy Markdown
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
@robertmaynard robertmaynard requested a review from bdice February 26, 2024 16:33
Copy link
Copy Markdown
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
Copy Markdown
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.

Copy link
Copy Markdown
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.

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
Copy Markdown
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.

@robertmaynard
Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 0bb862c into rapidsai:branch-24.04 Mar 5, 2024
@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.

4 participants