>> Good afternoon everybody.
Man, I am so excited to be here to show you guys how to
set up DevOps pipeline for whatever language you want.
Now, before we begin let me do a quick intro.
So, my name is Abel Wang.
I'm a Cloud Developer Advocate specializing in DevOps.
So, what exactly is a Cloud Developer Advocate?
That's a big old fancy title, right?
Really, what I do is I write code.
I eat, drink, live writing code.
It makes me ridiculously happy.
It totally defines who I am.
I'm that weirdo at Microsoft.
After a long stressful day at work of writing code,
the way I relax is I go back home,
I play with my dog,
talk to my wife, sit down on the couch,
pull out my laptop and then write
more code because that's what I love to do.
All right. So, some recent roles that I've had.
I've been a Process Consultant,
a Certified Scrub Master,
I've been an ALM Ranger.
I've written code with the VSTS Team.
My area of specialty is definitely around DevOps,
General App Dev, Visual Studio and of course, Azure.
Now, some fun stuff about me.
Back in the day I used to be a rock star.
Thank you. Thank you. Well, at least in
my mind I thought I was a rock star.
Apparently, I wasn't very good because instead of
rocking San Francisco with my guitar,
I'm at GDC talking a lot of DevOps. There's that.
Also, I'm a runner and one of my ultimate goals is
to run a marathon on top of the Great Wall of China.
So, I'm training really hard because I don't
want to be this guy in the red throwing up.
Yeah. Don't want to be that guy.
I'm also part of Donovan Brown's team where we are
five DevOps practitioners and
our sole goal is to help you get into Azure easier.
All right. So, DevOps for any language.
Visual Studio Team Services,
that is the ultimate DevOps solution into Azure.
And now, we've made it ridiculously easy.
To go from nothing at all to
a full end-to-end DevOps project
in the language that you picked.
So, what's in a DevOps project?
You get a team project in Visual Studio Team Services.
You get sample code
in the language that you picked in a Git repo.
You get a CICD pipeline that takes the sample app,
builds it, runs all the unit tests,
and if everything looks good deploys it all the way out
into infrastructure that it
provision for you out in Azure.
And the most amazing thing is you get all of
this with just a couple of clicks. Let me show you.
So, the first thing we're going to
do is we're going to jump into
the Azure portal where we can
create one of these DevOps projects.
Now, the first thing we're going to do is say
let's create a DevOps project.
Now, once this page comes back,
and this is my most favorite page ever,
Azure is going to ask you
what language do you
want to choose in this freaking walks?
Because we've got.NET of course, Java, Node,
PHP, and also Python,
with more languages to come.
This is living free.
We ain't your daddy's Microsoft anymore man.
Whatever language you want to use in Azure,
we're going to try to enable it.
So, right now these are the languages that we
provide with more languages to come.
Now, I'm going to go ahead and
choose.NET and I'm going to choose.NET Core.
Next is going to ask me what
infrastructure in Azure do you want a provision.
Now, we can choose a Web app,
a Web app running on a Linux machine,
we can deploy into containers
and we can deploy into virtual machines.
Now, I'm just going to go ahead and choose
Web app for Windows.
And now is going to ask me what
instance of Visual Studio
Team Services do you want to use.
You can create a brand new one directly from
here or use an existing one.
Now, I'm going to choose my demo account.
So, let me go ahead and find that. Here we go.
And let's give this project a name.
So, we'll call this "Ablegdc".
And now, we get to choose the region that we
want to deploy our resources in Azure.
We could choose South Central
but since we're on the West Coast,
I'm going to choose "West US2".
Click on "Join" and bam.
That is literally all we need to do.
We can now kick back,
relax, and just let Azure do it's thing.
Azure is now going to
create a team project for us in VSTS.
It's going to create a sample app in
the language that we
pick and it's going to put it into the Git repo.
It's going to go ahead and build out
the CICD pipeline that
makes sense for the language that we picked.
And when it's all done,
it'll go ahead and deploy it into
the infrastructure that it provisioned out in Azure.
And when you're done, you
get a portal that looks like this.
Where now you can see everything that it created.
On the left hand side,
we've got our CICD pipeline.
Where we have deep links into
VSTS for our build
or release pipeline and also our source code.
On the right hand side,
we've got deep links into
all the infrastructure that it
created for us out in Azure.
Now, let's go ahead and take a look at our source code.
We'll click on this deep link.
It will take us directly
into Visual Studio Team Services.
Were here is our Git repo.
And you can see, we've created
sample code in the language that we picked.
The language that we picked this
time happened to be.NET Core.
Let's go ahead and check out our build.
In our build, we create a build pipeline for
you that makes sense for the language that we picked.
So in this case here,
we created a build pipeline that makes
sense for.NET Core because
that's the language that I picked.
If I chose Python or Ruby or PHP or Java.
We would build you out a pipeline that
made sense for the language that you picked.
Next, we also create for you a release pipeline.
A release pipeline that makes
sense for the language that you picked.
Now today, this Internet connection is a little
slow so it's going to take
a while for us to actually be able to see this,
but when it finally comes back what you'll
notice is it's going to be able to a release pipeline,
we can dive in, and take a look at it.
And this pipeline is going to have
one environment that we deploy to.
And once again, a pipeline that
makes sense for the language that we picked.
We chose.NET Core deployed
into Azure App Service in the Azure so bam.
Everything is there ready for you.
There's nothing more for you to configure.
There's nothing more for you to
install or do anything else.
Everything just works. So now,
if we go back into our portal.
And click on our application endpoint, bam.
You can see that our app, our sample app,
has already been deployed out into Azure.
Nothing more for you to configure
or to do whatever you need to.
However, you still have full ability to
customize the CICD pipeline
to do whatever you need it to do.
So, the first thing that developers usually tell me or
ask about is that's great for your sample app,
but how do you get your code into this entire thing?
And I'll show you. Let's jump into or Git repo again.
And this right here, is just a Git repo.
So there is nothing stopping us from coming in here,
cloning this repo onto our hard drive,
deleting everything, copying my code on here,
uploading it and then it will
kick off the building and the release pipeline.
So, you can do that but there's also another way.
My actual application that I want to stick into Azure,
it happens to sit in GitHub already
so I can just use that. Let me show you what I mean.
Let's go to my build pipeline.
So, here's my build pipeline.
And when this comes up we'll go
ahead and edit this build pipeline.
Now, what we're going to
do is we're going to look at where we get our source.
And instead of using
the Git repo in Visual Studio Team Services,
we're going to say let's go ahead and
use the Git repo in GitHub.
Now, it needs my personal access token.
So, let me add my token.
I think that's my token.
We'll find out. Click "Authorize" and bam.
Now, we've connected VSTS to my GitHub repo.
So now, I can choose my repository,
which is my Mercury Web application.
And I want to build my master branch.
Just go ahead and save it. Queue It.
And bam.
Once again, I'm totally done.
Now, it's going to go get the latest code from GitHub.
It's going to build it, compile it,
one unit test and if everything looks good,
it's going to automatically deploy it into Azure.
It is literally just that easy.
All right. So, I've shown you
how you can add your code in here,
but what if we needed to
customize the building release pipeline, right?
This application that I
just added from GitHub is quite a bit
more complex than the app
that comes out of the box and our sample app.
The sample app is just a little web app.
My real app sitting in GitHub consists of three parts.
It has a.NET Core part,
but that's the Rest API that I want to run in
a Kubernetes cluster as
a docker container analytics machine.
It also has a ASP.NET web front end and
also an IOS mobile application.
So, can I take this build,
customize it, tweak it to make it build all of that?
And of course, the answer is yes
so wouldn't have asked it live.
Alright. So, the way that you
customize your builds and VSTS is just a task runner.
So, all you need to do is add or remove tasks.
Now, out of the box VSTS comes with hundreds of
tasks that you can just download and start using.
Now, if what you want to
do happens to not exist out of the box,
first thing I would do is check the marketplace.
The marketplace, our partners have created
over 500 build or release task,
download what you need.
Find what you need, download
it, and ready for that you're done.
And if you want to do doesn't
exist out of the box
and doesn't exist in the marketplace,
it is trivial to create
your own custom build or release task as well.
All that is is power show or no JS.
So, what that means is,
anything you do from the command line,
you can easily do with a custom task as well.
It really is that simple.
So, I'm not going to sit here and
drag task around that's kind of boring.
So, I'm going to go ahead and show you
what my finished build looks like.
I use one build agent.
This agent is a hosted windows agent
to build my ASP.NET Front end.
I use another agent,
and this time I'm using one of
our hosted Mac agents to build my iOS application.
And after I built my iOS app,
you'll go ahead and run
my automated UI tests in Visual Studio app center.
And finally, I use
a Linux agent to build my.NET Core Rest API.
Now, after it creates
my Rest API and compiles everything,
I need to have this be a docker image.
So, what I do is I create
a docker image, and then when I'm done,
it will take this docker image and
deploy it into Azure container registry.
And when it's done it will send it down
through the release pipeline and we
can do the same type of stuff for release pipelines.
Now, out of the box release pipeline,
it's a simple release pipeline,
but we can customize
this instead of just a Dev environment.
Maybe we want to go into QA,
maybe we would then from here we want to go into Prod.
This is just our web front end, right?
We also want the ability to deploy my Rest API,
so we can create parallel deployments.
And we'll call this my RestAPI-Dev.
And I can also create
parallel deployments for my mobile application as well.
So, once again, I'm not going to make
you guys watch me actually do that. That's boring.
But this is what my release ends up looking like.
I have three parallel deployments.
One for my web application,
one for my Rest API,
and one for my mobile application.
Now for my web app,
the task that I'm using there are going to be tasks
that make sense to deploy my web application,
and Azure app service tasks
that deploys to Azure app service.
I deploy my database schema and
then I run a bunch of automated UI tests as well.
If I go ahead and work at my Rest API.
My Rest API remember I'm deploying an Azure container.
I'm sorry. I'm deploying
a container into a Kubernetes cluster.
So, I'm using a [inaudible] task
to deploy into my Kubernetes cluster.
And finally, for my mobile,
I'll go ahead and use Azure App Service or
Azure App Center to deploy my application to my iOS app,
to my alpha testers,
my beta testers and eventually all the way
out to the app store itself.
So here you go. Three Parallel deployments
into three completely different systems
with visual studio team services,
you absolutely can do that.
Now usually, the next thing that I do is,
I go ahead and set up approval gates.
So, before and after every environment,
we have the ability to add manual approvers.
These are people that have to physically click
"approve" before it can flow through the gate.
But in VSTS, today we also have the ability to
create automated approval gates
based off of continuous monitoring.
Let me show you what I mean.
Let's go ahead and add an automated deployment gate,
and out of the box, we have
four types of gates that we can add.
One of them is a work item query gate,
that queries for work items to
determine if the gate should pass or fail.
So, one of the ways that we
use this in-house with the VSTS team,
is we do a query for blocking
bugs and if there are any blocking bugs,
bam, we stop that release right then and there.
Another type of automated approval gates that you can
add is by using Application Insights.
So, it's quering using Azure monitor.
So, we use Application Insights to
monitor your application that's running in Azure.
And if there are too many alerts, bam,
once again, we kill that release right then and there.
And finally, the next to invoke
Rest API and invoke Azure function.
These are extensibility points that you can
use to create your automated approval gates.
So, it will call a Rest API
or invoke in Azure functions and in there,
you can write whatever code you need to,
to create whatever type of gates that you need to.
So, the way that I've used this as I
was recently at a hospital,
where they had a very inteResting rule.
They were physically,
literally not allowed to deploy into
production unless they had a physical piece of
paper sign and uploaded into DocuSign.
Now, I knew DocuSign had a Rest API
that you could call to
see if the document has been passed or not.
So, what I did was I created and invoked Rest API gate,
and this is what it ends up looking like.
We first deployed into Dev—everything worked.
We deployed into QA—everything worked.
But at the end of QA
that's when I created my Automated Deployment Gate,
where you set up your gates you get to set up with
the polling frequency is going to be and
that's so how long you're going to run your gates.
So, I said let's run this gate for
48 hours and let's poll every five minutes.
So, the first time it polled,
the document still hasn't been signed yet.
Five minutes later, I poll again,
documents still hasn't been signed.
The third time, fifteen minutes later,
I go ahead and poll and guess
what the document has been signed.
So because of that, it automatically passes
through the gate and we start deploying into production.
So, using Automated Approval Gates,
it help us deploy faster yet safer. So there you go.
This is what the power of VSTS and Azure can give you.
We are the only Cloud vendor,
that makes it so incredibly
easy to go from nothing at all to
a full end to end
100 percent customizable pipeline
and the key is 100 percent.
All right. Thank you all, very very much.
Không có nhận xét nào:
Đăng nhận xét