[MUSIC PLAYING]
ABBY CAREY: Hi.
My name is Abby Carey, and I'm a developer advocate
for Google Cloud DevTools.
And I'll be talking about maximizing developer
productivity with Cloud Code.
So what are some development challenges developers can face?
One would be repetitive context switching.
You might find yourself bouncing between a quick start
guide, three documentation sets, your code
editor, and your terminal, and your debugger
just to get your project up and going and testing it out.
Then there's getting started with GCP,
which can be intimidating.
You don't know where to start, and you
can get overwhelmed by the docs we throw out at you,
which is quite a bit of docs.
There's a lot of content.
The products we support can also be complex,
a big one being Kubernetes.
And quite a few of our products require YAML configuration
files.
You probably don't like dealing with YAML.
You want to focus on your code, not configurations.
So these issues I mentioned usually
happen in the inner loop, seen on the left here.
You're probably familiar with this process.
This is your day-to-day as a dev.
You code up a feature, build it, test it, find a bug,
and then rinse and repeat over and over again
until your feature's looking good
and you're ready to get into the outer loop
and then ship it out to the world.
But how can we make these development challenges
a bit better and improve your productivity?
Well, that's where Cloud Code comes in.
Cloud Code is an IDE plugin that automates development workflows
for cloud-native applications.
This plugin is composed of a bunch
of tools that can assist you in a variety of workflows for GCP.
It integrates these tools right into the UI of your IDE.
And these tools automate repetitive
processes seen in your inner loop.
Overall, it's here to save you time
and make you more productive.
And looking back at this picture again,
Cloud Code is all about focusing on the left-hand side here.
So who can use Cloud Code?
If you're developing Java, Python, Go, or Node.js,
chances are, we got you covered.
We support PyCharm, IntelliJ, GoLand,
and WebStorm from JetBrains, as well as the popular Visual
Studio Code, and more recently, Cloud Shell Editor,
which allows you to use Cloud Code in your browser.
So what are Cloud Code's features at a glance?
First of all, it lets you build, push, and deploy services
to Kubernetes and Cloud Run.
It has a simple UI, so it's easy to rinse and repeat.
It also allows you to debug Kubernetes and Cloud Run
services with the same UI of your IDE that you're used to.
All you got to do is place a break point and then hit Go,
and you're debugging your Kubernetes or Cloud Run
services.
It also handles complex tasks, like port forwarding, for you.
Then there's our watch mode feature.
This triggers rebuilds and redeploys
when code changes happen.
All you got to do is code up your change, hit Save,
and then it triggers that rebuild and redeploy,
speeding up your development time overall.
Then there's Cloud Code's most popular feature, which
is YAML authoring assistance.
You get YAML snippets, linting, syntax highlighting,
and on-hover docs for over 400 resource types.
And finally, there's easy API discoverability,
with the ability to quickly enable and get documentation
that you need right from your IDE.
So what products does Cloud Code support?
We support every product, in a way,
because Cloud Code has an API Explorer where
you can enable and get the docs for all of GCP's APIs.
We also have YAML authoring support for the big ones,
like Cloud Build and Kubernetes.
And we have UI integration for three GCP products,
including GKE, Cloud Run, and Secret Manager,
which means we give them their own dedicated panels
within your IDE.
So focusing on Cloud Code's Cloud Run features,
Cloud Code helps you ramp up fast
on Cloud Run with integrated samples
that show best practices.
You can also locally develop an emulated Cloud Run
environment with just a click and view the logs.
This is great for catching issues
in a production-like environment before it actually
has to go to production.
And once that's ready and looking good,
you can deploy to Cloud Run with just a couple clicks.
And finally, you can view your services
and their properties all from your IDE.
But let's look at this in a demo.
All right, so this is Visual Studio Code
with Cloud Code already installed
from the IDE Marketplace.
And you can tell, because to the left,
we have a stack of four icons corresponding
to the big workflows for Cloud Run and Kubernetes, et cetera.
Down below, we have the Cloud Code status bar.
And when I click it, I can create a new application.
I can pick between Kubernetes, Cloud Run, or a custom
application.
But today, I'll use a Cloud Run application.
And we get a variety of languages
to pick from for our starter app,
but I'll pick a Flask Python example and clone it.
So this is our example, ready to go.
There's a Docker file included, so it's
ready to be containerised.
I also have a requirements.txt file for any packages I need.
Yeah, so let's run this in the Cloud Run Emulator.
I want to test this out locally before deploying to the cloud.
The Cloud Run Emulator-- as I said earlier,
it's a production environment to test out my service.
I'll go ahead and click Cloud Code status bar button,
and then Run on Cloud Run Emulator.
And then from here, I can configure my service,
including container properties.
I will set Dedicated CPUs to 1 virtual CPU to better emulate
running on Cloud Run.
And then I can also switch the Environment Variable tab
and specify environment variables
for my service, and Cloud SQL Connections,
if I'm connecting to a Cloud SQL database.
Down below, I can pick Build Settings.
I will be building with Docker, but I could also build
with Buildpacks if I wanted to.
And then there's also Advanced build Settings
if I pop open this section here, where you
can specify build arguments.
And then there's a checkbox down here
for automatically rebuilding and rerunning on changes.
So this is that watch mode I mentioned.
And I'll leave it on, because I want to show you
the iterative development.
So right now, we are building and then we will be deploying.
But let's check out the detailed view here.
I can see everything going on behind the scenes.
And then I will switch back to the normal view.
And we can see that the service has been deployed to localhost.
But instead of clicking that URL,
I can also click the Cloud Code status bar button.
And from here, I can Turn Off Watch Mode,
Open my Deployment Logs, or Open the Service URL.
I'll Open the Service URL.
And here is my service running in the Cloud Run Emulator.
But what if I want to test out iterative development?
I want to change this--
It's running!-- string to something else.
So I'll minimize this for the moment
and then I'll open app.py.
And I will find that string and then update it to something
like, This is my service.
Yeah, that looks good.
And I'll hit Save, and that will trigger a rebuild, as you
can see happening below, and then, finally, a redeploy.
And we've got that service URL.
So I'll go ahead and refresh my service.
And this is my service.
That string just updated.
That was a look at iterative development with Cloud Code.
So I'll go ahead and close that out and stop this.
But now I want to test out debugging.
All I got to do, I'll place a little breakpoint right here
on line 16.
Go to the Debugger pane, and hit Play.
And I sped this up a little bit here,
but we've specified where we want to debug.
And I will go ahead and open this up.
And when I open up my service, it's kicked off debugging.
And now I will just step through the code a little bit
here so you can see what happens.
You can see the variables coming up here.
My message is, This is my service.
I got my service name.
You can also see stuff going on in the call stack.
And I'll play to finish that up and disconnect the debugger.
So this is looking great, and now I
want to deploy it to Cloud Run.
So I'll go ahead and open up the Cloud Run Explorer.
And here, you can see I already have my project set,
and I have four existing Cloud Run services.
But what if I want to deploy a new one?
So up above, there is a little Cloud button here,
and this will allow me to deploy to Cloud Run.
I could also deploy it from the Cloud Code status bar,
but we'll go this way.
So I have the option to create a new service
or deploy a revision to an existing service,
but I will create a new one.
And then going down, I can select my deployment platform.
I will be going to Cloud Run fully managed,
but we also support Cloud Run for Anthos.
Going down more, I will allow unauthenticated invocations
of this Cloud Run service.
I can specify a service account if I want.
And you'll see those advanced settings
that you saw when I was setting up the Cloud Run
Emulator for local testing, including environment variables
and Cloud SQL connections.
And this time, for build settings,
I'm going to switch from Docker to Buildpacks,
just because I can.
So this is if you didn't have a Docker file,
we could use a Buildpack.
And I've sped this up a little bit,
but we are building and deploying.
And in the Cloud Run Explorer, you
will see hello-world-1 pop up.
Yep, so our service has deployed,
and we're given a little URL to the right here.
And I will open that up.
And this is our Cloud Run Service running in the Cloud
on Cloud Run.
So back to the Cloud Run Explorer,
I can open up this hello-world-1 service here.
And I can see my existing revisions.
I only have one right now, so 100% of my traffic
is going there.
If I open that up, I can see the properties of my revision,
including how much traffic is coming to it, its container
port, and CPU allocation.
And if I close that--
and I can right click my service and easily get
the URL of where it's deployed to.
And I can deploy a new revision with this little Cloud Code
button, or view my logs with this button here.
So that was a look at Cloud Code's Cloud Run support.
And I encourage you to download Cloud Code and give it a try.
And join our Slack community if you have any feature requests
or questions about Cloud Code.
[MUSIC PLAYING]