DevOps today is considered to be the most effective approach for software development and deployment.  Software service providers can now decrease development complexities, and continuously deliver top-quality, innovative software. Continuous Integration (CI), Continuous DElivery (CDE), and Continuous Deployment (CD) are some of the key processes that allow speedy deployment and delivery of software without compromising on quality.

CircleCI is one of the simplest continuous integration and continuous delivery (CI/CD) platforms that helps development teams release code rapidly and automate the build, test, and deploy process using Docker containers. It is a reliable platform that works well with languages like Php, Ruby, Python, NodeJS, Java, and Clojure. CircleCI provides built-in support for parallelism that can be accomplished across developer options. It is considered as a scalable option with a better UI.

In this article, we will discuss more about CircleCI, CI/CD and how you can configure your Drupal project on CircleCI.

But First, what is CI/CD?

Drupal Project on CircleCI

 

Continuous Integration is a practice to merge all developers code into a shared central repository. CI is a coding philosophy and set of practices that drive the development team to implement the changes and check the code into the central repository frequently. Because most applications require the code in different platforms and tools, the team needs to integrate and validate its changes.

Whereas, Continuous Delivery is the ability to get changes of all types including new features, configuration changes, bug fixes, and experiments into production, or into the hands of users, safely and quickly in a sustainable way.

A CI/CD pipeline is a full set of processes that run when you trigger work on your projects or commit your changes on the central repository. Pipelines have your workflows, which coordinate your jobs, and this is all defined in your project configuration file.

Configure your first Drupal project in CircleCI

Step1: Create a repository in Bitbucket

Create Repository

 

Step2: Push your Drupal application code to the repository. Here are some git commands to help you to commit your changes in Bitbucket.

git init
git remote add origin 
git add 
git status
git commit -m "first commit"
git push origin master

Step3: Login to the CircleCI using Bitbucket

Login CircleCI

 

Step 4: Set up your Drupal project

Setup Drupal Project

 

Step5: Setup .circleci/config.yml

CircleCI will find and run the config.yml and interact with the code to orchestrate your build, tests, security scans, approval steps, and deployment. CircleCI treats the configuration as code which is why it has been orchestrated through a single file.

Our current code structure looks like this:

Code Structure

Workflows Configuration

Workflows support several configurations, some of them are listed below:

  1. Sequential job execution 
  2. Parallel job execution 
  3. Fan-in/fan-out in a repo 
  4. Branch-level filtering for job execution

Fan-in/fan-out in a repo is ideal for a more complex build orchestration and for teams who want to run different test suites against commits to getting faster feedback. It allows you to run multiple jobs in parallel that lead up to a singular job and vice versa from a singular job to multiple jobs. 

See the following example of a Drupal startup kit:

Built Artifact

Troubleshooting a failed pipeline job

You can access your build job via SSH in CircleCI very easily. You can run your failed job via SSH. You can debug your failed job and rerun only that failed job. No need to run the entire pipeline.

Check out the following example:

You can click the job and see the details of where it has failed and the reason for the failure.

Deploy Over SSH

 

You will then get the rerun option where you can rerun the pipeline from the failed job. Also, you can debug the same via SSH.

Deploy Dev

 

Contact us

LET'S DISCUSS YOUR IDEAS. 
WE'D LOVE TO HEAR FROM YOU.

CONTACT US