CI/CD Pipeline: What You Should Know

What is a CI/CD process? Sometimes called continuous integration and continuous delivery in the industry, or CI/CD in short. In this article, we will explain what a CI/CD pipeline is, how it works and why it is crucial.  The term ‘continuous delivery’ refers to the practice of deploying new versions of products continuously throughout development cycles.

Elements of a CI/CD pipeline

Elements of a CI/CD pipeline include:

A continuous integration system runs automated tests on code changes to ensure they are not breaking anything before being merged into production. Your organisation can host the CI server or use an external service such as GitHub Actions.

An application release automation tool allows developers to deploy applications from source control repositories directly to cloud environments without manual intervention.

CI/CD Pipeline Architecture

To build a good CI/CD Pipeline Architecture, it is important to understand how different components interact. A typical architecture consists of three main parts:

1) Source Control Management: This includes tools like Git, Mercurial, Subversion, etc., which allow users to store their project files in versioned locations accessible over network protocols. SCMs provide access to these projects through commands like git pull, svn update, hg clone, etc.

2) Build: In this part, we have various builds, including unit testing, functional testing, performance testing. These tests run against our software artefacts stored in the repository. We also need some deployment mechanism to get the binary artefact ready for deployment when all the tests pass successfully. For example, if we want to create a web app, we will need a web server running somewhere else.

3) Deployment: Once the binaries are built, deployed to test environment, tested there, and finally moved to production, we call this process “deploy”. It involves moving the binaries to the target location where they should reside permanently.

Source Build

The first stage of continuous delivery is the build, which can be done manually or automatically. Preferably it should happen every time there are changes to a code repository on GitHub, for example.

Message: “Build”

Verify Release Package Build and Deployment Status:

To verify whether your application package has been built correctly, check its status using the following command:

If the output does not show any error, everything went well. If no result is shown, please refer to the documentation provided by Docker Hub about troubleshooting issues related to building containers.

docker ps -a | grep myAppName

Team Test Stage

The team test stage is when people test the application package to ensure it meets quality and functionality requirements.

This step mustn’t happen too early in the process, or else you will be releasing things with bugs. If there are any problems found here, they need to be corrected before moving on from build to deployment status.

Deploy for Business Test Stage

To deploy the application package for business testing, the test administrator would need to verify whether all necessary approvals have been met.

The approval process is key in ensuring that the right people are aware of your product and provide feedback so you can make any final adjustments before releasing it to the public.

Once an app has passed these stages successfully, it’s ready for release!

Business Test Stage

This stage is the last chance to test your application before it’s released. All of the requirements for this step have been met, and all that remains is deploying the app.

To deploy the application package for business testing, a user has two options: either upload or sync their software release to Salesforce production orgs from within the SFDX CLI tool. This option allows them to use the same version as what was used during development. The second option is uploading the file directly into Production Orgs via Force.com IDE. In both cases, once uploaded, users must wait until the next scheduled maintenance window to see how the new releases perform.

Release Process

After verifying that the application package passes all required checks, the next thing to do is to prepare the release notes. The release note contains information such as what was changed since the last release, new features added, bug fixes made, etc. You may use different methods to generate the release notes depending upon how much detail you require. Some examples include writing them down yourself, generating them via spreadsheet, or creating a wiki page.

Release Process Flowchart

As mentioned earlier, each phase of the Continuous Delivery pipeline consists of several steps.

Steps:  – Download and install the latest release in Salesforce production orgs.

– set up your deployment pipeline for continuous delivery by defining a configuration file that includes all of the steps required to complete an application update (e.g., build, test, business testing), including what tests are run at each step and which environments those tests should pass.

– create a change request describing the changes needed to fix issues identified during the previous phases.

– assign the change request to one of your project managers, who will coordinate its completion.

– review the change request description and approve if everything looks good.

– add the approved change requests to the Change Request queue, where they’ll remain pending until someone completes them.

– after completing the change requests, check out the code using GitFlow workflow.

– merge the code into the master branch and deploy it to production.

– after deploying, follow up with stakeholders or project managers, notifying them of the deployment success.

Deploy for the production stage

The process starts when you push the code to the GitHub repository. Once pushed, the source control system automatically creates a pull request on Github. A developer then reviews the pull request and approves it. After approval, the Pull Request gets merged into the master branch. Now, the developer needs to commit their work back to the master branch so that other developers can start working on it. To achieve this, they use the Gitflow command-line interface.

Production

Deployment Pipeline Steps

1. Checkout Code – Using Gitflow commands, check out the code from the GitHub repo.

