Implement Continuous Integration In Your Software Project-2 : Page 2

The Critical Role of the CI Server

When you start writing new code, you want your project to be stable. But how do you make sure the code in your repository works at all times? Simple, test it after every change. This is the main task of a CI server; every change in the repository triggers configured build jobs in the CI server. The CI server can be notified of a change or it can monitor a source code repository. How you configure the build jobs depends on your particular project. For any single project, we have several types of jobs and each serves a different purpose.

The following are the different CI server job types and their corresponding structure.

Quick-running jobs are triggered on each commit and they tell you within a few minutes after making the change whether the build is functioning correctly. Quick-running jobs update the working copy, compile the project and run unit tests.

Test jobs are triggered several times a day if any commits were made. You can chain them with "after commit jobs." They will run all tests or subsets of tests, and they can take several hours for when running integration tests or automated frontend testing.

Daily jobs are triggered daily afterhours. They build the project from a fresh checkout, fetching all dependencies and running all tests. It monitors the environment (mainly repositories) to make sure it's easy to start working on the project from scratch.

Quality monitoring jobs are triggered daily afterhours if any commits were made. They build the project and perform the additional tasks of static code analysis and tests coverage. Afterwards, they send the results to Sonar.

The CI server will notify you when something goes wrong. If the compilation fails, you will know it right away. It keeps a history of recent builds, so you can monitor the codebase -- how stable it is, how long it takes to compile or test, when a bug was first introduced, and so on. Rapid feedback is the key to a good CI process. Maintain your builds so you can respond fast.

Managing The Continuous Integration Process... and Beyond

CI jobs are configured by the development teams who are responsible for them. But when a project is finished and the team disbands, we still want to make sure we can continue with changes and fixes at any time. This is when our DevOps team takes over, utilizing their own tools. They constantly monitor CI server instances for any problems, availability of executors, and length of job queues. On the development side, we optimize our environment to minimize the average length of the job queue and we optimize builds to run fast.

The next step in the evolution of your continuous integration implementation is continuous Delivery. You can employ the same set of tools to automate acceptance tests, deployments and releases. But that's topic for another day.