-
Notifications
You must be signed in to change notification settings - Fork 92
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
adding clang-tidy as a linter tool #2269
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Suyash Dongre <[email protected]>
Can one of the admins verify this patch? |
ceph-pr-clang-tidy/build/build
Outdated
@@ -0,0 +1 @@ | |||
sudo apt-get install -y clang-tidy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course this only works if the build machine is an apt-based system, which it may not be using your current node labels. It might be more appropriate to install the package inside the pbuilder image in that case, too, although it probably doesn't matter too much; there are ways of adding extra packages to the pbuilder image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need an answer for this; does clang-tidy exist for RHEL-like systems? or do we want to restrict this job to only apt systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is available but for now lets keep the job to apt systems only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this accomplished? won't the command be executed (and fail) on all systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The job specifies the labels for the jenkins builder it wants; we'll need to add something like 'jammy' as a label, that should suffice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where should I add this 'jammy' label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
job.node is the list of labels the builder must satisfy. You probably want jammy && small
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
job.node is the list of labels the builder must satisfy. You probably want jammy && small
@dmick I have added node: jammy && small
|
||
parameters: | ||
- string: | ||
name: ghprbPullId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this is probably provided by the ghprb plugin, and doesn't need to/shouldn't be a settable parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the response to this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed ghprbPullId
as a settable parameter. However in others Jenkins jobs it is set as a settable parameter.
Reference:
1.
ceph-build/ceph-pull-requests-arm64/config/definitions/ceph-pull-requests-arm64.yml
Lines 13 to 16 in e8d18c7
parameters: | |
- string: | |
name: ghprbPullId | |
description: "the GitHub pull id, like '72' in 'ceph/pull/72'" |
ceph-build/ceph-perf-pull-requests/config/definitions/ceph-perf-pull-requests.yml
Lines 137 to 140 in e8d18c7
parameters: | |
- string: | |
name: ghprbPullId | |
description: "the GitHub pull id, like '72' in 'ceph/pull/72'" |
parameters: | |
- string: | |
name: ghprbPullId | |
description: "the GitHub pull id, like '72' in 'ceph/pull/72'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmick and what about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can leave it in for now; I don't think it's necessary but it might be useful for testing
Signed-off-by: Suyash Dongre <[email protected]>
Signed-off-by: Suyash Dongre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's resolve the outstanding comments
Signed-off-by: Suyash Dongre <[email protected]>
Signed-off-by: Suyash Dongre <[email protected]>
Let's change the name of LICENSE to LICENSE.clang-tidy-to-junit.py to clarify what the license applies to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address the couple more comments and then we'll set up a test job
Signed-off-by: Suyash Dongre <[email protected]>
Signed-off-by: Suyash Dongre <[email protected]>
Hi @dmick! I think we are ready for a test job. However there is one problem. Clang-tidy requires This PR will also be need to be merged. After this we are good to go. |
Hey @dmick can you please check this? Thank you |
Hi @dmick ! What we can do is allow I think this is the best approach. Please let me know what you think. |
That sounds like a good way to address the concerns. IIRC this involves a change to the make check job to add permissions to allow clang-tidy to use the artifacts. |
Yes you are right. You will also need to install the plugin 'Copy Artifact' Please do so |
Copy artifact is installed. It's used in the ceph-build jobs (search for "copyartifact") |
@dmick |
Yes, the make check job will both archive the files and trigger the clang-tidy job |
Instead of building Ceph, existing `build` would be copied from the job `ceph-pull-requests` (make-check) to save resources on building Ceph. Signed-off-by: Suyash Dongre <[email protected]>
ceph-pr-clang-tidy/build/build
Outdated
set -ex | ||
|
||
# Clone the Ceph repository | ||
git clone https://github.com/ceph/ceph.git "$WORKSPACE/ceph" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you do a shallow clone of only the relevant branch?
this would save considerable amount of time
ceph-pr-clang-tidy/build/build
Outdated
|
||
# Install dependencies | ||
sudo apt-get install -y curl | ||
./install-deps.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we don't plan on building, why do we need "install-deps.sh" this also takes considerable amount of time
Signed-off-by: Suyash Dongre <[email protected]>
@yuvalif done can you please take a look now, Thank you |
cd build | ||
|
||
# Replace the boost and include directories from the tar file | ||
tar -xzf "$WORKSPACE/ceph_build.tar.gz" -C "$WORKSPACE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the tar file being generated?
do we control the content of the file and make sure we only add boost
and include
dirs are there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tar file is generated in the Jenkins job make check
. Once the job finishes its execution it will zip the boost
and include
directories.
Yes we control the content of tar file, it is being controlled in the pull request: #2276
do you have new time measurements after all of the latest improvements? |
The Ceph project has a huge codebase, and it faces the risk of containing suboptimal code that could jeopardize storage reliability or induce performance bottlenecks or cause resource inefficiencies. Identifying and rectifying such code issues is important to maintain the integrity and efficiency of the Ceph storage system. clang-tidy, a powerful static analysis tool, offers a systematic approach to uncover critical issues within the codebase and generate comprehensive reports highlighting potential vulnerabilities.
Integrating clang-tidy into the Jenkins CI pipeline of Ceph would be very beneficial for the development, as any new possible vulnerabilities would be identified early on. The goal is to enhance code quality, maintain performance, and ensure the reliability of the storage system by continuously monitoring and addressing potential issues through automated static analysis.