2. Build & Test – Run unit tests, integration tests, static resource validation, and other necessary tasks.

3. Release Candidate Stage – Create a release candidate environment and execute manual acceptance tests against it. If these tests fail, revert the code and repeat the above two stages.

4. Final Approval – Execute manual acceptance tests against the final release environment.

Continuous Monitoring/Feedback

Loop

Once the release is deployed, we need to monitor whether there’s anything wrong with our product. This could be done manually by emailing customers about their feedback, but it would take time and effort. So, instead, we have automated processes like monitoring webhooks, sending emails, running reports, etc. These help us keep track of customer feedback and provide immediate responses.

What does “continuously” mean? It refers to how often we perform such activities. For example, We may send weekly updates via email to let users know about new features added to the app. Or, we might use Slack channels to communicate between team members. The frequency depends upon the type of activity being performed.

Pipeline Triggers

The following triggers are available when working on pipelines:

Force.com Migration Tool – Used to migrate data between sandbox and production environment.

SFDX Command Line Interface – Allows developers to execute commands against the target organization without having access to Visual Studio Code.

Salesforce DX Workbench – Provides a visual interface for managing source control repositories and running builds. It also provides a way to preview and debug workflows.

Containers and CI/CD pipelines

They can be triggered manually through the command line. For example, this would trigger a containerized app created with Docker Hub.

sfdx force:source:push –all

This command pushes any local files to GitHub so that it’s ready for pull requests. If there were no errors while pushing, then the push succeeded. Otherwise, the error message appears.

If you’re interested in learning more about these tools, I recommend checking out the documentation here.

Builds, Deployments, Releases, and Rollbacks in the Cloud

You might have noticed that we’ve skipped over some important details regarding releases. In particular, we haven’t talked about rollback yet! This is because Salesforce has built its own versioning system called Force.com Release Management. FRCM allows users to manage deployments from within the platform instead of relying on third-party services like Github. The process works similarly to other versions of systems but offers additional functionality. Here’s a quick overview of how it works:

– Deployments are built from a source code repository (e.g., Github) and uploaded to the release management platform via its web interface.

When you upload your deployment, FRCM creates a new version of that package in the Force.com Package Repository—called an ‘instance’. For instance, let’s say we have two packages named “MyApp” and “Another App”. We’d create instances for each of those apps as follows:

FRCM automatically assigns a unique ID number to every instance. You can use this ID number to reference the instance later.

Once all the necessary components are deployed successfully, FRCM generates a URL that contains information about the newly released application. That URL points back to the source code repository.

Cloud-Based Build Systems

A cloud-based build system is one where the developer doesn’t need to install anything locally. Instead, they simply run a single command and get results immediately. There are many different types of cloud-based build systems, including Jenkins, CircleCI, TravisCI, Bamboo, etc. Each type has pros and cons depending on what kind of development team you want to support. Some examples include:

Jenkins – A popular open-source continuous integration server written by Atlassian.

It supports multiple languages such as Java, PHP, Python, Ruby, C, JavaScript,.NET Core, NodeJS, Go, Perl, Shell Script, XSLT, CSS, HTML5, XML, JSON, YAML, SQL, PL/SQL, COBOL, Tcl, VHDL, Pascal, Fortran, Ada, Assembly Language, Cobol, Delphi, Eiffel, Erlang, Forth, Haskell, Icon, Lisp, Lua.

Deployment Strategies for DevOps Teams

DevOps teams often struggle when trying to deploy changes across environments. They may be using manual processes or even scripts to do things like deploying applications, updating databases, running tests, etc. These methods aren’t scalable nor efficient. To help solve this problem, Salesforce introduced Apex CodeDeploy. It provides developers with a way to automate tasks related to building, testing, packaging, and deploying software without writing custom code.

DevOps Automation Tools

There are several tools available today that make life easier for dev ops engineers. One example is CloudForms.io. With Cloudforms.io, you can easily set up automated builds, test runs, releases, and more. Another tool worth mentioning is GitLab CI. It helps devs collaborate better while also automating some common workflows. Finally, there’s Bitbucket Pipelines. It makes it easy to integrate pipelines into any git repo.

Summary

We have covered a ci/cd pipeline in detail. This includes setting up the environment, configuring the jobs, triggering them manually, scheduling them, monitoring their status, viewing logs, and much more. In addition, we discussed how to implement these steps.

Enterprise and public sector trust Mobilise to securely transform their tech, teams and how they do business.

Say hello to your independence with our project enablement approach.