An Introduction to CircleCI
CircleCI is the continuous integration & delivery platform that helps development teams to release code rapidly and automate the build, test, and deploy process using Docker container. CircleCI is a reliable platform that works well with languages like Ruby, Python, NodeJS, Java and Clojure.
Steps to Signup with CircleCI
Signing up with CircleCI using GitHub or Bitbucket is free.
Then next step is to authorize CircleCI to access your code base using repositories by clicking the “ADD PROJECTS” on CircleCI console.
Then add the repositories you want to build from your GitHub/BitBucket.
Configure CircleCI
CircleCI automatically analyzes your code settings and works fine most of the time. But if it doesn’t work then you need to configure the circle.yml
file. This file helps and informs CircleCI about the exact action a user intends to perform on his build. This is a simple YAML file where you need to put the build steps as per CircleCI file structure and content. The other additional steps like initializing circle.yml
is done by placing the YAML file in the repo’s root directory and then CircleCI reads the file each time it runs a build using the YAML file.
Also, circle.yml file is completely optional. You will override this file by using the additional GUI option. But if by mistake you define “Test Commands” in GUI and also inherit circle.yml
in your code then CircleCI will infer variables, environment etc from your circle.yml
In GUI builder console, CircleCI examines your repository and attempts to auto-inherit the type of build system used in your repo.
Here are the detailed steps in each build Each build clearly shows the detailed steps involved:
Build Environment
With a custom circle.yml you are free to prepare an environment for your application code dependency. CircleCI’s build servers have already pre-installed languages and build tools such as Java, Gradle, Maven that you need for a standard development. You can add other services easily by enabling parameter in circle.yml like MySQL , ElasticSearch etc
Below are six primary phases that are used in CircleCI to build your code
1) machine: adjusting the VM to your preferences and requirements
2) checkout: git repo checking out and cloning feature
3) dependencies: setting up your project’s language-specific dependencies
4) database: preparing the databases for your tests
5) test: running your tests
6) deployment: deploying your code to your web servers
Note: Most of the projects does not need to specify anything for these phases
Documentation
Documentation in CircleCI for enterprise and non-enterprise is very extensive. It contains guides specific to each language along with the reference information.
Pricing
CircleCI has three different pricing plans for Linux , OS X and Enterprise respectively.
Build on Linux: The first container is free + each additional container is $50/month.
Build on OS X:
Enterprise: CircleCI Enterprise is available for a free, no-obligation 30-day trial.
Troubleshooting
Often the best way to troubleshoot problems is to SSH into a running or finished build to look at log files, error messages, running processes, and so on.
To enable SSH access for a running build, you need to select the option ‘Debug via SSH’ tab and click the ‘Enable SSH for this build’ button from drag down option.
To start a fresh build with SSH enabled, for example, if you want to troubleshoot a build that has already finished, click the ‘with ssh’ button alongside ‘Rebuild’:
And host and port information for the container will be available in the ‘Debug via SSH tab’:
Post-Build Steps / Deployments
CircleCI allows you to define artifact files for your build that will survive and can be collected afterwards. This is very helpful if you want to deploy anything and just want to fetch the final outcome of the build.
My Verdict
I would strongly recommend you to use CircleCI in your project. It was an enriching experience working with CircleCI especially using the killer features like circle.yml and integrating external services like MySQL, ElasticSearch directly in your code with SSH support and reporting of JUnit.