Hi, everyone, and welcome back.
Now, in today's video, we are going to discuss about the basics of a code build service.
Now, in order to understand this service, it is important for us to understand the basics of the build
and the compilation processes.
Now, whenever you write a code in various languages like Java C and others, generally, one of the
next step is to compile the code.
For example, this can be better explained in this diagram where on the left hand side you have a code.
So this is a C based code and in the print you see Halo.
So basically when you run this specific build, it will print.
Hello.
So generally what you do after you write this code, you compile the code.
So compilation is the next step and then you get the executable.
And this executable, when you run this executable, it performs the function that you have defined
in this code.
So in this specific code, what it will do if you run this executable, it should print.
Hello.
All right.
So the output of the compilation is the binary that is executable.
So this is basically at a high level overview, the compilation process.
Now, before we proceed further, let me quickly show you this practically.
Now for today's demo.
I have a simple code based on C as we're discussing it Prints.
Hello.
So let's copy this code.
I'll also be adding this after the video so that you can reference to it.
Now, for today's demo, I have launched a new easy to instance based on Amazon Linux and this is where
we'll be testing things out.
Now, currently I'm logged into the instance over here and within.
Let me quickly create a file college demo dot CPP, and within here I'll paste the contents of our code
over here.
So this is the simple code.
Now, this code by itself does not do anything.
So what we need to do, since we need the binary, we'll have to go ahead and compile this specific
code.
So in order to compile it, you need a software of C++.
So currently it's not available.
So from the easy to user, let's go ahead and see from where we can go ahead and download the appropriate
packages related to this.
So C++, in fact, let's do one thing.
Let's do a yum.
What provides C++ so that we can get the exact package, which is DCC hyphen C++.
So let's do yum y install followed by DCC hyphen C++.
So this will go ahead and download the latest packages.
All right.
Once this is done, you can run the G plus.
Plus you can specify the file where your code is present, and you can specify the output file where
the executable will be present.
Now, if you do a look over here, you see you have this specific executable, so you can consider this
to be your application.
Now, when you run this specific application, in this case it is showing hello.
It can be a complicated application as well, but in this case we have a very simple application that
prints hello whenever you go ahead and run it.
All right.
So I hope at this stage you understood the basic compilation process.
Now, generally in the organizations you will see that developers, they generally commit their code
to the central git repository.
Now for the build process that we had just demonstrated, the code was present in the EC two instance
and in the AC two instance itself, we performed the build process using C++.
However, as we're discussing in organization generally, you will see that the developer commits that
code to the git repository.
So in this git repository also I have a file called Escape Labs dot CP.
So this is a code commit based repo.
And again in this file I have similar contents which goes ahead and it prints certain text columns.
Hello.
Now generally since this file is not present inside the server, it is present in the git repository.
And if you want to get the executable of this specific file, then as we know we need a compiler.
And this compiler that we're discussing is where the code build service comes into picture.
So at a high level overview code is a fully managed continuous integration service that compiles the
source code, runs test and produces the software packages that are ready to deploy.
So as we're discussing in this diagram, you have a code build service.
This code will service references to the code, whatever code that is present.
It can be in various locations like code commits.
So code will can fetch the code from code, commit it can compile the code and the output build we had
seen on how the binary is outputted after compilation completes.
So this output build code build can save to various locations like S3 bucket and so on.
Along with the compilation process code, we can also perform various things like it can run certain
number of tests on the specific build.
And based on this it can also give you the results.
So apart from compilation, it can also run test and various other things.
However, compilation is the primary aim of the code build service.
Now for today's demo, I already have code build service that is configured.
Now.
Note that this is a demo video, so the aim is to understand the code will service.
We are not going ahead and we are starting practical from scratch.
All right.
So I already have code build configured Now.
If I quickly open this code, will you'll see that the primary repository is demo git, repo demo get
repo is nothing but the code commit git repository where code is stored.
So if we'll quickly see our demo git repo has a file called skip elapsed CP, which is nothing but a
code that displays hello world over here.
So as we know that for the code to compile the code, it needs to first fetch the code.
So since the code is currently stored in a code command repo for today's demo, our code service is
configured to fetch the code from this repository and the output build.
Whatever build that it generates, it will go ahead and it will store that build into this specific
artifact upload location.
So similar to how when we compile the demo CP file in the output, we got a bill of my hyphen app.
So this binary event runs the application runs so this binary gets uploaded by the code will service
to a S3 bucket.
All right.
A very simple workflow.
So once this is done, let's go ahead and start the build.
Great.
So after a minute, our build has been successful, so the output binary of this build should be currently
available in S3.
So let's quickly explore that.
Now within our S3 bucket, you see a new folder of sample code which has been created, and in this
folder we have our binary code as my app.
And when you run this specific binary in a Linux operating system or any supported operating system,
the output should be Hello world.
So that's the high level overview.
And with this will conclude today's video.