bonjour hi welcome to another video of cloud in five minutes
I'm Frank Boucher and today I want to show you how to use cake build in a
Asscher devops pipeline to generate a static website see you quickly Jen gets
you off contest video cheeky just see Oh what what
so in today's demo I want to use cake as an automation process to execute steps
on the build machine to generate my website so you could go on the website
cake and it's in c-sharp so that's why I picked it it's it was I was feeling very
comfortable with it so if you go here and D get started you will find all the
instruction required to understand how to use it so here we see that we will
need a PowerShell script named build dot ps1 and the actual build script name
bill dot cake if we go here in the example repository in this repository
you will find all the file required for our projects and if you go on the VM
website and you go in the documentation you have a section here for deployment
that use cake in here again you will have other instruction are out to use
cake to generate we am website so let's get started to start that process with
Azure DevOps we need a asher pipeline Yama file and it's a good practice to
put the deployment stuff in a folder so let's start by creating a new folder
we'll name it deployment and then we'll add a new file
as your pipeline in it now we are ready to get started so first thing we want to
be trigger on a commit on master so let's put that trigger next because all
the components I will be using our in.net core I will install that net core
so here am I create a variable so if I want to update in the future the version
of the SDK I'm using it will be simple that way then instead
using the Ubuntu machine that come by default I will use a Windows one and the
first step will be to install the.net core now my build server is ready so
like explained on the cake website we need to execute that build that ps1 fold
file so we'll create a new step calling a PowerShell command and we'll execute
that file we need also to add the file to our repository so let's do this so
create a new file and we'll put it at the root and we'll grab the code from
the github repository there it is if you look at the script it's very simple to
understand it well it's kind of a boost trap so it will install cake and then it
will execute by default build that cake but of course you have many different
parameters and you could pass something else so the next step will be to add
this build cake file so let's add it the cake file I'm using here is a bit
different because when I was executing the script I was not saying in my logs
some warning so to remove those I specify here the version of the package
I'm installing so the way we read this is we install nougat package so Wynnum
will be installed and then the cake that we M will be installed and then we'll
just executing the command we are passing the settings so great now we
have a bootstrap to install the component we need we have our build
command so at the end of the powershell step the website is now generated so we
need to copy it in a different folder so let's do this with a copy file step just
like this so I'm copying the output folder to the artifact staging directory
more mostly there the only thing missing is that we need to publish those files
so let's have the last step for now and it will be a publish artifact step
so for the last step we'll be publishing the build artifact publishing that
specific folder so there it is we have all the component we acquired we are
ready to start building or build pipeline perfect we have now everything
in order to setup our build pipeline so I will come it and push and we'll get
back to you on the azure dev ops website Here I am in Azure dev ops now what I
need to do is create a build pipeline so let's go there and in pipeline select
build because I have nothing it's a brand new project I will create a new
pipeline now I need to select the source of my code in my case it's in github so
we'll need to authenticate and pick my repository now that the end shaking is
done my Asscher pipeline has access to my github repository so now I need to
specify where is that Azure pipeline that llamo file is I already have one
remember so I will select here the existing Azure pipeline I'm staying in
master I don't have multiple branches but if you do you could have you could
specify one here and the path then it's deployment as your pipeline excellent
click continue and that's the file we create earlier fantastic you still have
the chance to change it if you want but in our case everything looked fine so we
just need to run it great the bill was successful or artifact on
our published and ready to be used in the next video I will show you how to
build that really spot line to deploy in answer