Spinnaker Training Series #4: Build Pipelines
Ethan Rogers, resident Spinnaker expert, explains how to build piplelines and create deployment workflows.
A Transcript of the video is available below:
Ethan: What’s up guys, I am Ethan. Your Spinnaker expert. Thanks for joining us for another episode in our series of Spinnaker training where we take you through Spinnaker and teach you how to use it and get the most out of it. If you haven’t already checked out some of the previous videos in the series be sure to go watch them because they are going to be really helpful as we progress and get deeper in this Spinnaker.
Today we are going to be talking about how to build a pipeline and how you can string together all of the pipeline stages to build a deployment workflow that suits your needs, let’s get started. So the first thing that we are going to do is we are going to set up a pipeline trigger. You will recall from previous videos that this just allows you to start a pipeline at any point in you development process. So what we are going to do today is we are going to create a Jenkins trigger. Now this is going to wait for a Jenkins job to successfully complete and then we can act on the artefacts that were produced in that Jenkins job and deploy them.
So, what we will do is we will select our job and we will deploy based on successful completion of the master build. So the next thing that we are going to want to do is we are going to add a bake stage, now bake stage is going to take the results of that Jenkins job and bake it into an AWS AMI. We will do that by selecting the bake stage here. Now, we’ve got to select our region so we will select US west 2 and we will select our package name that was built by Jenkins. Now you don’t have to enter any version information here. Spinnaker is going to pick that up for you. We leave all these settings the same but I will just point out here that there are some advanced options.
Spinnaker uses packer under the hood to do base so you can configure your bake to use any kind of packer specific settings that you like. Now we are going to do a deploy stage, so we will proceed after the bake onto a deploy stage that is going to create a server group and deploy our new AMI into AWS. So we will do that by clicking add stage and then select the deploy stage. So now that we’ve got a deploy stage at it, we can say add server group and select our provider since we are doing AWS stay we will select an AWS provider. Now to save some time, I am going ahead and copy a currently running server group so that we can see how quickly we can iterate on these things. We will say that we are going to grab the Armory hello deploy-nightly server group and use that. What this is going to do is going to pre populate all of these fields for a deploy stage so that we do not have to go in and re configure everything from scratch.
So what we will do here is we will say we will change this to training. You will recall that the stack information really just kind of combines like, groups the server group into something that you will know exactly what the purpose of that server group is. We will use a red-black strategy commonly known as blue-green, we will be doing another video on deployment strategies in the future so be sure to check that out so we can explain all of the different deployment strategies that Spinnaker includes out of the box and we will orchestrate for you. We can then go ahead and select the load balancer that we are going to attach our server groups to, the security groups that we want and then we have a whole bunch of instance information down here we can select what AWS instance we want whether that is a high memory instance or a micro utility instance. We can even go so far as to do custom types, if one of the instant types that we want is not provided here. We will actually go ahead and just use the micro instance here. We can then decide what capacity we want, what availability zones that we want to deploy into, this is multiple so you can deploy to all the different availability zones in your region and then we’ve got a bunch more advance settings down here. Most of these, all of these maps to EC2 if you are using Kubernetes or a different cloud provider, these settings are going to be specific to that type of provider and the next thing we are going to do is just click add and now you can see that we have got a server group definition here. One more thing to point out, a deploy stage does not only have to deploy one server group. You can deploy as many different server groups as you want by just adding new server groups and going through the same process that we just did.
The next thing to do I save our changes and then we will roll back over to the pipeline section and we will find our pipeline. We can actually do that over here by filtering the list. When you are ready to deploy your pipeline just click this start manual execution and you will be able to select your Jenkins job that you want to pull your build from.
I hope that this was helpful in showing you how you can use Spinnaker stages to build out the deployment workload that you want. Spinnaker is really flexible and it is important to understand how all of these stages fit together, how you can use them to get to your desired goal without having to write all the codes of these yourself. Thanks for watching.