Mastering OpenStack(Second Edition)
上QQ阅读APP看书,第一时间看更新

Continuous integration and delivery

Let's see how continuous integration (CI) and life cycle of our automation code will be managed by the following categories of tools:

  • System Management Tool Artifact (SMTA): This can be any IT automation tool such as Chef cookbook, Puppet manifest, Ansible playbook, or juju charms.
  • Version Control System (VCS): This tracks changes to our infrastructure deployment code. Any version control system, such as CVS, Subversion, or Bazaar, that you are most familiar with can be used for this purpose. Git can be a good outfit for our VCS.
  • Jenkins: This is a perfect tool that monitors to changes in version control system and  does the continuous integration testing and reporting of results.
  • Gerrit: This is a Git review system designed to review code changes at every Git push. It creates patch sets for each change and allows the review of code lines based on rating score.

Take a look at the model in the following figure:

The life cycle for infrastructure as code consists of infrastructure configuration files (for example, Ansible playbooks and Vagrant files) that are recorded in a VCS and are built continuously by the means of a continuous integration (CI) server (Jenkins, in our case).

Infrastructure configuration files can be used to set up a unit test environment (a virtual environment using Vagrant, for example) and makes use of any system management tool to provision the infrastructure (Ansible, Chef, Puppet, and so on).

Within every added patch, Gerrit triggers an event in the CI server to perform test and build before publishing results for reviewing.

The CI server keeps listening to changes in version control and automatically propagates any new versions to be tested, and then it listens to target environments in production.

Vagrant allows you to build a virtual environment very easily; it is available at https://www.virtualbox.org/ and can run virtual machines, so you will need these before moving on with the installation in your test environment.

The proposed life cycle for infrastructure code highlights the importance of a test environment before moving on to production. You should give a lot of importance to the testing stage, although this might be a very time-consuming task.

Especially in our case, with infrastructure code for deploying OpenStack that are complicated and have multiple dependencies on other systems the importance of testing cannot be overemphasized. This makes it imperative to ensure effort is made for an automated and consistent testing of the infrastructure code.an automated and consistent testing of the infrastructure code.

The best way to do this is to keep testing thoroughly in a repeated way till you gain confidence in your code.