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

[CI] Use platform CMake #2627

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Conversation

marcalff
Copy link
Member

@marcalff marcalff commented Apr 3, 2024

Use platform CMake

Changes

In CI, the build scripts used to:

  • download cmake installation scripts from the internet
  • make the scripts executable
  • execute the downloaded script

to install CMake version 3.16.3 by default, or CMake version 3.20.6

All the platforms used in CI have already have CMake, for a more recent version.

Testing on old versions instead of testing with the version that comes with the platform provides little value, since users are more likely to run into issues that were not detected in CI.

Also, downloading a script and executing it is a bad practice.

This fix uses the CMake version already installed on the github runner image.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Use platform CMake
@marcalff marcalff marked this pull request as ready for review April 3, 2024 21:31
@marcalff marcalff requested a review from a team April 3, 2024 21:31
@ThomsonTan
Copy link
Contributor

The scripts like "tools/setup-cmake.sh" can also be used in non CI environment, such as setting up the CMake to a given machine in dev environment?

@marcalff
Copy link
Member Author

marcalff commented Apr 4, 2024

The scripts like "tools/setup-cmake.sh" can also be used in non CI environment, such as setting up the CMake to a given machine in dev environment?

I don't know any dev who would go out of his way to install something like this, instead of using the natural packaging commands available with the OS distribution, for example:

sudo apt install cmake

This tools/setup-cmake.sh script installs under /usr/local with a make install, which imply that to run, the whole script must be executed as root, including the make part.

It builds from code downloaded in /tmp, which may have been poisoned before the script with an extra payload.

It installs CMake 3.18.4 by default, which is ancient.

It is not documented, one has to read the code to know how to invoke it.

It is not referenced anywhere in the opentelemetry-cpp documentation, one has to find it to know it exists.

This is a long list of red flags in my opinion.

Restoring the file for now because it appear to be used from tools/setup-buildtools.sh and tools/build-docker.cmd which I missed, but I still think this should be removed at some point.

To clarify:

I don't doubt tools/setup-cmake.sh was useful and used at some point in the past, when cmake (of the proper version) was not ubiquitous, but the landscape has chanced since, making this script no longer relevant.

rm cmake-${CMAKE_VERSION}-Linux-x86_64.sh
popd
}

Copy link
Member

Choose a reason for hiding this comment

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

setup_cmake.sh script installing only the googletest - this seems confusing.
For the sake of consistency with naming, should we also add apt-get install cmake in this script ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Each github runner already has cmake, so there is no need to install it.

I would rather rename setup_cmake.sh to setup_gtest.sh then, for clarity.

Copy link
Member

Choose a reason for hiding this comment

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

Not for the runner. If someone is directly using this script.

Copy link
Member Author

Choose a reason for hiding this comment

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

This script is under ci/.

There is already another script, under tools/setup-cmake.sh, to also install cmake.

If the concern is that someone taking a dependency in ci/* will be affected, I can add a note in the changelog.

Copy link
Member

Choose a reason for hiding this comment

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

I would rather rename setup_cmake.sh to setup_gtest.sh then, for clarity.

Or else, this would be better option. And then add this as a potential breaking change in CHANGELOG.md.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added changelog, and renamed to setup_googletest.sh

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM with suggestion.

@marcalff marcalff merged commit 848db57 into open-telemetry:main Apr 4, 2024
48 checks passed
@marcalff marcalff deleted the fix_platform_cmake branch June 3, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants