-: We've now installed our Google Cloud CLI,
configured it,
logged in with Docker,
built our test image,
and then ran our tests.
So now, we wanna start focusing
on doing our actual deployment,
assuming that all the tests were successfully ran.
Now to actually do our deployment,
we're going to write a script
separate from the travis.yml file.
And inside that script,
we're gonna put in a series of commands
that are going to build our images one by one,
tag each one,
push them to Docker Hub,
apply all of our config files inside the K8's folder,
and then do that imperative set image command
for each of our deployments.
So all this stuff right here,
all going to be executed inside
of a separate test file, excuse me,
a separate script file,
apart from our travis.yml file.
Now, why is this gonna be in a separate file?
Well, I want you to recall
how we put together our travis.yml file
for the Elastic Beanstalk project,
and I'm gonna pull it
on the screen here very quickly.
All right.
So here's the old travis.yml file,
and just to be really clear,
I labeled it right here,
this is old stuff from the last project
not relevant to what we're doing right now.
So on our previous project,
we put together the deploy section,
and we specified a provider.
When we specified the provider,
that essentially told Travis
to take all of our code
and use this pre-established deployment script
that Travis maintains,
to take all of our code
and send it off to Elastic Beanstalk.
Now, Travis does not have a similar built-in provider
for deploying code off
to a Kubernetes cluster.
If we want to deploy to Kubernetes,
we have to put together our own custom series of commands,
and tell Travis,
"Hey, just run these commands for us.
We'll take care of the deployment, just run these."
So that's essentially what we're going to do.
There is no built-in provider for Kubernetes,
we have to put our own solution together from scratch.
All right.
So to do so,
I'm gonna open up my travis.yml file for our project,
inside of here,
we're gonna put together our deploy section,
but our deploy section is gonna look a little bit different
than the previous ones.
I'll specify a provider of script, like so.
So before we had said Elastic Beanstalk,
this time we're saying script,
which is telling Travis that,
"Hey, don't try to do anything with our project,
we'll take care of the deployment.
Just run the script file for us."
We then have to specify a command to run,
that's going to essentially be the script
that we want Travis to execute.
So I'm gonna say ash./deploy.sh.
So this is essentially saying
that you and I are gonna put together
a custom script file called deploy.sh.
And inside of that custom script file,
we're gonna write out a series of commands
that's going to go through all those steps
that we have just mentioned.
Building our images, applying configs,
and imperatively setting images
on each deployment.
So this right here again,
is what's telling Travis,
"Don't worry about the deployment,
just run this command for us right here,
and we'll do the deployment ourselves."
Now there is one other option on here
that we are gonna specify,
we'll say on branch master.
So remember, if we are pushing up some like feature
or development branch,
we probably don't want to execute this deploy script.
We only want to do our deployment
if we are pushing up branch master.
So only for working on the master branch,
do we want to run this command right here,
which is gonna run that deploy script file
and attempt to deploy all of our new images out.
All right.
So then now the last thing I wanna do in this section
is very quickly create this deploy.sh file
inside of our root project directory.
So inside the root project,
I'll create deploy.sh.
So again, inside of here,
we're gonna put together our series of commands
that's going to build the images,
tag them, push them, apply configs,
and so on.
So let's take a quick pause right here.
When we come back to the next section,
we're gonna start filling out our implementation
for our deploy script.