Introducing Grunt plugin for CircleCI

Posted by Ismael Ambrosi on Oct 13, 2014 7:49:00 AM

The grunt-circleci plugin provides a simple task for checking the status of a revision build on CircleCI, allowing you to run tasks based on the result of the test suite.

Grunt is an amazing JavaScript task runner with one important goal: automation. You can find more info at http://gruntjs.com

CircleCI

Motivation

At VividCortex we practice continuous deployment. Essentially, this means we have the obligation to ship as soon as we get the thumbs up in a pull request. We also incorporate chat-ops, which means that anyone can deploy code to production, and it is very easy to do so - you only need to type a single command in our internal IRC.

Sometimes in the past though, this did not work flawlessly. A test failed after merging, but the developer didn’t notice it before starting the deploy and… boom! The site is down in production.

There are several ways to fix this. Some choose to make their deploys from the build system itself. You can do that pretty easily if you use CircleCI for instance.

Instead, we have chosen to run our deployment process locally, so we needed a way to call the CircleCI API from the deploy job and only proceed if the build is “green”. This is exactly the situation that grunt-circleci is meant to solve.

What does this plugin do?

This plugin uses CircleCI’s API to find a build that matches the revision we want and checks the status of it. In case of failure, the plugin will stop the grunt execution and exit with an error code. Only in case of a successful build will your task continue executing.

How do I use it?

Setting up this plugin is very easy if you’re familiar with the process of configuring and running tasks with Grunt. Make sure you check the plugin’s documentation for installation and configuration instructions. Comment if you see areas for improvement, and we welcome any pull requests!

Pic Credit

Recent Posts

Posts by Topic

see all