Check out a free preview of the full Full Stack for Front-End Engineers, v3 course
The "Continuous Integration & Deployment" Lesson is part of the full, Full Stack for Front-End Engineers, v3 course featured in this preview video. Here's what you'd learn in this lesson:
Jem discusses the need for continuous integration and continuous deployment when scaling applications. The differences between CI and CD, and the importance of testing are also covered in this segment.
Transcript from the "Continuous Integration & Deployment" Lesson
[00:00:00]
>> So next I want to talk about CI/CD, some shell scripting, and cron jobs, good stuff. You're like, what does CI/CD have to do with being a full stack engineer? Well, when you get to any sort of scale, and by that I mean more than one server, even ten servers.
[00:00:22]
You have to say, who's working on the servers, is it one developer? That's fine, maybe not don't need CI/CD. But let's say you have 100 developers, who are all working on features at the same time. How do we ensure that the code in production is the latest, who's dictating that?
[00:00:39]
Is it just everybody pushes and then on Friday you do one massive push and hope nothing in production goes down. I hope not, that's how we used to do things. So there's this concept of continuous integration, continuous delivery or continuous deployment. It depends on your flavor you're going for, but the CI is always continuous integration.
[00:00:59]
All that means is the changes are validated, emerged back to main as often as possible. So no, I've had this VR, this polar quest open for two weeks. It's got 50,000 changes in it, as far as editing, we don't want to do that we want small atomic changes, that are easy to reason about in case something goes wrong.
[00:01:19]
If you've never had anything go wrong, you've never had to do a git bisect, on production system, count yourself lucky. It is not fun, you're diving to the smallest changes trying to figure out what happened, and you don't never want to be there. Ask any SRE, site reliability engineer they will tell you CICD is the only way to do things when you're talking about systems at scale.
[00:01:41]
But this I've always struggled with, I'm not going to lie. Continuous delivery versus continuous deployment, are kind of like, they sound like the same thing. If you told me that on the street, I'd be like you're just saying the same thing. Continuous delivery just means, the changes are ready to go.
[00:01:57]
Not that you're actually deploying them for production but we're all writing code here, we're all going to push it up. It's been tested and validated. And then it's ready to go to production, it doesn't mean that, we actually are pushing into production. Whereas continuous deployment, does mean we're pushing to production.
[00:02:15]
So that just means I merge in the changes that go through all the tests and cycles, and we're just always updating production. And the difference between continuous delivery and continuous deployment, some of its arbitrary some of it depends on your company. Some of it depends on kind of the timeliness of the changes you need to make.
[00:02:33]
If I'm working on say, I don't know, a healthcare application. I probably don't want continuous deployment, cuz the chances of something going wrong are a bit high. I want you to use continuous delivery, and I want that manual validation on before I go to production. And Atlassian has a really nice diagram here, kind of explaining the difference between continuous delivery and continuous deployment.
[00:02:59]
But, what's one commonality you see between the two. Like
>> Continuous integration?
>> Yes, continuous integration, so all of this relies on testing and validation of code. None of this means anything, if you're not testing and validating your code. And that's the crux of CI/CD. People hear, CI/CD is just about pushing your code faster and saying it and that's not it at all.
[00:03:30]
CI/CD is about validating your code, making sure it says ready to go as possible. So that when you do need to push to production, there's no questions about what's gonna happen. And that's the crux of it, I think what I've seen in just my history is, people forget the test part.
[00:03:46]
They get the build, they get the deployment part, they forget testing is the core and the crux of CI/CD. And at. There we go. At Netflix, we use something called Spinnaker. Spinnaker is, maybe some of the most amazing technology I've ever had to use And the Spinnaker team probably like yeah Jim you're the best, and I am the best.
[00:04:15]
But Spinnaker is fantastic, so you know how we had to go through all this trouble of creating a droplets, then configured SSH and all these things. Spinnaker can do that for us, I could spin up 500 clusters, with a button and they're all configured correctly exactly the same, there's a load balancer setup.
[00:04:32]
It does so much work for us, netflix runs on Spinnaker. It is a fantastic piece of technology, you click on the link you can see more about it. But, and you're like I should use Spinnaker, maybe not on your personal project. This is probably overkill, this is, I don't know, using a Ferrari to toe some scissors to mow your lawn or something like that.
[00:04:54]
I don't know, you'll know when you need it, if you need Spinnaker. But it's a combination of Google and Netflix keep working on Spinnaker. I get what, on and on. But it really is powerful technology compared to what we used to have to do. IF Spinnaker allows us to use pipelines or any CI/CD system, allows us to use something called pipelines, and we talked about and pipelines, look something like this.
[00:05:17]
You have a build, you push to GitHub or wherever your code is located, you run the tests, you run different set of tests, you run even more tests. And you go through all these steps, and that's called the pipeline. I'll stop there on tests because when I die, my last words will be like, they should have written more tests, I really believe we don't write enough tests these days.
[00:05:41]
But, that's why I love CI/CD, because it forces us to think in that mindset. Now, I talked all about CI/CD, the importance of it in modern computing, why you need it at any sort of scale, the importance of testing. We're going to make one today, we're gonna make a CI/CD pipeline, but we're not going to use spinnaker.
[00:06:00]
We're not going to use Spinnaker, we're not gonna use any of these complicated things, because we probably don't need them for our use case. All you actually need to make a CI/CD pipeline is a few lines of code, and stopwatch that's it
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops