Book Image

Jenkins Continuous Integration Cookbook

By : Alan Mark Berg
Book Image

Jenkins Continuous Integration Cookbook

By: Alan Mark Berg

Overview of this book

<p>Jenkins is a highly popular continuous integration server. Its correct use supports a quality software development process. Jenkins is great at finding issues in software early and communicating it to a wide audience. Jenkins is also easily extendable with a simple framework for writing plugins. Currently there are over 400 plugins available for inclusion.<br /><br /><em>Jenkins Continuous Integration Cookbook</em> has over 80 recipes describing practical ways to use Jenkins and expanding its feature set by selective use of the best of breed plugins. Jenkins has a simple framework for writing plugins. There are over 400 plugins available. Therefore, it is easy to get lost in possibilities. Using practical recipes, this book will guide you through the complexities. The recipes are bundled into themes including security, maintainability, communication, building software, the valid use of code metrics, testing remotely, and writing your first plugin.<br /><br /><em>Jenkins Continuous Integration Cookbook</em> includes problem solving and how to do recipes for many common and less common tasks. A wide range of topics are covered from integrating, securing, and maintaining Jenkins in your organization to writing your first extension.<br /><br />The book begins with common maintenance tasks followed by securing Jenkins and enabling SSO. Then it explores the relationship between Jenkins builds and the Maven pom.xml. You will then learn ways to effectively communicate with various target audiences (developers, project managers, the public). You will then explore source code metrics with related recipes, and set up and run remote stress and functional tests. The book finally lists a series of 11 interesting plugins with a concluding recipe on how to create your first plugin.<br /><br /><em>Jenkins Continuous Integration Cookbook</em> describes solutions and optimizations to problems commonly found.</p>
Table of Contents (15 chapters)
Jenkins Continuous Integration Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Learning from history


Teams tend to have their own coding habits. If a project fails because of the quality of the code, try and work out which code metrics would have stopped the code from reaching production or which mistakes are seen repeatedly; a few examples include the following:

  • Friday afternoon code failure: We are all human and have secondary agendas. By the end of the week, a programmer may have their minds focused elsewhere than the code. A small subset of programmers have their code quality affected, consistently injecting more defects towards the tail end of their roster. Consider scheduling a weekly Jenkins Job that has harsher thresholds for quality metrics pushing back near the time of least attention.

  • Code churn: A warning for experienced quality assurers is the sudden surge in code commits just before a product is moved from an acceptance environment to production. This indicates that there is a last-minute rush. For some teams with a strong sense of code quality, this is also a sign of extra vigilance. For other less-disciplined teams, this could be a naive push towards destruction. If a project fails and QA is overwhelmed due to a surge of code changes, then look at setting up a warning Jenkins Job based on the commit velocity. If necessary, you can display your own custom metrics.

    See the Plotting alternative code metrics in Jenkins recipe in Chapter 3, Building Software.

  • A rogue coder: Not all code bashers create code of the same uniform and high quality. It is possible that there is consistent underachievement within a project. Rogue coders are caught by human code review. However, for a secondary defense, consider setting thresholds on static code review reports from FindBugs and PMD. If a particular developer is not following the accepted practice, then builds will fail with great regularity.

    See the Finding bugs with Findbugs recipe in Chapter 5, Using Metrics to Improve Quality.

  • The GUI does not make sense: Isn't it painful when you build a web application only to be told at the last moment that the GUI does not quite interact in the way the product owner expected? One solution is to write a mockup in Fitnesse, and surround it with automatic-functional tests using fixtures. When the GUI diverges from the planned workflow, Jenkins will start shouting.

    See the Activating the Fitnesse HTMLUnit Fixtures recipe in Chapter 6, Testing Remotely.

  • Tracking responsibility: Mistakes are made and lessons need to be learned. However, if there is no clear chain of documented responsibility, then it is difficult to pin down who needs the learning opportunity. One approach is to structure the workflow in Jenkins through a series of connected jobs, and use the promoted builds plugin to make sure the right group verifies at the right point. This methodology is also good for reminding the team of the short-term tasks.

    See the Testing and then promoting recipe in Chapter 7, Exploring Plugins.