How to achieve CICD with Habitat other than Chef Automate


#1

Hi Team,

I did look into the documents which refer to CI/CD using Habitat, but is tied up with Chef Automate.
I wanted to understand can Habitat work in silos to create CI/CD pattern.
For Example,
Lets say I have a node js application.
Code analysis scripts are in JSHint
Unit test scripts are in Mocha
and then finally the build step kicks in.

Is there a way I can mention somewhere like plan.sh at do_build() as to continue with build only if unit tests are successful.
Something like :
do_build()

if ( all unit tests pass )
{
— build
}

And as Habitat cannot by itself export into a docker container, should there be a command from either terminal or third party application like Chef Automate/Jenkins to trigger the deployment of docker images ?


#2

You can execute commands within the hab studio from outside by doing this:

$ hab studio run build

This would allow you not to be in the studio to do said tasks like unit tests etc. alternatively you could install all the stuff you need in your container to test.

I also use the method above to pass in hab pkg export docker <pkg> Beware, if you don’t have a depot, you’ll have to build and package in the same run.