 Hello everyone, I want to welcome you all to this talk the talk is titled increasing app confidence using CI CD and infrastructures code and In this talk, I'm going to be talking primarily about smoke testing and some of the benefits you can gain in increasing the confidence in your releases by leveraging infrastructures code and CI CD So my name is Angel Rivera. I'm a developer advocate for Circle CI and In my role, I basically interface with developers in Iraq with them and engage with them on a one-to-one level Or grassroots level and I basically learn how folks are using technology in our space It's a pretty cool job where I get to Actually learn a lot about how folks are actually using technology, right in real world instances versus theory So today I want to kind of share some information that I've gained over time Regarding increasing, you know, your application release Confidence meaning, you know, it's been kind of tested and different strategies on how to do that quickly as well, right because the CI CD is all about being gaining velocity in your software development life cycle. So Definitely want to share some of that information with you So let's talk about some more tests I Speak to a lot of developers like I mentioned earlier and when I speak to them I always ask them about, you know, what kind of smoke testing are you doing? Because we're always discussing how to make our pipelines more efficient more optimized and quite frankly, I'm very surprised at the amount of Responses that I get basically telling me, you know, their test runs are pretty comprehensive and Expensive meaning they do a lot of rigorous testing on every build so With that, you know, we're talking about smoke testing smoke tests are designed to be Simple tests, right that you run every time on your builds because you want to kind of suss out Love the low hanging fruit is what I call it. So, you know, there are configurations that you know Will cause problems if they're not set correctly. So you would run a smoke test against that, right? and again, these are kind of Tests you run against things that you already know about for the most part and you want to make sure that Nothing has changed right because we all kind of modify code and we maybe change a configuration or flag in our code that Is not intended to be, you know, released to production and that's kind of where smoke tests are You don't want to run these tests when they are in a You know Comprehensive and complex situation and what I mean by that is, you know If you're doing some integration testing and you want to make sure that it's performing properly You would run maybe some sort of load testing or performance testing That's not what smoke tests are smoke tests are the simple things That you can do really really quickly. They're designed to be lightweight and scale All right, and so an effort as well So and you know good analogy is when I was a kid in high school working summer jobs in construction I would watch the plumbers kind of build out their whole project in the construction of a building and one of the things I noticed was like They were testing these The plumbing with by injecting smoke into into the plumbing and I always wondered Why would they do that? The reason was think about it if you you know, if you're a plumber and you join two pipes together and you make a joint right and Let's say you want to test that joint if you throw water in that Plumbing just gonna have a big mess on your hands if you have any kind of leaks, right? So the smoke is kind of their really lightweight way to engage Their work and test their work Without having to create a big mess and get everything wet, right? So it kind of was I thought it was genius at the time And then as I you know progressed on into developing software This term came up a few times and it kind of made sense to me already So, uh, right. So if you think about smoke testing think about it that way, right? So it's the way to test some things without really getting messy now That's not an extensive test right per se because if you stick water inside those pipes And you can still have leaks but at the end of the day you can kind of suss out any kind of You know leaks that you have or bad seals that you have in your joints Just by running smoke. So when you think about smoke testing, right again, keep in mind it's supposed to be lightweight and very limited in scale And obviously if you're finding, you know problems during your smoke test, right? You now you know that you have some issues and you need to go and fix them, which is totally appropriate Smoke testing will help you also avoid the unknowns or at least, you know Help identify some of the problems that you didn't know about in your code Right tests are only as good as I guess the experience that you've had with your code and the way that you've run it, right? So I get this question often a lot is like when should I run smoke tests? and Again, these tests are supposed to be designed to be lightweight and at pretty much effortless, right because if you're using automation You just pretty much tell the system to run it. So what we're trying to do is balance between Velocity meaning, you know going really really fast with your CI CD making sure that everything runs quickly so that you get that fast feedback loop versus you know extensive Testing which again can be pushed down further into a different pipeline so You should run your your smoke tests on pretty much every code change So anytime code changes push through your CI CD pipeline Run a smoke test, right? Even if it's, you know, sometimes you can use unit tests kind of to validate That's kind of the notion I get from unit tests is that they are, you know, kind of a smoke test to per se, but I've seen some folks go really really comprehensive and and and complex with their with their unit tests, which I think you can you can strike a balance there, right? But but if you consider You know running unit tests on every code run, you can incorporate smoke testing into those unit tests So you can also leverage CI CD, right to run these tests, which you should be doing in most cases It's modern day software development kind of dictates that we're all running some sort of CI CD continuous integration continuous delivery Or a deployment platform or services, right? Against our code so we can automate all of those things and not really have to put a lot of effort behind it So Again, right you want to run your smoke tests on every CI CD run And then one of the things I wanted to talk about today was smoke testing deployments A lot of folks that I speak to even though you're running CI CD Maybe you even have smoke tests running Against your code, right? How it's going to maybe run in a server environment as far as like starting the application But when you're actually deploying to a target environment, are we really smoke testing those deployments? And the answer is generally no. So that's what I want to kind of talk about today And the way you would be able to do that really really easily simply and almost effortlessly effortlessly is By running infrastructures code For those of you that don't know infrastructures code is the way for you to codify all of your You know creation of infrastructure, especially in the cloud space today, right the cloud providers We're leveraging infrastructures code tools like pilumi and hashi corp, which is Pilumi's going to be the one I show into my demo today But for the most part you want to leverage infrastructures code so you can build out those target environments and your CD pipeline and then deploy your application to those and then destroy them, right? It's always a great kind of Again Assurance that the application is operating as designed in the target environments or in the environments that you're targeting. I should say so again, you know with with Pushing smoke testing into your deployments You're going to gain insights into behaviors within that target environment So real quickly, I'm just going to recap what I talked about Definitely automate your smoke testing using ci cd or some other form of automation It will help you identify bugs with you know low-hanging fruit type bugs And that's awesome because again, you know, these are things that you shouldn't really have to worry about because you already know That they're there, but you just want to validate that, you know Your op your application is operating From jump the way it was designed And again, you're getting some valuable insights into how the application will run in the target environments Make sure that you know, you're down the down down Towards the release portion of your of your pipeline your release managers and your your team are super Satisfied because it's kind of been vetted right through that whole pipeline process And finally right to increase the app confidence Again, you know testing is really important. It also Helps with figuring out where you have issues and then of course That's your application which then leads to stronger confidence right in those builds and releases For when you're deploying to the target environments So this is pretty much the end of the talk portion and i'm going to jump into a quick demo All right, so I just wanted to show you some code for this demo basically have a GitHub repo And it just has a simple python flask application That serves up a static web page Again, the application isn't really the focus here. It's just showing you how to leverage Some smoke testing strategies within your shiid pipeline So let's look at the smoke test that we're going to run against Our deployment real quickly. This is built on a open source project called smoke.sh And basically it's a bash kind of framework for building smoke tests The quick thing that I want to do here is with my smoke test is once Pulumi instantiates, right? a new kubernetes cluster within Gcp I want to go ahead and just basically do some basic tests on it make sure that the application is functioning On on that cluster make sure that the docker container is is functioning basically executing and and you know starting up on the On the cluster and then I'm going to run some quick tests So one of the things I want to run is obviously check for the server make sure I get a responsive ok 200 That's the first test. The next test is going to be validating that there's some Specific strings that I'm looking for in in the body of my website since it is a static web page We can do that. We can test for some static Text and that's what I'm doing here with these two statements And once that happens, right the test pass And then Pulumi will then destroy so that means all that infrastructure that I built will be Completely destroyed because you don't want to leave infrastructure up right running That's a security kind of concern as well as Wasting money for the most part when you're doing those things You know just leaving infrastructure up for no reason And again, it served its purpose So you want to destroy it which literally you know for every CICD run you want to run a check against this deployment In the the environments that we're targeting. So this is a really nice way to kind of get that app confidence. I'm talking about So let's go ahead and and demo this so I'm going to change this To version number 13. I'm going to quickly save it again. This is just a quick way to you know show off some of that stuff We're going to go ahead and do a Okay, and now we're going to basically kick off by pushing this commit upstream We're going to jump over to our circle ci Dashboard and as you can see things started kicking off and running Let's take a look real quickly. Take a look So this is what we call a pipeline. It's the overall overarching object In circle ci and then what we're running here the build test deploys an actual workflow. So this orchestrates the jobs which are grouping of commands right that serve a certain purpose So the workflow is orchestrating my jobs as you can see i'm running two jobs at the same time This is called running in concurrency And what we're doing here is trying to save time right ci cd is all about quick, you know, software development processes so One of the ways that you can you can speed things up in your feedback loops is by Doing multiple things at the same time right makes sense when you have multiple tasks if you can get them done at You know at the same time simultaneously Things will move a lot quicker The cool thing here is one thing I want you to notice There's there is a dependency, right? So this deployed gcp will not occur unless Both of these pass. So if any one of these jobs fail, this will not kick off great, so now we have our The kubernetes cluster deployed our smoke test ran and as you can see here On the system here are the results right here Get got the 200 okay response the body of the the web page has the text that we were looking for Which were the two statements here? And then the application is actually still running now while that's running. Let's go to a quick check Just to see it visually And as you can see here's the application I'm basically running right with version 13 And basically that's it at the end of the day. What's going to happen next is the system Well, let's see the pipeline will then run plume. We destroy and all that infrastructure as I mentioned earlier You don't want to leave that lingering collecting debt and and also being available there for maybe some security Uh Problems right or concerns. Uh, so I want to thank all of you for um Showing up to this talk and if you need to reach out to me my twitter handles punk data And again, um, thank you for for attending the talk and I hope that we found it useful