 Hello, everybody. My name is John Hammett. Welcome back to the YouTube video. And in this video, I want to show you a little bit of CircleCI. I want to show you just how easy it is to be able to test and prepare some of the code that you're writing within your projects with a easy continuous integration pipeline like CircleCI. So if you aren't aware or you haven't heard of much of CircleCI, you can go check out their website, CircleCI.com. They have an awesome documentation that's set up with, if you've never heard of what CI or CD or what those acronyms are, if you've seen them around in the industry, it tries to fill you in just a little bit. What CircleCI wants to do is help automate this process of continuous integration. What it means is that when you push your code or your software to a repository like GitHub, GitLab, or Bitbucket, what CircleCI will do will automatically take some of the configuration that you've defined and be able to create a whole machine, maybe a virtual machine or a container to be able to run that code, test against it, and make sure that everything is smooth sailing and it's actually functioning the way that you want it to function. You can obviously orchestrate that however you want. You could make it just run tests or maybe save some records or logs that you could review later or anything that you might need to do. It has a nice diagram here that I want to showcase to you guys and you can certainly check out this page. This is CircleCI.com and they're about CircleCI. It's in their welcome section, just the introduction. One of the best things about CircleCI that I really liked and I've actually kind of been tickering with for a little bit is that when you create any machine, or once you've built any container or virtual machine spun up to actually verify your workflow or that pipeline, you can SSH or secure shell right into it so you can actually manage, debug, troubleshoot any of the code that you've already got set up and that's pretty cool. So I'm going to end up using this and showcasing it with GitHub and they talked a little bit more about continuous integration. If you want to read through if I haven't done a good enough job of explaining it, but the best way to check it out is actually do it ourselves. So I'm going to be trying to move through the Hello World on Windows documentation guide to showcase this and I actually want to be able to use that to talk a little bit about CircleCI and how they do this with Windows. I think that's one of their greatest selling points is that they can they can spin up a quick Windows server like literally Windows Server 2019 and help you craft maybe a C sharp application, some net stuff that you're writing or anything either with PowerShell or even other languages, you can move into this machine with bash. And that's pretty cool. You got a little Linux functionality in there as well. So to get started, what we need is an account on CircleCI. And I will go ahead and click on that link and see where it takes me because what I want to do is I want to sign up with my GitHub account. So I'm going to move into GitHub, hit that link there and it'll ask me to select organization. I am none of these people I am in fact John Hammond. So I'll go ahead and click on select there and it's going to load all of my repositories and projects with my GitHub account. You might need to create some other accounts or sign up and register if you haven't already or authenticate. I think I'm actually logged into GitHub right now and that's why it didn't prompt me for a password. But last pass is pretty great. And that's why I use that. So what CircleCI needs is a repository or an actual kind of project that you can work with and you actually want to pour into CircleCI or let that kind of use and work with. So let me go ahead and create a project that we can actually work with. I'm going to create something that I'll just call Circle. That'll be my repository name. I'll be this is a test bed for CircleCI. And I'm totally fine with being public. Let's just go ahead and create that repository here for us. Okay, now I have this CircleCI project. What I'm going to do is I'm going to create that directory. I don't know if I actually still have that. I do. Okay, so just for my sanity check, let me clone this repository. And now I have that CircleRepository just accessible on my computer. Okay, now let's continue working through what CircleCI will let us do if we add this project. Now, if I refresh that page trying to add projects, you can see it here over on the left hand side. Add projects with that button there. You can hit set up project and it will bring you through everything that you need to do. Honestly, this is super duper like, I don't know, very, very easy to use. It's very user friendly. It tells me right here in the root of your repository, create a folder and add the config.yaml file below. So the file path is dot CircleCI config.yml. This will make our webhooks listen for any updates to your work. Okay, and it'll just give you that syntax. You can go and slap that in. Looks like there's a drop down here. So we can specify anything else that we might want to use. We can actually check out some Python information. And there's some of the syntax that they use there that we'll dive into in just a second. Or PHP or Ruby, again, dot net, anything that we want to talk about earlier. Let's just go check out that Hello World page. So that way we can see really what CircleCI expect us to do. If you try and click start building before you actually create that file, it'll just say, hey, are you sure? Are you ready to go? Did you actually create that file? Because you literally need to do that. That's what that's what it's telling you to do. Create this file path of dot CircleCI config.yaml or YML, and then we can click start building. If you don't, you can just say start building steamroll right through it. It'll fail. It won't know what to do. If something went wrong, which is not a very helpful error, but it's totally telling you literally I've given you two warnings now you need to create this file. So let's go ahead and create a directory. I'll make that period or dot CircleCI, just as it asks here, I'll move into that directory. And now I'll create my config dot YML file. I'm just gonna use nano because I want to just slap this in here real quick and easy paste. Great. I'm going to go ahead and add this to the repository now I'll do get add get commit. I'll say added the default welcome config. I'll go ahead and push that to the repository entering my credentials in here so it will spin up there on to the interwebs. All right, now that that is done. Now I can say start building and it'll say like, yeah, let's do it. It'll also offer you a downloaded back config dot YML stuff. You can see a lot of my tests here that I've been bumping around in my super specific commit messages. I said added thing updated thing added a thing. That's pretty much what all of my commit messages look like. I'm just kidding. So what we can do now is actually just continue to work with our repository, write our code, build our product and project, whatever we would need to do. And circle CI would just sort of patiently wait in the background for when we push to our repository, it'll go ahead and test some of that code. And I'll show you what that welcome config is right now. Let me just go ahead and create a simple file. We'll just add a little read me into our repository just to prove a concept to be like, hey, testing circle CI. I'll just throw some lines in there. Basic information. Wow, I can't type whatever this is just filler. It's not even 2019 anymore, John. What are you doing 2020? Cool. Good videos. Good content. Good, good YouTube added to read me. You can tell I am fun. Let's go ahead and push to the repository. And let's go ahead and see what circle CI will do. If I go back to this web page and I hit refresh. Now we can see we have one job or kind of a little pipeline running for us. That status there it's in the welcome workflow. And that's the one that we just kind of created with our config. You can see my commit when it came through. And the branch that was on and we can actually zoom in on that if I just kind of move that dropdown I can see really what we're looking at and that welcome forward slash run. So we got a lot of stuff here we got a lot of output. This says we spun up the environment and you can click and zoom in on this. And this will tell you some more of the actual technical details of what was going on. We're using Docker kind of in the back end. That's what Docker or that's really what circle CI is using for us. It tells us the kernel version we're pulling stuff up. We pulled down a file system or an image that we needed. And then we created some environment variables that were being pulled into the image. And now we can use that to run our machine or the container that's actually working with our code however we want it to. It says congrats. These are all other messages that kind of have come from this specific Docker or excuse me a circle CI pipeline that we chose in that simple config file. And I'll show you some of the technical details as to really what that means or how that happened here. It says you successfully connected circle CI with the repository and ran your first successful pipeline. We actually did this by processing that config.yml file that we just spat into our repository. Once you click start building circle CI spun up a clean container installed the environment using a Docker executor and a custom welcome config image. And then circle CI execute the steps specified by the run job that we can see in that YAML file and it will print out this text the console. This happened automatically because we created that little webhook with our config.yml file and circle CI would have automatically added some SSH private keys or public keys really just connectivity of accessibility within our repository. And we could see that if I actually pull up the email for us from now on circle CI will automatically trigger and run when any member of your project pushes code. So it doesn't have to just be me this can be everyone else on your team everyone working on that repository. It'll process that YAML file configuration file one more time and run a pipeline of your configuration. So that config.yml file is really going to be our one stop shop for everything that we need to do with circle CI. Now we could check out what the next steps are to see what else we can do to learn about this stuff. Now that we have successfully connected our repository we can see where you want to go next to create your own CI or CD configuration. We could check out our do first understand later section. And we could actually see any of these other options here. This tutorial section will explain a little bit more of those other executor types again on Linux or maybe iOS or Android if you're interested in that I will be showcasing a little bit more of the windows section though. So let's keep moving through that they talk about a little bit or jobs steps and workflows are what we want to discuss next. So let me go back to that documentation that we actually have here now that we've set up the account we've actually got our repository all created for us. What we could do is check out the windows executor and you've heard me say the word executor before but what am I actually saying when I say that right. The windows build environment or the executor. That's just how they're building everything that's happening within this virtual machine or the container here. It gives the user the tools to build a windows projects such as a universal windows excuse me universal windows platform application. A dot net executable or anything windows specific what that includes what that really means is that we have a virtual machine really set up fully intended to just guarantee that job isolation. So there aren't any other environments that are having information or artifacts kind of bleeding into what we're working with. It's using server core of the windows server 2019 data center edition. That's kind of cool. I like windows over 2019. That's the latest stuff. It also has four CPUs and 15 gigabytes of RAM. So by default power shell is the show we're going to end up using but bash and cmd.exe are also available and we can select those. And of course we're using Docker kind of in the background to orchestrate some of the stuff. It says in here windows executor does not have support for Docker layer caching. I'm not going to deep dive into that just yet. I just kind of want to showcase how we can get this up and running and doing some interesting things. Only the windows executor currently only supports windows containers. So running Linux containers on windows is not possible right now. That's OK. Right now we're just going to be kind of tinkering around with what we can do with our windows code. So we've already discussed this has a windows server 2019 with Visual Studio 2019. So you can do some stuff with that dot net executable. If you want to check out more of the actual contents that are including that image. They have a list of installed software that is down here at the very very bottom of the document. I will kind of mention that as we get closer to it. But let's go check this out. There are some known issues that are kind of coordinated with this that Circle CI is pretty transparent about. This one isn't all that bad honestly and we'll see it very soon when we connect. It says connecting to a windows job via SSH and using the bash shell results in an empty terminal prompt. Whatever that's totally fine as long as the shell still functional. It's kind of like a basic we might know it as like a reverse shell for some of the other stuff that we do. So what we have here is an example configuration file. And this is again that Circle CI config dot YML file. This is actually interesting because now we can look I'm going to zoom in on some of the syntax here. I'm just going to like slap copy and paste the code here. What they're using is version 2.1 and that's one of the latest versions of Circle CI. It actually enables us to use orbs and that is a cool terminology and lingo that's actually going to allow us to pull down other images and work with specific things with our Circle CI pipeline. If you actually check out that orbs definition we're using one that we'll just call win and it's pulling the Circle CI windows 2.2.0 orb. That windows orb will give you everything you need to start using the windows executor. And now all of these jobs that are kind of specified within that syntax will actually have us do specific things with an executor that'll allow us to run commands or run code or do things. We can call that job whatever we want in this case it's just build and we'll specify the executor that we want to use. In this case we'll just use the win default when being the name of the orb that we pulled from. That's just kind of like a variable name that we're using here in the default executor type. Now we have a bunch of steps that might end up doing something inside of that actual executor. Check out is one that we can actually run as a command and it will run a power shell syntax your right host hello windows simple stuff and they explain we are using that version 2.1 syntax. If you're using server that is a little bit of a different kind of setup here I'm not going to just particularly touch that will stick with just kind of the basic cloud implementation of Circle CI. Now we talk about those shells that we can use within windows and that continuous integration that we're doing power shell is the default in the windows orb that we're pulling from we could also use bash or cmd.exe. We could also configure any other shell that we want and you could use how whatever shell that you want in the same job when you're trying to run different things. So they showcase some example code here where we're literally doing some commands in power shell and in bash and in cmd.exe all super primitive rudimentary stuff just displaying hello world under the screen but whatever it works just fine for us. They actually show some example syntax here where they're actually installing another shell that you could use power shell core in this case and they pull it down with the dot net CLI command. I'll actually take that syntax and we'll use it very very soon. That's what I kind of want to use as kind of a demo to showcase some stuff we're working with. They offer an example application here but I don't want to go through that. I kind of want to break down the syntax and kind of the language that Circle CI uses for the stuff that it's doing in the documentation. They are going to show just a simple introductory hello world application. I feel like we already got that when we use that welcome orb earlier but I do want to go through this and kind of explain the syntax with their showcase in here. Again they discuss the version 2.1 that's necessary for using orbs now and orbs are super duper cool. Let me kind of zoom in on that just so you get a better idea of what that concept is orbs are essentially kind of the best parallel that I like to draw in my mind is an already built already crafted and created image that you pull from much like we're used to this. And I feel like at the very very back end that's exactly what they are with just a couple more bells and whistles here. They say use orbs don't reinvent the wheel import pre built commands jobs and executors into your configuration file. If you want to learn how you can create orbs they explain that here and some other documentation but I just want to show you some of these that you could just pull from and use again a lot like docker images in the docker hub. If you scroll down here they have some stuff with AWS they have some stuff with Azure have again docker and maybe some Heroku stuff or perhaps Python PHP Ruby other languages that we might want to use an experiment with. And you saw me tinker at that earlier when we had that a build project thing when we were just getting started. So that's very very cool but even the syntax you can tell hey this looks very Docker like you're just pulling an image that has already been crafted and created that you can take advantage of and use some stuff that's already built in. Super awesome super easy saves you a lot of time as a developer and actually writing your project not trying to recraft something that is probably already done. That's what don't reinvent the wheel is all about now looking back at their config file breakdown. You can see we have chosen that windows orb that's coming from the circle CI kind of default setup here and we can create some jobs that will actually be executing things with a windows executor. And we can specify what shell we're going to actually use to run these commands and now you'll see that checkout command that we saw previously. What that does is just pull our source code from the version control system or GitHub or all repository in that case. What they do in this example is actually taking use of some of the caching capability that circle CI has that allows you to actually grab the dependencies that have already been kind of pulled together and created in our previous builds or previous workflows things that we've already done when circle CI was testing and doing the continuous integration for your code in your project. That's pretty cool. And actually I don't think I'm going to touch on that in this video again showcasing the simple rudimentary stuff. I do want to showcase how we can SSH into our built container virtual machine whatever name you want to call it in that case. I'm going to use I'm using those terms synonymously as you've probably could tell throughout the entire video. Now let's go ahead and create something with some of that code that I copied and pasted earlier. I'm just going to move in that circle CI directory. I'm actually going to go ahead and clear out the config.yaml file because I'm going to create a new one with that syntax that we had just over in that documentation page. We've already discussed the syntax here the version that we're using the org that we're going to pull down. We are using checkout to grab some files and things from our actual repository here. I'm going to use that dotnet tool to install a PowerShell shell here that to that PowerShell core and I can run pwsh and then let's create a script which we can have do or create anything. It could compile our code. It could run it. It could test it. It could go ahead and it could literally do anything that we want. And that's kind of the benefit of this. We're on the fly creating a virtual machine or container to work with our project. Let's go and create something. I'll just call it proof of concept. That makes more sense than just the word proof. So let's go and create that. It'll be a simple script. It's going to live in the root of our GitHub repository not inside that dot circle CI folder. That's just going to be where our config file is. But let's go and create that proof of concept dot ps1. Now I have a PowerShell shell or a PowerShell script that will be ran in a PowerShell shell and I'm going to do something weird. This is gross. This is bad, but this is what I did just to kind of explore. I use CMD within my PowerShell to run a simple. Hey, let's go ahead and echo anything to a new file dot text. I use that greater than symbol of the walk a walk to redirect that output into a new file. But that would work just fine for me because because I'm in a sub shell now PowerShell calling CMD with that simple string kind of as a command to run. That can use that greater than symbol and work just fine for me. So that would work. That would do it. Let's go ahead and try and add this because now we have our dot circle CI config dot YAML file will go ahead and run our proof of concept dot ps1. And we have created that file just now. Let's go ahead and add it to go ahead and commit it and let's say added POC and let's go ahead and get push. I'll enter my credentials in here real quick. And there we go. If I help over back again to circle CI of I go to my pipelines. Now you can see I have a new thing trying to work. We can see that build. Let's go click on it. We can see it has already spun up the environment. It checked out the code from the repository. Now it was installing PowerShell and now it's running that proof of concept script that we created in our repository. Let's go see what we got. Okay, looks like that ran. We didn't have it actually output anything to the screen so it doesn't show anything here. Looks like you receive an exit code of zero. So that was probably a success. So somewhere in that virtual machine in that container we do have a new file dot text, but it doesn't exist anywhere else. It's not in my repository. It's just inside the container because that's what we told the container do was to create that. So now I really want to go see that file or maybe interact with it in a little bit. So I want to go check out how we can SSH into our build. It says what we need to do is make sure we have an SSH key added to our GitHub or BitBucket account. So I don't know if you guys have done that before. I don't know if you've made that or if you've actually had that set up. You could see when I was manually typing in all the credentials here when I was pushing and pulling or whatever I needed to do to my repository. It had to ask for credentials because it didn't have my SSH key set up and installed. What I'm going to actually do is show you how we can do that. I'll go to my CircleCI repository. We can go into the settings, but actually that's the route that I would think to go. Apparently you're actually adding this SSH key to your account. So if I go over to my sign in as John Hammond, go ahead and go to my settings. Down here I have my SSH and GPG keys. I actually have one already created. I added this just for my testing purposes, but we can go ahead and delete that and I'll show you the process of adding a new one. Great. Now that I've deleted that SSH key, let's go ahead and create one here. I will go ahead and remove that dot SSH ID, RSA, my private key. I don't use that for anything else right now, so don't be alarmed that I just deleted my private key. But the command is SSH hyphen key gen. You can just whack enter on that by default. It'll want to put it in your dot SSH config in that ID RSA private key file. I don't need a passphrase. I've created that now. So now I can go ahead and see what my public key is ID RSA dot pub. Now I have that syntax that I could copy and paste for my SSH private public key. That way GitHub will be able to actually associate that with what I'm working with here. Let's go and add a new key. I'll add my SSH key and notice that GitHub will tell you this should begin with an SSH hyphen RSA so I can kind of paste that in there. Add my SSH key now that that's created. Now what I would want to do is go ahead and make some changes to my repository added SSH keys just as a thing here. Let's go ahead and get add and get commit. Okay, added SSH key. That's not to the repositories. That doesn't make sense. But why do I still have to enter my credentials when I added my SSH key? That doesn't really help me. That's not what I wanted to do. I just want to automatically push because now the SSH authentication is there. And that's what I need to SSH in my circle CI container that virtual machine. So this is what's happening because I clone this repository with HTTPS. If I want to clone this with SSH, we'd be able to use that key very, very easily. So what I'm going to do is actually move out of my repository, delete the entire thing. I'm removing the repository. I'm just going to clone it one more time. That isn't a bad thing that I did that because that repository is already out there in GitHub in the cloud. Now if I refresh that page, I could clone it once again. So let's clone or download. And now I have that clone with SSH option. You might have seen that clone with HTTPS option come up first. But we do want to use SSH. You can click that button over there, just the blue text. So copy that. And now I will get clone with that syntax. And because it has that SSH key set up. Now if I move in a circle CI to move or that repository like created just circle. That is SSH key cloned properly just making some changes. So I can go ahead and get add, get commits added new thing for SSH key. I can get pushed this and I don't need to enter my credentials now because I've done that. I could SSH into that machine that's created on circle CI. Let's go check that out. If I move back over to what has been created in that workflow, you can see to start a job with SSH enabled. Go ahead and select rerun job with SSH and that option from the rerun workflow drop down menu. Okay, let's do that. So I see that rerun workflow. I guess I won't let me do that because that's not the latest. We have this one running here. I can cancel this workflow. Or it already finished. Totally fine. Let's go click on that. I'll click that hamburger little vertical buttons icon and I'll hit rerun job with SSH. Okay. Now that that's queued in just a second, it will go ahead and run again. You can see it's spinning up the environment giving us all that debugging information that we might like as developers. The environment has already been spun up for us. Okay, I stopped the video just to take a little bit of time. Now it has set up this entire container for us with SSH enabled. If I were to actually click on that, it says, hey, you can now SSH into this box if we've added our SSH public key, which we just did. So we could SSH with bash with this syntax right here. I'll go back to my terminal, paste that in here and it wants to know, hey, is this the proper host that you want to connect to? Yes. And we are in fact connected because remember that known issue that said, hey, when you're connecting with the bash shell, you don't have an immediate terminal prompt. That's okay. We can still go ahead and hit who am I or circle CI or ID, whatever we particularly want. It's interesting we can still run our Linux commands on this Windows system, right? We can go ahead and hit LS, or dir as you might expect. And you'll notice we have some interesting things. We actually have a project folder. And that is where all of our code exists. Let me before I jump into those let's check out that cmd.exe connection. Again, I'll do the exact same thing. Now we're logged in with cmd.exe. I can still run LS and do things like who am I or ID, some Linux like commands, which is interesting to me. And we have that power shell shell, which is again, usually the default. I haven't been able to actually tab complete or do interesting things. But if I were to move into projects, you can see that tab isn't working for me. Okay, let's CD into project. If I were to dir one more time, you can see I have my read me dot md file, our proof of concept dot ps one and our new file dot text. We can actually cat out that new file dot text. And it says anything just as we expected because that's what our proof of concept dot ps one script had us do. Now take note, because we're living inside of this project directory, that project directory only lives inside of your repository through the lens of this virtual machine or container. Like when we were writing our dot config YAML file, let's move into that dot circle CI cat that config dot YML. You'll notice that we aren't using dot forward slash project slash proof of concept. In our case, when we're creating that config dot YAML file or that YML file, it's still all the root of our repository, not with that project name. That's only within the virtual machine or the container that we create here. So that's that that's pretty cool. I think that will allow you to test some of your code or do anything that you wanted to with the quick on the fly built, hot swapped and hot fixed virtual machine and container to work with your project and your code. I think that's pretty cool. Now that we've sshed in, we've made some proof of concept code to see how we can use circle CI. You could if you wanted to read a little bit more about this, you can check out some of the concepts. Read a little bit more about the orbs and the jobs and the workflows that maybe I haven't gone all that in depth on. Really, I just wanted to get your feet wet kind of wet your appetite for this stuff. And maybe some of that software that's already installed in the windows image is kind of cool for you again. We've got bash CMD and PowerShell five in there. We saw some of that dot net framework and Visual Studio so we could use that dot net executable. Of course, we've got Docker and thought it was interesting. We actually have jq in there and you could you could literally just run that me ssh back in there with PowerShell. You could still run jq. And maybe you've seen that to process some JSON or the JavaScript object notation. Yeah, yeah. So cool. Hey, thank you guys so much for listening. Thank you guys so much for watching this video. I know this was a long one, but I hope it was cool. I hope to really like circle CI. I hope you can see how much power this really has how much you can really do. With continuous integration. I just gave you some small, small little tip of the iceberg stuff to see you can execute code in a virtual machine that spun up automatically just from you pushing to your repository. And maybe you could build that to run your software compile your software really test log archive and anything that you want with your project. So that's super cool. Thank you guys so much for watching. If you did like this video, please do hit that like button. If you didn't like it hit it twice. So you let me know like really hard. Man, I hated that video so much. I'm gonna hit it twice. All right. Thank you guys for watching. Love to see you on Patreon. Love to see you on PayPal. Love to see you on Discord. Love to see you on Facebook. Love to see you on LinkedIn. Love to see you on Twitter. Love to see you on YouTube. Bye.