Using continuous integration to maintain code health

The following diagram shows the CI process that we will be setting up over the course of the next few sections. Once you have a basic CI setup like this, you can start to add other features, such as code documentation generation, static code analysis, a security code scanner, and automated regression testing (something we will discuss briefly later on):

The following is the CI process:

  1. Developers make multiple contributions to source control, just as we did earlier in this chapter, via the GitHub UI desktop client.
  2. The CI server is able to poll, when configured to do so, the source control server (in our case, the GitHub remote repository) for changes.
  1. Once changes are detected, it downloads the latest source code into a local workspace folder.
  2. A part of the configuration of the CI server is to inform it of the location of the Jenkinsfile script to execute after the workspace is set up. This file is included in the sample code for this chapter and will be discussed in more detail later in this chapter.
  3. A scratch org is dynamically created and set aside solely for the use of the CI process job. It is important to also explicitly delete these scratch orgs as part of this process since there is, by default, a limited number of active scratch orgs allowed by Salesforce. This limit includes those used by developers as well.
  4. Finally, the CI server will record the log and results of the build for analysis, and the number of successful versus failed builds, and provide reports and notifications on the overall health of the source code in source control. If there are failures, there are options to email certain team members as well as specific targets (those who made the most recent changes). Making sure a team stops what they are doing and attends to a broken build is very important. The longer broken builds exist, the harder they are to solve, especially when further changes occur.

The preceding process is a high-level overview of continuous integration. In the next section, we will walk through this in more detail, using a Jenkins CI server.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.74.3