SPEAKER: Hi!
In this sample, I will demonstrate
how to use the Apigee Maven deploy
plugin to deploy a proxy from your source code
to Apigee using Cloud Build.
Apigee Maven plugin is a tool for building and deploying
the Apigee API proxy bundles into your Apigee platform.
And Cloud Build is a fully managed continuous integration,
delivery, and deployment platform that lets you run
fast, consistent, and reliable automated builds.
Now, the prerequisites for this sample
are you should have an Apigee X provisioned
and configured external access for API traffic.
As a user, you will need access to deploy proxies to Apigee,
and also trigger a Cloud Build job in your GCP project.
Along with that, you will need to have
tools like gcloud, unzip, curl, jq, and npm installed.
Now, this sample can be demonstrated
using the CloudShell QuickStart tutorial,
or following the setup instructions.
In this video, we will use the CloudShell QuickStart.
Click the Open in Google CloudShell
to open the CloudShell environment.
And once the environment is completely loaded,
let's follow the instructions provided in the tutorial.
Now that I have my environment completely
provisioned and ready to use, let's
follow the instructions that we have
on the tutorial on the very right.
Now, the first thing that we will have to do
is make sure that we have our environment set up.
For that, let's do gcloud auth login.
Yes, it's going to ask me to go through the login process.
Allow.
I copy the authorization code.
I am pasting it here.
And that's pretty much it.
Next, we'll have to navigate to the deploy-apigee-proxy
directory, which I just did.
And then I can click here to open the env.sh file.
So here are some configurations that we'll
have to update in order to get this sample deployed
to our project.
So the first thing that we will need is the project ID.
The second that we will need is the Apigee host.
This is the Apigee host--
the domain that you would configure in your environment
group, and then the environment where
you'd want to deploy this.
Now, let me replace those values on my configuration file.
And let's make sure that we save it.
Once this is saved, let's source this environment.sh file.
Now that we've done all of the required steps,
let's click Start.
Now, the next step that we will have to do
is make sure that we've enabled Cloud Build
API in this project.
So let's click this.
And click Enter.
Now it's enabled.
Now the next step that we will have to do
is make sure that the Cloud Build service
account has the Apigee Org Admin role
to deploy the proxy to your Apigee Org.
So we've enabled it through the gcloud command.
Next is triggering the gcloud build through this cloud
command where we passed the Apigee
environment that we want to be using to push the proxy to.
Now, this is going to take a few minutes.
Meanwhile, let's take a quick look at the cloudbuild.yaml.
Now, this cloudbuild.yaml is a very simple file
that first generates a token.
Second, it basically packages the bundle,
which is taking the entire code and creating a bundle,
a .zip file.
And at the end, it deploys it.
So it's all through the Maven pom
file that is available as part of the code.
Once this is complete, you should be seeing
a status that says success.
And then if you go through the tutorial again,
you will see that at the end of the Cloud Build trigger,
a proxy must be deployed to Apigee
called sample-hello-cicd.
Now, let's log in to the Apigee Console
to make sure that we see that proxy.
Yes, I see a sample-hello-cicd proxy deployed a minute ago.
Let's go back and see if the proxy is working as expected.
So we have a sample curl command here.
So let's copy that.
And let's make a few calls.
You should be able to see the calls coming in.
That explains the sample of how to basically deploy an Apigee
proxy from your source code to Apigee using the Maven plugin
and Cloud Build.
Now that we have had this, please rate this tutorial.
And if you want to clean up these particular assets that
we've just created, just go ahead and run
the clean-up-deploy-apigee-proxy.sh.
This will make sure that it goes and it deletes the sample proxy
that we just created.
You'll see that's deleted.
Thanks for watching.
I hope this content was useful to you.
If you have not signed up for Apigee yet, use this link.
And if you have any questions, please
visit the Apigee community.