CICD Pipelines as Code with YAML Tutorial for Complete Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so let's look at the sample project that I will use in this demo which is Porsche Unlimited with application a website for car parts and this is the source on github this is a key feature is B dotnet 5 support Linux and Manu using visuals to 2017 and many others ok first I will navigate to the demo generator where we can generate a project template so here I will select agile devops organization and they choose the required template here assertive obsessions and here I will choose a template navigate to parse Unlimited and then select this template here I will just type the project name I will type the name parse unlimited project then create project so this will create the project including different component as we can see teams for the columns swimlanes this includes the source code the pipeline you can watch this video for more information about docker contre narration and we ran how docker can fit with devops & cie CD pipelines as we can see now the project is created so let's navigate back to Azure DevOps and refresh the page here so we can see this is the project let's open the project and as we can see here there is many work items created even some of them is in the Dona state and there is many poor requests committed and so on so this project can be used for demo or understanding or training purpose ok let's navigate to the repos so we can see the project as we can see here we have purse unlimited with application which is created using asp.net 4.5 so if I navigate here to this is the documentation of the project let's open that this is for how we deploy the project and let's see navigate to the web application directory or folder so as we can see this is an embassy application and also it includes this to project so we have here unit test selenium test this is for UI testing if I want also to try the automation of UI testing as a part of the build it's out of scope but I'm just showing you what is included in this project so and this is a unit test so let's navigate now to the pipeline so we have a pipeline created part of the generated project I will pose this pipeline select it and both this pipeline then return it back here and then let's navigate to Azure portal and I will create new resources so I will create the back end of my project which it will be the web app and the sequel on Azure because this demo will not include creating the infrastructure as a part of the pipeline in other labs and videos part of them is creating the infrastructure from the code under the source control but this is out of the scope of this demo so here we are going just to create the infrastructure manually using the azure portal so we have a template here it's called web sequel so if we navigate here to this template then click create so from the name of the template we expect to have a web app and sequel on agile so here I will name my web app name so I will just call it with AB sequel red one my name and then here I will select create a new database and here I will name the database with AB sequel DB then for configuring the settings I will create new sequel server on Azure and here is the name of the sequel server and then just put the username and password for the sacred I can put in username and password this will be used in the connection string in the web app later we will see that and here I will change the location let's choose the U key so and as we can see here this option allow other service to access server this will allow the firewall on the sequel server so the web app can access the database if I didn't check that then I need to configure this rule manually then select and then create so this will create the web app and the sequel server with this resource a group name web app sequel rot 1 so as we can see now it's complete so let's navigate to resource groups and as we can see we have new resource group created with a sequel rot 1 if I click that we can see that this is the resource created this is the database this is a web app and this is or the sequel server measure so let's navigate back let's navigate to the web app and click on configuration so we can see the connection string created as a part of the template so here this is a connection string as we can see here the name of the database that I could hit the part of the template the username and the password that I use to create a sequel so let's close that we have also some configuration for the app settings let's navigate outside from here and get back to the azure DevOps so now I'm going to create a new pipeline and in this time I will create a pipeline as code using Yemen not just the classic or the visual one if I want to use the visual then I just go for the classic editor here and since I'm going to use the pipeline as a code then I will choose this and here the first is to ask me where I want to store my pipeline code so I will choose here this repo and which is a parcel limited here as we can see we have some reddit DML template which includes some template for tasks and here I will choose the asp.net template so as we can see once I create that this will generate the ML file with some predefined tasks for building a speed net application so the first is to change the agent image since I know that my application required to build a Sibbett net with running the unit tests so I need the visual studio 2017 image so I will change that and as we can see here I just will use this image and here is the name of the value that I can use in Yemen so here I will put the name and then just save and run or I can save and run later so let's save first and then just edit again and run as we can see the trigger here is not defined and this means that this will be continuous integration so every time you see this pipeline it will automatically trigger a new bill so let's navigate to the pipeline I prefer to open to instance so we can see different views so here let's open this pipeline so we can see the running of the build from the outside let's open another instance so we can see that from inside so you can see how we can have different views so this is in details and this is like an abstract view for the build so as we can see this is the tasks in the belt just check out the project get the project from the control start restoring all the packages using the nougat package and then building the application using the via spelled and then running the unit test yes this is then you get command let's see that from outside as we can see you can watch this video for more information about kubernetes cluster healthy deploy docker image to Azure Cooper native service and how to configure CIE CD PI appliance for an end-to-end development and deployment scenario now it's building the application by speeding up all of that but I leave that to have the full experience so as we can see here running the unit test now the test is complete and as we can see I can navigate to the test result from here if I click here this is a test and we can see that I have total 16 tests 14 paused and 2 unknown but all of them there is no problem or I can just get out of this running job and navigate to the tester from here it is the same view okay so let's get back to the PI applying as good and click Edit so we can add another stage and this is very important because now I'm going to use a multi-stage build and deployment in 1 a.m. and file as a code so in order to do that I just need to go under the trigger and start adding a stage so I can name that this file has no stage when I running that so this is like a single or one stage so I don't need to define stages but if I need to have more than one stage then I need to define the stages so first I will just have a new line and enter this be very careful about the species and indent because this is very restricted so as we can see now I have the stage built then just remove the extra space that not need it because this is very important and as you can see here we have this correction which means that this file has an error and I must fix all the error before I can see if and even if I could see if and it has any syntax error about the spacing or the indention this will cause the build and deployment to to has an error in the running and it will show me that so be very careful about the species and the intention in this file I will show you how to do that exactly so now I remove this species another space here as well so now it seems fine so when I collapse the stage as we can see the pool and all of that is not in the stage but I need all of the content inside the stage in order to do that I just expand the pool and the stage as well and I will select all the part that is not under the stage and make two tabs for indention again this is very important so all this part is under the current stage which is the build so as we can see now it seems there is no error and if I collapse the stage we can see that all the stage now collapsed correctly and there is no element outside the stage which indicator that this is correct so now I'm going to copy that stage be very careful about the spacing to copy the space as well and then create another stage this will be for the deployment as you can see I get back to the beginning of the line to make sure that I will paste in the right place then paste here so now I'm going to change the name from build to be deployed this is the second stage here deploy and I don't need any variable here so I will delete that with all species and I will delete all the steps because I will create new steps so as you can see now I added the second stage and I need to create the steps in this stage so I will use the graphical UI to add the steps to the ml so if I navigate here and choose the app service deploy because I want to deploy my application to the web app on agile so I select tasks so the first is to choose the subscription my subscription and authorized that to the Azure subscription so I can have a permission to deploy that and here then I can see all the web app and I have the web app that I created earlier in this demo which is the web app sequel at one and here I will delete that and just put that with the drop folder so so this task will start looking for the web package on the drop location on the azure DevOps because I will copy my web app in the drop location this is another task I will show you that later now and then let's add that so as we can see now I have this task added to the deployment stage in the ml file but as we can see it still has error so I need to invent that part under the deployment stage with two tab while I'm selecting it and as we can see the settings here this appears automatically which also indicator for a correction I have that correct and it seems working fine so now the deployment is ready to take the web package from the drop location and deploy that to the web app on the azure but in the build stage I don't have any web package that put that on the drop location so I just need to add another task in the build stage so I can create the web package and put it with package on the drop location so I will go here for the build stage and search here for publish package so here the publish artifact and then here this will be the drop location and the build artifact staging directory then click Add to tabs so this task will publish the web app to the droplet as we can see here we have the drop here this is the folder and also in the deployment I just need before deploying the package to the web app I need to download the package on the agent first so I will add another step to download the package from the agent so here download build artifacts and here just write the artifact name which is the drop and then click Add to peps for end engine so now I have complete the two stages so let's double check if I collapsed that and that it seems very good so let's expand this as well and now just save this will automatically trigger because it's continuous integration so let's navigate to the pipeline open to instance this sometimes happen because I need to confirm the authorization for the pipeline so I will just need to click here authorize resources and then run new as we can see now the build is running let's open another instance so we can see that from inside click here so this is the build and deployment from outside and this is from inside so it will go all the process that we explained before and of course has a new task which is publish build artifact which is here so run the build the same tasks just show you here this is from outside how it looks like and here from the unit test publish the artifact on the drop location so we can see here unlike the previous build this build publish the web package to the artifacts because we added the publish package tasks to the build stage so this published here so it can be picked up by the deployment pipeline so it can pick the OP this package and deploying that to our infrastructure as we can see here I can access the artifacts here this is the drop location because I publish the artifact and here this is a test and here this is the way package published on the artifacts so let's see that from outside here now the deployment will start this is from outside and this is from inside let's expand that as we can see it will check out then we'll load the artifacts from the drop location and then start deployment you can watch this video for more information about gate with animation you would see different animated command like branch marriage repays cherry-pick and many others now it's complete listen navigate here to see that from how it looks like from outside as we can see it's completed successfully with some warning but no problem it just completed successfully here and here as well so if I navigate to the repos we can see that so we can see the connection string so if we go for the web.config we can see the connection string names different connection strings so I will copy it and navigate to my web app this is a resource group and the web app configuration and update the connection string name - so this is the correct connection string name so the web application can translate the connection see if that and then navigate back to the web app and prowess so as we can see this will load the web app from our web app and as your sequel server with all the data this is the web app as we can see it has some products for core parts as a tips in order to troubleshooting the problem about the package was not exist I needed to troubleshooting and in this I used a command which is dire p.s this will display all the existing files and directories or folders in this location and I can run them on the build the agent so I can display all the existing file and just control see so I can exit from that so I will use the same command with the command task on the built by appliance so I can understand the hosted Asian Microsoft hosted agent which mean that I don't have access its the hosted agent is provided as a services so I don't have a physical access to the buildin I don't have a remote access so I can navigate to so what I needed to troubleshooting is to display what is the file exists in the pipeline agent so in order to do that I will come here in the deployment stage and start searching for command this is just a tip it's not needed and here I will just type a message tell me all the folders and files in this path and here I will put the same command so this will tell me exactly what is inside the building and of course to tap for indention save this will run the build automatically let's navigate here this is the normal file I don't need it I just want to show you here so this is the command line in the desk so let me get back as you can see it's start displaying all the files and folders in this and of course it start with tell me all the folders and the file and dispose and listing all of them I can also if because this is a Windows machine if it is a Linux machine I can use pash instead of command line with this command there is also a very good documentation about using bash how to using passive variables and displaying that has great content [Music] [Music]
Info
Channel: Mohamed Radwan - DevOps
Views: 23,400
Rating: undefined out of 5
Keywords: Multi-Stage, Azure Pipelines, Azure, YAML, Multi Stage CICD, Pipelines, Continuous Integration, Continuous Deployment, CICD, CI/CD, CICD Process, DevOps, Build Automation
Id: kPZOFSt8m0M
Channel Id: undefined
Length: 24min 0sec (1440 seconds)
Published: Fri Jan 10 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.