34,79 €
Hands-On Continuous Integration and Delivery starts with the fundamentals of continuous integration (CI) and continuous delivery (CD) and where it fits in the DevOps ecosystem. You will explore the importance of stakeholder collaboration as part of CI/CD.
As you make your way through the chapters, you will get to grips with Jenkins UI, and learn to install Jenkins on different platforms, add plugins, and write freestyle scripts. Next, you will gain hands-on experience of developing plugins with Jenkins UI, building the Jenkins 2.0 pipeline, and performing Docker integration. In the concluding chapters, you will install Travis CI and Circle CI and carry out scripting, logging, and debugging, helping you to acquire a broad knowledge of CI/CD with Travis CI and CircleCI.
By the end of this book, you will have a detailed understanding of best practices for CI/CD systems and be able to implement them with confidence.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 342
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Gebin GeorgeAcquisition Editor:Rohit RajkumarContent Development Editor:Ronn Kurien, Devika BattikeTechnical Editor:Aditya KhadyeCopy Editor:Safis EditingProject Coordinator:Jagdish PrabhuProofreader: Safis EditingIndexer:Priyanka DhadkeGraphics:Tom ScariaProduction Coordinator: Aparna Bhagat
First published: August 2018
Production reference: 1270818
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78913-048-5
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Jean-Marcel Belmont is a software engineer with a passion for automation and continuous integration. He is heavily involved in the open source community and frequently writes workshops on many different software development topics. He maintains a couple of meetup groups where he advocates clean code patterns and software craftsmanship.
Hai Dam works as a DevOps Engineer in Netcompany, Denmark. His DevOps toolchain are Jenkins, CircleCI, ELK, AWS, and Docker.
Craig R Webster has delivered projects for clients of all sizes, ranging from small startups such as Orkell, Picklive and Tee Genius, through Notonthehighstreet, the UK Government, and the BBC. With more than 15 years of experience developing and deploying web applications, delivery pipelines, automation, and hosting platforms, Craig is able to take point on any technical project and ensure it is delivered on time, and on budget.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Hands-On Continuous Integration and Delivery
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
CI/CD with Automated Testing
Business scenario
Manual processes – a hypothetical scenario
Employee frustration
Introducing automation
Developer productivity
Breaking down communication barriers
Creating an environment of collaboration
Summary
Questions
Further reading
Basics of Continuous Integration
Technical requirements
What is CI?
What is a software build anyway?
CI process steps in a nutshell
The value of CI
Mitigating risks by utilizing CI
But it works on my machine!
Database synchronization
A missing deployment automation phase
Late discovery of defects
Test coverage not known
Code coverage tools
Lack of project visibility
Software builds at source code check-in
What is a software build again?
Scripting tool
Performing single command builds
Building your software in a nutshell
Separating build scripts from your IDE
Software assets should be centralized
Creating a consistent directory structure
Software builds should fail fast
Building for any environment
Small build and large build breakdown
CI build practices
Private build
Usage of CI server
Manual integration builds
Running fast builds
Summary
Questions
Further reading
Basics of Continuous Delivery
Technical requirements
Problems delivering software
What do we mean by delivering software?
Common release anti-patterns
Deploying software manually
Deployment automation to the rescue
Manual configuration management
Configuration management automation
How a production environment differs from other environments
The production environment should be the same as the staging environment
How to conduct a software release
Frequent releases
Automated releases
The benefits of automation in delivering software
Team empowerment
Error reduction
Stress reduction
Configuration management
What does configuration management mean anyway?
Version control
Example properties file
Version control management tools
Version control practices
Conducting software check-ins often
Writing descriptive and meaningful commit messages
Dependency management
Example Node.js dependency file and Gopkg.toml dependency file
Managing software components
Software configuration management
Configurability and flexibility concepts
Specific types of configuration
Configuration management across applications
Environment management
Manual environment setup
Important configuration information for environments
Containerized environments
Deployment pipeline
What is a deployment pipeline?
Deployment pipeline practices
Building binaries once
Deployment should be done the same way in every environment
Commit stage – first step of the deployment pipeline
Test gates
Acceptance tests build stage
Manual testing
Nonfunctional testing
Release preparation
Automating release processes
Conducting rollbacks
Deployment scripting
Overview of build tools
Deployment scripting concepts
Writing a script for each stage in the deployment pipeline
Every environment should use the same scripts
The deployment process should not change on each run
Deployment scripting best practices
Testing only known good foundations
Testing the environment configuration
Using relative paths
Removing manual processes
Deployment ecosystem
Infrastructure tooling
Cloud providers and tooling
Summary
Questions
Further reading
The Business Value of CI/CD
Technical requirements
Problems with communication
Miscommunication of requirements
Lack of proper documentation
Timezone differences
Lack of trust and mutual respect
Cultural differences and language barriers
Long feedback loop cycles
Communicating pain points to team members
Waiting for requirements information
Undocumented steps in a deployment pipeline
Keys to the kingdom to select few
Too many communication channels
Pain-Driven Development (PDD)
Sharing responsibilities among different teams
Rotating team members
Asking for feedback on development practices
Creating cross-functional teams
Knowing your stakeholders
Project managers
Executive leadership team
End users
Demonstrating why CI/CD is important
Metrics and reporting
Educating leadership on automation
Getting approval for CI/CD from your stakeholders
Starting a skunkworks project
Starting CI/CD on your local machine
Company presentation
Lunch and learn
Summary
Questions
Further reading
Installation and Basics of Jenkins
Technical requirements
Windows installation
Prerequisites to installing Jenkins
Finding your version of Windows
Installing Java
Windows installer
Installing Jenkins in Windows
Running the Jenkins Installer in Windows
Installing Jenkins with the Chocolatey Package Manager
Starting and stopping Jenkins in Windows in Command Prompt
Linux installation
Installing Jenkins on Ubuntu
Starting the Jenkins service in Ubuntu
Opening network traffic firewalls
Unlocking Jenkins for the first login
macOS installation
Jenkins downloads package
Unlocking Jenkins for the first login
Installing Jenkins via Homebrew
Running Jenkins locally
Creating a new item
Console Output
Managing Jenkins
Configuring environment variables and tools
Configuring a job to poll the GitHub version control repository
Summary
Questions
Further reading
Writing Freestyle Scripts
Technical requirements
Creating a simple freestyle script
Jenkins dashboard navigation
Jenkins login screen
Jenkins dashboard
Adding a new build job item
Build configuration options
Configuring a freestyle job
General
Source Code Management
Build Triggers
Build environment
Build
Post-build actions
Adding environment variables
Global environment variable configuration
EnvInject Plugin
Debugging issues with a freestyle job
Build Project View
Debugging issues with freestyle script
Summary
Questions
Further reading
Developing Plugins
Technical requirements
Jenkins plugins explained
Why are plugins useful?
Jenkins plugin documentation
Installing plugins in Jenkins
Building a simple Jenkins plugin
Java installation
Maven installation instructions
Windows installation
Maven installation through the Chocolatey package manager
Maven installation through the Maven source code
Environment variables setup for the Windows operating system
macOS installation
Maven installation through the Homebrew package manager
Unix installation
Maven installation through the apt-get package manager
Jenkins plugin development
Maven settings file
HelloWorld Jenkins plugin
Folder layout explanation
Jenkins plugin source code explanation
Building a Jenkins plugin
Installing a Jenkins plugin
Jenkins plugin ecosystem
List of available plugins
Summary
Questions
Further reading
Building Pipelines with Jenkins
Technical requirements
Jenkins 2.0
Why move to Jenkins 2.0?
Installing the Blue Ocean plugin on an existing instance
Installing the Blue Ocean plugin through a Jenkins Docker Image
Docker prerequisites
Installing Docker images
Accessing Blue Ocean Jenkins view
The Jenkins pipeline
Creating a Jenkins pipeline
Providing a personal access token for GitHub
Picking your GitHub organization
Picking the GitHub repository
Creating a pipeline with the pipeline editor
Navigating in Jenkins Blue Ocean
Pipelines view
Pipeline detail view
Pipeline build view
Pipeline stage view
Other views in Jenkins pipelines
Pipeline Syntax
Pipeline Editor
Jenkinsfile
Pipeline keyword
Agent keyword
Stages keyword
Pipeline Syntax documentation
Summary
Questions
Further reading
Installation and Basics of Travis CI
Technical requirements
Travis CI introduction
Comparing Travis CI and Jenkins
Travis CI prerequisites
Creating a GitHub account
Creating a Travis CI account
Adding an SSH Key to your new GitHub Account
Adding a simple Travis CI YAML configuration script
Travis CI YML script contents
Adding a Github repository into your Travis CI account
Travis CI job log
Travis CI script breakdown
Select a programming language
Selecting infrastructure
Virtual image with Ubuntu Precise (12.04) infrastructure
Default infrastructure
Virtual Image with Ubuntu Trusty (14.04) infrastructure
Container based infrastructure
macOS infrastructure
Build customization
The build life cycle
before_install step
install step
before_script step
script step
after_script step
List of build life cycle
Build failure behavior
Installing a secondary programming language for a CI build
Example Travis CI YML script with multiple languages
Docker in Travis CI
Example Travis CI YML script with a Dockerfile
GUI and headless browsers in Travis CI
Example Travis yml script with headless Chrome, Puppeteer, and the Jest Testing Library
Summary
Questions
Further reading
Travis CI CLI Commands and Automation
Technical requirements
Travis CLI installation
Windows installation
Linux installation
macOS installation
Travis CLI commands
Non-API commands
Printing help information
Printing version information
API commands
Logging in to Travis CI
Displaying the current access token
Logging out of Travis CI
Displaying accounts information
Displaying help information for Travis commands
Interactive console session
Printing API endpoint Information
Conducting live monitoring with all the CI builds that are currently running
Initiating a Travis CI API call
API V3 REST call with curl
Printing out important system configuration information
Listing all the repositories that the currently logged in user has access to
Initiating synchronization with Travis CI for any new or outdated repositories in GitHub
lint - a Travis YML script
Obtaining current build information for the organization or user
Finding the currently logged-in user information
Repository commands
Displaying the most recent build information for each branch in Git version control
Listing cache information for all the repositories
Deleting cache information for a given repository
Enabling a repository in Travis CI
Disabling a repository in Travis CI
Cancelling the latest build in Travis CI
Encrypting environment variables or deployment keys
Adding environment variables in Travis CI
Encrypting a file
Listing environment information
Setting an environment variable
Deleting an environment variable
Clearing out all environment variables
List history information for recent builds
Initializing Travis CLI on a project
Printing out CI build log information
Opening the Travis web interface for the project
Printing out public key information for the repository
Restarting the latest CI build in Travis CI
Printing out current build requests in Travis CI
Printing out particular repository settings
Configuring Travis CI add-ons
Displaying general information for the current CI build
Listing SSH key in Travis CI
Displaying status information for the current build
Travis CI options for Pro version and Enterprise version
Option to display the information for Pro version
Option to display information for Enterprise version
Summary
Questions
Further reading
Travis CI UI Logging and Debugging
Technical requirements
Travis web client overview
Main dashboard overview
Job log overview
Debugging build locally with Docker
Running build in debug mode
Getting an API token from the profile page
Getting access to a token using Travis CLI
Obtaining a job ID from the build log
Obtaining the job ID from the URL in the View config button
Obtaining the job ID via an API call to the /builds endpoint
API call to start a build job in debug mode
Fetching an SSH session for the debug mode
Travis debug mode convenience Bash functions
tmate shell session actions
Travis Web UI logging
Steps that Travis CI takes to protect your environment-specific variables
Travis CI deployment overview and debugging
Supported Providers in Travis CI
Heroku setup in Travis CI
Debug failure in Travis YML script
Summary
Questions
Further reading
Installation and Basics of CircleCI
Technical requirements
CircleCI
Comparing CircleCI and Jenkins
CircleCI prerequisites
Creating a GitHub account
Creating a Bitbucket account
Creating a CircleCI account
Setting up CircleCI in GitHub
Setting up CircleCI in Bitbucket
Setting up a new Java project in Bitbucket with CircleCI build
CircleCI configuration overview
Concept overview of CircleCI configuration
Adding source files to the new repository
CircleCI build job for the new repository
Summary
Questions
Further reading
CircleCI CLI Commands and Automation
Technical requirements
CircleCI CLI installation
Installing CircleCI CLI on macOS/Linux
Installing nightly build versions of CircleCI through GitHub releases
CircleCI CLI commands
Version command
Help command
Config command
Build command
step command
configure command
Setting an API token with CircleCI
Setting the API token and API endpoint in interactive mode
Tests command
Using Workflows in CircleCI
Workflows in action in CircleCI Web UI
Sequential workflows example
Adding environment variables to a project
Updated workflows section and config YML script
Working with the CircleCI API
Test CircleCI API connection
Using the CircleCI API to get build summary for a single Git repo
Using the jq utility to compute some metrics of our CircleCI builds
Summary
Questions
Further reading
CircleCI UI Logging and Debugging
Technical requirements
Job log overview
Run steps in job with a default build job
Adding a project to CircleCI via the API
Using curl as a REST client
Parse build_url attribute from the JSON response
CircleCI Web UI job log analysis
Best practices for environment variable safe usage
Run steps in job with workflows
Adding a workflows section to the config YML script
Using the CircleCI API to find the most recent build URL
Debugging slow builds in CircleCI
Logging and troubleshooting techniques
Running a build using a local config YML script to troubleshoot
Summary
Questions
Further reading
Best Practices
Technical requirements
Best practices for different types of testing in CI/CD
Smoke testing
Smoke test example
Unit testing
Unit test example
Integration testing
Integration test example
API testing example using the supertest Node.js library
API testing example with the baloo Golang library
API testing example with curl, bash, and jq
System testing
System test example
Acceptance testing
Acceptance test example
Best practices for running different tests in a CI/CD pipeline
Best practices in password and secrets storage
Vault installation
Starting the dev server for Vault
Checking the status of the Vault server
Setting an API secret in Vault
Using the Vault RESTful API
Vault RESTful API endpoint GET /v1/sys/raw/logical
Overall best practices for secrets management
Best practices in deployment
Creating a deployment checklist
Collaboration among developers and operations
Releasing automation
Deployment script example
Automated GitHub release example
Golang script example
Best practices for a deployment script
Summary
Questions
Further reading
Assessments
Chapter 1: CI/CD with Automated Testing
Chapter 2: Basics of Continuous Integration
Chapter 3: Basics of Continuous Delivery
Chapter 4: The Business Value of CI/CD
Chapter 5: Installation and Basics of Jenkins
Chapter 6: Writing Freestyle Scripts
Chapter 7: Developing Plugins
Chapter 8: Building Pipelines with Jenkins
Chapter 9: Installation and Basics of Travis CI
Chapter 10: Travis CI CLI Commands and Automation
Chapter 11: Travis CI UI Logging and Debugging
Chapter 12: Installation and Basics of CircleCI
Chapter 13: Circle CI CLI Commands and Automation
Chapter 14: Circle CI UI Logging and Debugging
Chapter 15: Best Practices
Other Books You May Enjoy
Leave a review - let other readers know what you think
Writing modern software is hard because there are many groups involved in the delivery of software, including developers, QA, operations, product owners, customer support, and sales. There needs to be a process by which the development of the software is done in an automated way as it is being built. The process of continuous integration and continuous delivery will help ensure that the software that you deliver to your end users is of the highest quality and has been through a series of checks in a CI/CD pipeline. In this book, you will learn how to use Jenkins CI and how to write freestyle scripts, plugins, as well as how to use the newer Jenkins 2.0 UI and pipelines. You will learn about Travis CI in terms of the UI, the Travis CLI, advanced logging and debugging techniques, and best practices with Travis CI. You will also learn about Circle CLI in terms of the UI, the Circle CLI, advanced logging and debugging and best practices with CircleCI. Throughout the book we will talk about concepts such as containers, security, and deployment, among others.
This book is meant for system administrators, QA engineers, DevOps, and site reliability engineers. You should have an understanding of Unix programming, basic programming concepts, and version control systems such as Git.
Chapter 1, CI/CD with Automated Testing, introduces the concept of automation and the explains the importance of automation compared to manual processes.
Chapter 2, Basics of Continuous Integration, introduces the concept of continuous integration, explains what a software build is, and covers CI build practices.
Chapter 3, Basics of Continuous Delivery, introduces the concept of continuous delivery and in particular explains the problem of delivering software, configuration management, deployment pipelines, and scripting.
Chapter 4, The Business Value of CI/CD, covers the business value of CI/CD by explaining problems with communication, such as the ability to communicate pain points to team members, sharing responsibilities among team members, knowing your stakeholders, and demonstrating why CI/CD is important.
Chapter 5, Installation and Basics of Jenkins, helps you get Jenkins CI installed on Windows, Linux, and macOS OSes. You will also learn how to run Jenkins in a local system and how to manage Jenkins CI.
Chapter 6, Writing Freestyle Scripts, covers how to write freestyle scripts in Jenkins and how to configure freestyle scripts in Jenkins, along with adding environment variables and debugging issues in freestyle scripts.
Chapter 7, Developing Plugins, explains what a plugin is in software, how to create a Jenkins plugin using Java and Maven, and goes over the Jenkins plugin ecosystem.
Chapter 8, Building Pipelines with Jenkins, covers Jenkins 2.0 in detail and explains how to navigate in Jenkins 2.0 (Blue Ocean), and also covers the new pipeline syntax in great detail.
Chapter 9, Installation and Basics of Travis CI, introduces you to Travis CI and explains the differences between Travis CI and Jenkins CI. We look at Travis life cycle events and the Travis YML syntax. We also explain how to get started and set up with GitHub.
Chapter 10, Travis CI CLI Commands and Automation, shows you how to get the Travis CI CLI installed, explains each command in the CLI in great detail, shows you how to automate tasks in Travis CI, and explains how to use the Travis API.
Chapter 11, Travis CI UI Logging and Debugging, explains the Travis Web UI in detail and showcases advanced techniques in logging and debugging in Travis CI.
Chapter 12, Installation and Basics of CircleCI, helps you set up CircleCI with Bitbucket and GitHub and shows how to navigate the CircleCI Web UI. We will also explain the CircleCI YML syntax.
Chapter 13, CircleCI CLI Commands and Automation, helps you install the CircleCI CLI and explains each command in the CLI. We will also go over workflows in CircleCI and how to use the CircleCI API.
Chapter 14, CircleCI UI Logging and Debugging, explains the job log in detail and shows how to debug slow builds in CircleCI. We will also go over logging and troubleshooting techniques in CircleCI.
Chapter 15, Best Practices, covers best practices for writing unit tests, integration tests, system tests, acceptance tests in CI/CD, and best practices in password and secret management. We will also go over best practices in deployment.
In order to get the most out of of this book you will need to be familiar with Unix programming concepts such as working with the Bash shell, environment variables, and shell scripting, and understand basic commands in Unix. You should be familiar with the concept of version control and know what is meant by a commit, and you'll need to understand how to use Git in particular. You should know basic programming languages concepts because we will use languages such as Golang, Node.js, and Java, which will work as build languages that we use in or CI/CD pipelines and examples.
This book is OS-agnostic, but you will need access to a Unix environment and commands in order to use some of the concepts in this book. So, if you are using Windows, it may be useful to have Git Bash (https://git-scm.com/downloads) and/or the Ubuntu Subsystem installed if possible. You will need to have Git (https://git-scm.com/downloads), Docker (https://docs.docker.com/install/), Node.js (https://nodejs.org/en/download/), Golang (https://golang.org/dl/), and Java (https://java.com/en/download/) installed in your system. It would be very helpful to have a text editor such as Visual Studio Code (https://code.visualstudio.com/download) and a terminal console application.
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packtpub.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Continuous-Integration-and-Delivery under the README section, where you can find all the links to the code files chapterwise . In case there's an update to the code, the links will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Chocolatey installation instructions can be found at chocolatey.org/install."
A block of code is set as follows:
{ "@type": "env_vars", "@href": "/repo/19721247/env_vars", "@representation": "standard", "env_vars": [ ]}
Any command-line input or output is written as follows:
Rules updatedRules updated (v6)
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "ClickContinueand make sure to click on theAgreebutton."
Feedback from our readers is always welcome.
General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
In this book, we will look at the concepts of continuous integration (CI) and continuous delivery (CD) and apply these concepts using tools such as Jenkins, Travis CI, and CircleCI. There will be many hands-on scripts that we will write, and we will explore real-world CI/CD automation scripts and scenarios. This chapter will help illustrate the concept of automation by explaining the current practices of a fictitious company called Billy Bob's Machine Parts. Billy Bob's Machine Parts has a lot of manual processes in place and there is some tension between quality assurance (QA) and the developer team because the software releases are only done by the lead developer and all QA testing is done manually.
The following topics will be covered in this chapter:
Manual processes – a hypothetical scenario
Employee frustration
Introducing automation
Developer productivity
Breaking down communication barriers
Creating an environment of collaboration
This chapter will describe a mock manual process and the flaws inherent in manual testing and manual processes, and will explain how using CI/CD can drastically improve developer productivity. In this scenario, each member has set up a manual set of processes that are quite time consuming to finish. Additionally, the steps have to be done again if QA encounters issues in the latest release version.
We will look at different scenarios across multiple departments in our fictitious company. Some of the scenarios will look at pain points for the developer team, QA team, customer success team, and sales team. We will build up possible scenarios that could occur across these teams, identifying areas that are good candidates for automation and how communication across these teams exposes areas that can be greatly improved with automation.
The following diagram shows a few business scenarios:
Betty Sue is part of the QA department at Billy Bob's Machine Parts company. At Billy Bob's Machine Parts company, there is a mid-sized developer team. Eric, the lead developer, starts the manual release process on Thursday morning at the end of a quarter. It takes two days for Eric to finish the release cycle. Unfortunately, he is the only one who can do the release in the developer team. Eric runs all the tests on his local workstation and integrates emergency patches if necessary. Once Eric is done, he emails a ZIP file to Betty Sue in the QA department.
Betty Sue has a couple of QA engineers and starts the manual testing cycle for the new release on Monday morning. Betty notifies Eric that she has already found several issues in the latest release. Betty gets an Excel spreadsheet ready that documents the issues that the latest release has introduced. At the end of the week, Betty has broken down the list of issues with the latest release into critical-, high-, medium-, and low-priority bugs.
During a release cycle, both Eric and Betty redo each step when issues are addressed. Eric has to repackage all the software components and rerun all of the tests on his local workstation. Betty has to redo the testing cycle because she has to check for regressions and ensure that the latest fixes do not break existing functionality in software components.
Michael, a junior developer on the team, is also doing manual processes. Michael gets a list of issues from Eric and starts working on the more high-priority bugs from the list. Michael tries to address and fix each bug but does not write any regression tests, ensuring that the newer code has not broken existing functionality. When Michael is done, he tells Eric that everything is good on his end. Unfortunately, Eric sees test failures when he runs all the tests on his local workstation. Eric informs Michael that he needs to be more careful while working on fixing issues on the bug list.
Dillon, a member of the QA department, starts testing parts of the new release and tells Betty that there are several issues with the release. He has created a checklist of issues and sends it to Betty. Unfortunately, some of the work that Dillon has done has been duplicated by Betty as they have similar items highlighted in two different checklists. Betty informs Dillon that QA needs to make sure that duplicate work is not being done. Dillon goes back and highlights parts of the release that he will be testing.
Jennifer leads the customer success team and gets notified when newer releases are ready to be opened up to customers by the QA department. Jennifer starts preparing videos of the latest release features and consequently asks QA questions about changes in the new release.
Bobby is an experienced member of the customer success team and starts creating videos on the latest features. When the release videos are published to the company blog, QA realizes that some of the videos incorrectly state features that are still in the beta release schedule. Jennifer now quickly scrambles the customer success team and asks QA to clearly mark some features as beta before they are sent to the customer success team.
The sales team has been emailing notes that sales engineers have taken during meetings with prospective clients. Sandy has hand-typed detailed notes about each prospective client and uses an Excel spreadsheet to categorize important sales information. Unfortunately, the sales team emails new changes to Excel spreadsheets to the sales department. Sometimes, confusion ensues because a sales engineer will open an older Excel document and mistakenly give outdated information to other sales engineers.
The UI/UX team tends to work with a lot of mockups and wireframes. Often, during the prototyping phase, UI/UX engineers will embed notes into mockups with transition notes detailing validation states and page interactions. Victor sees a note in one of the wireframes and realizes that there is important page logic embedded in the wireframes. Victor asks the UI/UX team if the notes can be shared with the developer team. The UI/UX team also work with art boards and create ZIP files for each feature work. For instance, Sandy was assigned work on feature x and has been taking detailed notes on the UI interaction for the new page. A lot of work by the UI/UX team tends to be highly visual, and colors mean distinct things. The visual aspect of the work tends to imply certain actions that should occur during phases of UI flow. Developers tend to work with more concrete items so it is not always apparent what natural flows should occur. For instance, if you delete an item, do you bring up a modal, which is a little window for confirmation, or do you just immediately delete an item? When submitting a form, does the UI show indications of an error in a certain color and a warning in another color? What positions should the validation be placed in? Sometimes, UI interaction flows are not described in detail and the developers must go back and forth with UI/UX. Documenting why decisions were made in a decision file is important.
Betty Sue has emailed Victor a list of issues that are categorized by priority. Higher priority issues must be dealt with first, while lower priority issues are dealt with later. Victor gets the list of issues with the newest release and notifies the developer team that they must stop the new feature work they are doing immediately and start fixing the issues with the new release. David, a senior developer on the team, is frustrated because he was in a nice rhythm and now is scrambling to reorient himself with work he did a month ago.
Michael, a junior developer on the team and still new to the codebase, is worried about a higher priority issue that is on the list. Michael scrambles to resolve the higher priority issue but does not think to write any regression test cases. Michael quickly writes a patch for his high-priority ticket and sends his patch to Victor. Victor quickly finds regressions and broken test cases with Michael's patch. Michael did not know that he should write regression test cases to ensure that there is no regressions.
The process of releasing a new patch is not properly documented and newer developers such as Michael frequently create regressions that break existing work. Victor teaches Michael the concept of regression testing and Michael quickly writes a software patch with regression test cases.
Once Victor gets all the new software patches ready, he gets started on a hot-fix release and reruns all the tests on his local machine. Betty gets a new ZIP file with the latest release and starts the manual test processes again. The QA department is manually testing parts of the product, so it is a time-consuming task to test all the parts of the product. Betty has found some more issues with the latest release and sends Victor a smaller list to start working on later in the week.
David is abruptly stopped by Victor and is told to drop his new feature work because the latest changes have defects. David spends the next two hours trying to reorient himself with the issues in the new release. Once confident that he has tracked the issue, he spends the afternoon doing a fix. David notifies Victor that the latest changes are ready to be tested. Victor starts running tests on his workstation and immediately sees that some integration tests are now failing due to the latest changes, and notifies David that these issues must be addressed. David is now frustrated and works late into the evening getting another fix out. The next morning, Victor runs all the tests and everything is passing, so he sends Betty a new ZIP for the latest hot fix. Betty starts the manual testing process the next day and unfortunately finds a couple of small issues again and lets Victor know in the afternoon that there are still some issues with the latest release.
Victor, admittedly frustrated at this moment, huddles all the developers into a room and says no one is to leave until all the issues are addressed. After a long evening stuck in the office, all the latest issues are addressed and Victor lets everyone go home. The next morning, Victor packages up the latest release and emails Betty a new ZIP file. Betty, a little worried after the last test cycle, is pleased that all the bugs have been addressed and gives the QA stamp of approval and lets Victor know that the latest release is ready to go. Both the developer team and the QA team celebrate the end of the work week with a company-sponsored lunch and go home for the weekend.
