Advice on how to do CI for C++/CMake project

77 views
Skip to first unread message

d.bed...@gmail.com

unread,
Feb 3, 2018, 11:09:09 PM2/3/18
to Jenkins Users
I would be grateful for advice on how to set up CI for a project with the following requirements:

    C++ codebase with CMake as the build system
    Let's say 10 separate software components each with their own CMakeLists.txt and in their own git repo.
    The components depend on each other
    There's a top-level CMakeLists.txt via which any of the software components can be built (CMake will resolve the dependencies)


So the folder structure is like this:


src/

-- top_level_build_scripts/

---- .git

---- CMakeLists.txt

---- Jenkinsfile


-- mylib1/

---- .git

---- CMakeLists.txt

---- Jenkinsfile


-- mylib2/

---- .git

---- CMakeLists.txt

---- Jenkinsfile


etc.

I would like to do this with modern Jenkins practices, so Pipeline and with Jenkinsfile. What's important is that in Jenkins there should be listed 11 jobs: the 10 components each with their "Last Successful", "Last Failed", Weather, etc. And the first job "Build Whole Project" which should  build each component first to last.

I've gotten as far as in the top_level_build_scripts/Jenkinsfile I add `build job: 'mylib1', wait: false`, which does manage to start the next job, but sadly the "mylib1" job creates  a new workspace in a separate directory, so the folder structure for the top_level_build_scripts/CMakeLists.txt is invalid. For it to work the folder structure must be as I drew above. Am I on the right track? Or totally wrong approach?

James Telfer

unread,
Feb 7, 2018, 12:31:23 PM2/7/18
to Jenkins Users
Your requirements to have each library build in a separate job and it all sit in the same workspace are rather at odds with each other, even without using Pipeline.  What you describe sounds more like a multijob project, which would then pull artefacts out of each of the library jobs for the overall build.

You could maybe have a separate job for each component (to build & run tests for just that component), and a single job which builds each component in a separate stage?

Your project structure really pushes towards having a single job to build the lot, it that's not ideal maybe consider if the project structure makes sense?
Reply all
Reply to author
Forward
0 new messages