ci: Add dedicated CodeQL workflow for improved analysis - #634
thompson-tomo wants to merge 52 commits into
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
dbarker
left a comment
There was a problem hiding this comment.
Thanks for contributing to CI. It is needed! Just a request to use native CMake install for otel-cpp and apt packages for the dependencies so conan support is not implied and it is easier maintain.
dbarker
left a comment
There was a problem hiding this comment.
Please see below on steps to harden the workflow..
Updated CodeQL workflow to use newer versions of dependencies and added a step to harden the runner.
dbarker
left a comment
There was a problem hiding this comment.
Thanks for taking this on. Following the discussion above please remove the conanfiles and install the dependencies for the CodeQL test with either apt packages or using CMake's ExternalProject module.
|
Thanks for adding the shared CodeQL workflow. Two concerns:
Can we make the supported components explicit and ensure every triggered component is actually analyzed? |
Conan was used to only import dependencies hence we didn't add support for conan and they were still built using cmake.
The biggest difficulty we face is codeql requires everything to be built in the 1 workflow hence why we need a reproducible build process. The problem got even worse when you consider different components needed different versions of the same dependency as otherwise they failed. Hence the conan was added to the components which could be built with the goal being add more once they are buildable. Note prior to this pr there was no codeql at all as the current codeql doesn't work, hence partial coverage is better than none. |
I agree that partial coverage is better than none. My concern is only that the workflow should clearly represent that partial coverage. Right now, it triggers for every change under CodeQL also does not require every component to use the same build environment. Components with different dependency requirements can use separate jobs or a matrix. Could we limit the path triggers to the components currently supported, or define those components explicitly in a matrix? We can expand that list as more components become buildable. |
I don't believe that is the case given that the build must be done between the init & analyze steps and the analyze replaces any previous analyze hence needs to be a single check. I need to think of a maintainable & reproducible solution on how to perform codeql analysis especially if we can't use conan. |
de81ea0 to
bad48a6
Compare
|
@dbarker i have significantly rewritten the workflow to now be native cmake. Even after optimising it, the workflow is taking 30mins due to needing to build otel cpp it is however better than the 2 hrs it was at 1 stage. Please let me know if you are happy with it in this form. |
|
@thompson-tomo - Could we use the Ubuntu's gRPC and Protobuf packages here - from CI logs, seems building them is taking most of the time ? |
|
I agree that is taking most of the time. I am already installing libprotobuf-dev & protobuf-compiler ubuntu packages. I will now add libgrpc-dev and see if that makes a difference. |
|
@lalitb adding grpc has broken the build https://github.com/open-telemetry/opentelemetry-cpp-contrib/actions/runs/36407828626/job/108880680698#step:6:1 |
Error seems to be missing gRPC C++ library. Could you replace |
This adds a dedicated codeql workflow which can analyse any package. In the process it resolves the issue with the current ci failures where in which codeql is tied to a non c++ project.
Only httpd is analyzed as it is the only project which can be natively built without checking out otel-cpp in build. Additional projects are added by simply adding a code-ql config file.
The structure of using artifacts is necessary to optimise performance, without it & purely relying on fetch resulted in a 2hr build for httpd as opposed to 30mins.