Azure Pipelines YAML | Detailed Overview of YAML Pipelines

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
are you new to aor devops pipeline especially the EML ones do you want to learn EML pipeline Basics and how to create organizational standard pipelines then this is the right course for you hello and welcome everyone to my new course Azure devops pipeline overview in this course we are going to learn Azure pipeline especially yl why should I use yaml why not the classic one because as per Microsoft they are deprecating classic mode of Pipeline and will create new extension only for yl so yl pipeline is a Way Forward I will try to start the course for beginner label and try to move slowly to intermediate lbel in the last I will try to cover some Advanced topics which we should use in organizational label production environment my name is Prashant and I am the instructor structor for this course let's start from course overview and see what we are going to cover in this course I will start from introducing Azo devop pipeline what is it and why we should use it then I will try to give a small demo on creating our first pipeline by deploying our application to azure web application then we will go through some key terminologies of pipeline like triggers pipeline stages job Etc then I will introduce yl pipeline editor that you can use to author and edit your pipelines we will discuss about type of triggers present to start Azor devops pipelines then try to create a small task and try to ex execute them then jobs and stages of the pipeline to segregate the tasks as per requirement Library variables and secure files are the assets for our project and we will try to add them in our pipeline till the last slide we were talking about build pipelines in this section we will talk about release pipelines and the feature like approvals checks and Gates of release pipeline and last but not least we will see the reports of pipeline executions most part of this course will be as Hands-On and demo so let get started with our first chapter introduction Azure pipeline supports continuous integration and continuous delivery to continuous test build and deploy your code you accomplish this by defining a pipeline the latest way of building is with the yl pipeline editor you can also use classic Pipeline with the classic editor you define your pipeline in a yl file with the rest of your app the pipeline is versioned with your code it follows the same branching structure you get validation of your changes through code reviews in pull request and build pipeline policies you edit the code which is yl push your changes to to aure repo and with the help of automated trigger the pipeline will start and deploy your project to the Target this is the basic introduction about uml Pipeline and how to use it let's try to create and deploy our project using yl pipeline in Azure web app let's start our first demo for this course in this we have our Azor devops Repository here this is our project go API let me go inside to give you an overview of this project this is a basic Co application where I am running server and Responding back as a hello API welcome to go API and hello and whatever the name is given it will print out the output on the browser so this is the basic go API and I just want to give you that this is I'm going to deploy into our web application in Azure so let's create a pipeline fresh new pipeline for it new pipeline you can see we can click on it and I'm we can choose as your repo we can choose bitbucket GitHub Enterprise server and others but since we are using Azure devops so we are using Azure repo for kit and we have only one project so I'm just choosing this go API repository from that project and now it is asking me that what type of pipelines I want to create should I create a starter pipeline which is very basic pipeline do I have a p yl pipeline uh yl file ready for it so I will choose yl file and create create a pipeline from that or do I have to have a Docker or something kubernetes why it is giving me this option of Docker because in our pipeline in our repository let me show you we have this Docker file here so devops is so much intelligent that it understand that since this Docker file is present in our repo maybe I want to create some pipeline for Docker so that's why it is giving me an option to create create a Docker Pipeline and which I want so I want to create a Docker pipeline where I can build my project and later push my image to the Azure container registry so let's choose this one now it is searching for our subscription and it has found that this is our subscription let's choose it continue it is asking for login okay two Factor authentication I'm approving my request on my authenticator app approved and let's select our container registry in aure so my container registry name is registry goap bi then I'm choosing my image I can put any name here for example like test and here it is asking me where is my Docker file so Docker file is in my base location so this is my base location Source directory and then I have a Docker file so validate and configure okay so Azure devops has created this EML pipeline for us it's a basic pipeline which is trying to build a Docker image and push this Docker image into our Azure container registry let's go through quickly we will understand everything in detail later on but right now just to explain you we have a trigger which is triggering on our main branch then what are the resources I have a self resource which is repo our self repo then I'm defining some variables here which we are going to use in building a our image and pushing and then we have this stays then jobs and then we have this steps and in the steps we have this task which is called build and push an image to container registry and this will build the image and push my image into the Container registry and here you can you can see the command which I'm using here is a build and push just to show you a little bit more about this task if I click here on the set things I will get this gu kind of thing where I can fill out my information and then once I fill out my information I just click add and it will be added over here okay so this is what I'm doing right now nothing special nothing magic and let me try to save it and run it it will try to trigger and building the image okay so my pipeline has completed and it has build my image and push it to the Azure container registry let's check it out let's go to the portal. ao.com and we are going for container and I have this registry go API let's open it let's go to repository and here you can see we have this go API test which we have created recently this repo and if you go inside we have our image with tag 58 and this is our image which is ready but we haven't tested we haven't deployed it into web application so for deploy into B application let me try to do one thing okay let me just rename it so that we can distinguish from the previous API previous pipeline make it as a test save and let's let's add deployment to our web application so for deployment I just add one task here and search for web app and we have so many task here and we are going to choose this Azure web app for containers let's select the container subscription we will choose the web application I already have this web application running image name so image name will be the full name so we have to provide the full name which is this one let's copy this and it's asking for the full name okay and we require the tagging also copy the text so this is the full name of our our image whenever we will deploy anything else we don't require any configuration file a basic uh go Application we don't require any startup command and no configuration is required so we are good let me try to add it over here so this task has been added and what this task is doing this is this task is trying to deploy my container which is present in Azure container registry into Azure web application so I just want to add here one name so that we Define it like we understand which step is running so let's add display name here display name deploy to web app let's save it and let's go to Pipeline and the pipeline is automatically triggered okay it's requir some permission that's fine because a new new Pipeline and it's using first time the service principle so let me permit it so here you can see earlier we don't have this step here we have build and push task we haven't have this deploy to web up now we have this deploy to web up though what is going to do it will first build the goang image which is building the project and then push it to the Azure container registry and once it is done then it will try try to deploy that container regist from the container registry to the web application okay so it has deployed my image into web app let's go through a little bit into the logs it has found my image found my web application here and trying to update the configuration and then it has restarted my web application and then it has successfully configured it now if I see here app service application URL is this one so let's try to copy the URL and try to paste it here and run it's not running right now because after deployment it will take take several 2 or 3 minutes for warm up of the application so let's go to the web application now which is app Services we have this web application and then let's go to deployment Center in the deployment Center we will check the logs here okay so finally it has pulled my image successfully and now in the last line you can see the container this initialize successfully and ready to serve the request let me just go here in the overview and click on this link and now you can see welcome to go API hello have a nice day I have done some small cosmetic features so if I write down some name like my name and then it will give hello Prashant have a nice day so this is how our application is deployed I I just made changes into my git repo over here I just added this slash and automatically the pipeline has triggered and it has build the image and then pushed the image into container registry in Azure and automatically deploy into our Azure web application so this is the basic pipeline which I have showed you right now and you can now in the future we will start our course from writing from the basic of the pipeline starting from the scratch and we build our pipeline as a standard production pipeline deployment let's learn about the key concept and components that make up a pipeline and understanding the basic terms and parts of pipeline can help you deliver best code more efficiently and reliably a trigger tells a pipeline to run a pipe P line is made up of one or more stages a pipeline can deploy to one or more environments a stage is a way of organizing jobs in a pipeline and each stage can have one or more jobs each job runs on One agent a job can also be agentless sometimes each agent runs a job that contains one or more steps a step can be a task or a script and is the smallest building block of pipeline a task is a prepackage script that perform an action such as invoking a rest API publishing a build artifact Etc an artifact is a collection of files or packages published by youran let's go to aor devop service and get familiar with yl pipeline editor once we will get familiar with yl pipeline editor we will try to understand remaining Concepts like triggers stages tasks jobs Etc directly from there so enough talking let's go for demo let's start our second demo how to create a pipeline from the scratch so I'm already on our a devops portal and here you can see we have this button called new pipeline let's click on it and then it will ask you where is our code present so I'm choosing AZ your repo git if you want you can choose bit bucket GitHub GitHub Enterprise and other options we can also go for classic editor but this is specifically for EML so we are not using classic editor so let's choose as your repo git here you can choose your project maybe you can have multiple project I have only one so I'm choosing that one and then you have other options here if I click show more you can see there are net desktop net core functions Android so many other options present here for building your application but I don't want to go through all these I just want to start from the beginner pipeline which is this one I just click on the starter Pipeline and it has written down some steps for us so first one is the trigger that on which trigger my pipeline will start that is our main main means our Branch name and uh any project any update happen to my main branch it will try to trigger this pipeline then we have pool pool means what is the backend OS will be choosen when our pipeline will run so we have this backend image called un to latest we can have Windows as well but it's up to you that which backend image you want then we have some basic steps which is just printing hello world and we have some scripts here which is also printing some values I just remove this one because we don't require it's a basic Pipeline and let's save and run this pipeline so our pipeline run successfully if we go to the steps here I just printed out generate a script script content is Eco hello world nothing special so let's go ahead again on the pipeline this is the pipeline let's rename the pipeline name this is we are putting as learning pipeline save and let's try to added it one by one so first of all let's try to see how many type of triggers are there so first one as you already see that this is a branch trigger so if we have added this Branch name over here any update to this Branch either from the commit or from the poll request to this Branch automatically trigger the PO uh trigger this Branch so for example if I go here and if I go to main branch and let let me try to add it so let me remove this comment here update it and click on the commit it will start my Branch let me push pause this Branch because we don't want to run this Branch again and again so let me pause it and and let's go to pipeline again and you can see this is right now running it's running because I just updated the main branch by adding some commands and it's run successful now going again in the addit now what else we can do in this we can not only mention the branch name but also Define the proper path that if anything updates inside that path then automatically my Branch will trigger and if the same path is not getting updated then my Branch will not get triggered so for example for doing that what we can do here then we have to mention branches here that which branch I want to include so we have here include button and I want to include main branch okay and if I want to exclude so I can exclude some branches also that if something happened to other Branch it will get excluded here but we don't want to do this exclude here now we are mentioning that we need to define the path that on which path my code is getting updated and which will trigger our pipeline so let's define the path here so you can see it's so intelligent it is telling me that you want to write this so paths let's include the path here so I'm just saying that I want to include only main. go nothing else and very important part that this is a yl pipeline yl pipeline so indentation is very important so for that let me just push it back and from here okay it should be coming here and then Branch okay and after that I will add a hyphen here and then this is how I have added the path so now anything which I will update in my main.go file which will be triggering the pipeline and if I update any other file it will not trigger by the pipeline so let me save it this is our pipeline which is learning pipeline it is not yet triggered why because we didn't updated the main file so let's go to the repo and uh let me go to this azour pipeline here or this is the one which we are right now working on let's add one commment let me addit it any comment so something like commenting to trade trigger but it won't run the pipeline so I'm updating our main branch you can see Branch name main I'm updating our main branch and let's go the pipeline is triggered because I have updated the main branch it hasn't triggered it is not triggered yet let me delete it it's making me little bit confusing so just copy this paste it here and delete so this is how you can delete the pipeline also so it is not yet triggered why it is not yet triggered because we have mentioned the path so only on that path the pipeline can be triggered so let's go to this pipeline uh go to repo and let's go to main. go and let's update so I have to addit it update this command to trigger the pipeline let me update this command into main. go commit and now it should trigger the pipeline so now you can see the pipeline has been triggered because I have updated main. go so let's go again so here I have mentioned mention the branch name and then on the branch name I have mentioned the file name here if you have like a folder so for example if you have a folder you can mention like slash and then some folder name like folder one then slash then asri it will include everything inside that folder so for example like this so it will include if something inside this folder for example five or six or 100 files if you're updating any files over there it will try to trigger the pipeline so this is the second way of triggering the pipeline first one that we are just mentioning the branch so anything updated on the branch it will trigger the pipeline second is I am added the path that inside that Branch if this path is getting updated please trigger the pipeline now the third one is the schedule that we want to schedule the pipeline so for schedule let me try to make my trigger disabled so this is how I have disabled my trigger and once I will save it it won't trigger my pipeline so if I go here I have updated my ml file but since it is uh the trigger is disabled so it is not triggering my pipeline so let's go to learning pipeline again and now we are going to add a schedule here so let me just enter one more line and then adding schedule or maybe five these are 1 2 3 4 and the five estx so this is the estx which is the detailed of my schedule now you I know you are confused that what these estc means so let me show you what this estri means means so I just copy paste from my document so now this asri means this five estc means first one is the minute the value is from 0 to 59 second one is the number of hours value from 0 to 23 third one is the date which is 1 to 31 then month 1 to 12 and then we have days of the week which is 0 to 6 and it's starting from the Sunday so that means Sunday is the zero so now if I want to run this pipeline we have to mention this values for example if I want to run my pipeline every 6 hour every day so what I have to do every 6 hour I just mention this at zero and then mention this minutes will be zero and mention this as a zero comma 6 comma 12 comma 18 so it will run from z uh minutes will be zero and in the hours I am using 0 6 12 18 okay and then we have these remaining three estrick okay and under this chrone we will add add display name for it it is a schedule trigger and then we have branches that on which branch I want to add the schedule trigger so I want to include my main branch and it is giving me error it's saying the first property must be crone oh I I I done a mistake here it will be Crone not the Crone so okay so we have the scrone defined that on 0o minutes on every 0 6 12 and 18 hours per day per day means I am just defining asri here so per day it will be scheduled and it will run four times a day on 0 hours 6 hours 12 hours and in the evening six and evening uh 6 or evening 18 so but if I schedule it we cannot test it right now so we can check the right time right now what is there and one more thing our pipeline follow the UTC timeline so we have to go and try to find out current UTC time now so currently it is 1349 so let me try to give it as 51 and let me remove all these 1351 and let's make it this as a schedule and now we have to wait right now the time is 13:49 I have scheduled it after 2 minutes and let me save it let me bring this over here it's 135 50 now you can see it is 1351 let me just remove this and let's see if our pipeline is triggered or not and you can see the pipeline automatically triggered just now so this is how you can mention the triggers so first trigger is the branch another trigger is path if you want to mention a path and the third trigger will be schedule you can schedule your time and your pipeline will automatically trigger you can include both the triggers here that we can trigger with the help of some pull request or some push uh commit and also the schedule so you can combine these two as well if you want okay once we understand the triggers let's start for the next component which is called stases so stases let me remove this is steps also remove these pools because stas is the uh Superior than uh VM images uh so we can mention these pools inside the stages as well in the future so let me write down the stases so now if we want to run our pipeline in a way that it require uh running the building for build of your project first and then it will release some artifact and those artifact will be used by some another another stage then we can mention this number of stases over here so let me just give you one basic overview this is a stage name a let me put the display name here and inside the uh stage the the child resource of stage is is job as I showed you in my presentation let mention job here and the child resource of the job is called steps child resource step is the smallest component of our Pipeline and let's write down scripts so first of all this indentation is very important here so I have to give interation here after two space and then I'm just writing some scripts here and it scripts are basic like I'm echoing that this is a stage a and some Hello word example let me save it okay I saved and here it is trigger none that means it will not trigger automatically so I have to run it okay so it runs successfully it stays a Eco hello asure pipeline so we are done with that and here I would like to show you something important that once we have this stage defined in this we can add some variables if we want these are called pipeline variables so if I click on variables click add and any variable like I'm just writing name so just my name here and it is mentioning that is it a secret value or not that name is not a secret value and then over here it is is defining some uh how to use these variables so in the batch script I can use as percentage name percentage if it is a Powers shell then this is how I can use it but I'm using the bash so I can use it with the name directly so let me hit okay and let's save it and let's Eco the name eco so name will be this one and let me add a secret variable as well so click on plus secret this is my secret which I don't want to tell anyone and my secret is very very secret and let's make it keep this value as secret and this is Secret variable also can be use like dollar sign and the bracket my secret in the capital okay and let's save it and let me eal the same value secret is dollar my secret let me save it now and try to run now we can see what will be the output here you can see it is prining a is my stage name okay so command line run successfully it stage a hello pipeline Eco name is Prashant then Eco secret it is not telling me what is the secret it's just print printing the estri value it is just masking my credentials and printing the estri value and it is giving me the output of my variables let me show you a little bit more about that editor that over here in the three dots if I click here I can validate my pipeline so if I click here my validation is okay and if I want to click on the triggers then here you can see it's a go API and in the meml I can add this and some extra parameter that I want this name to be learning pipeline I want to update it I can update default isn't pool for yourl pipeline I'm using AAR pipelines and if I drop down I have only one pool right now which is Microsoft provided if I have my own default pools which is my own self hosted agent I can see those those pools over here but I don't have any and then here is the pipeline yl pipeline path so this is a yl file where I have written my code we can choose our path from here which we don't want then in the variables tab we have these two variables this is a my secret variable if I click on this I cannot see right now and then we have this my name if I make it like secret then I can not see it okay in the triggers we have pipeline triggers if you want there is no schedule trigger if you want we can add schedule trigger from here as well that on Monday Tuesday Wednesday Thursday whenever we want we can run it and if we want we can run include the branches which branch I want to include and which branch I want to exclude we can do that and there is one more trigger called build completion so I can add some build completion for other pipelines that I want to add build completion for another pipeline or another branch on another Branch then I can select that so this we don't want to trigger right now but yeah we can do it with the pipeline GUI as well and here in the history we can see the history of the pipelines so this is the important part which I want to show you that these are the another features also available in the yl PIP which you can utilize to update your pipeline for variables for schedules or if you want you can use to update your backend pool that you want to run your pipeline on Microsoft hostent or your selfhosted agent okay let's start to use templates into our pipeline so before going there let me show you we have one template here in our Repository so we have this template folder and inside this template folder we have this template hyphen file. ml where we are using this two parameter to install npm on our asent pool so let me go to Pipeline and let me try to addit it so in this pipeline we already we have our steps our scripts this is we already discussed earlier let me add it from here so it is template here under the just like where we have written this job just below there we have this template and then we have to define the template which is it now automatically you can see it is searching for all the template files and template file is the EML files so we have this EML file here I'm just selecting this one and under the template we are just giving some parameter values now the first parameter is name so name I can give any name for it so I'm thinking let's keep the name of the operating system which I'm going to use is Linux and and the another one is the VM image this is the second parameter we have seen in our file and let me give this name as Uli test so let me try not to make it as a bigy let me try to make it as a basic pipeline so what I'm going to do here is I'm defining those these two parameters here under the jobs I'm just printing the values so that we understand the basics and then and the thing is EO and here we are using this VM image parameter name is VM image let me try to commit this and let me go to the pipe P line and inside the pipeline we are using giving the name as Linux and the image name is Ubuntu latest let me try to run it so we have these first one is our job which is just printing the value second one is the Linux so if I go to command line here you can see stage a then I'm just printing hello as your pipeline then this is the name which I'm Printing and this is the name of the OS I'm Printing and then it has started the previous job which is dependent on the Linux one and here I am just printing the old values so this is how we can use our templates it can be possible we can have multiple templates in that folder we can use multiple templates so this is how we can use uh single task if we Define in the templates we can use it in the multiple times into the multiple pipelines for example you can write down your templates for da nonpr prod and then you can write multiple pipelines for da nonpr prod and then you can use those template on the each pipelines so this is how we can use templates next I want to show you one important thing in our aor devops editor Let Me remove this template thing from here that we have this right hand side we have this task board in the task board we have multiple task available for utilizing into our project so we have this Powers shell here publish code coverage here for example if you want to search net then we have this net core nugat use net core so many if you want to use cuberes so we have this deploy to kubernetes we have hem tool installer so many and so many tasks which we can use into our pipeline so today we are going to learn how to use these tasks so before that first we have to understand where we can add this task so we can add this task always under the job section so if I Define my task here under the job section it will be added here I want to add a bash and in The Bash I want to run some inline script which is hello word this is the hello uni word 2 and if you define more working directory some bash environment you can add it but I don't want to add is a basic and let me click add so it you can see it is automatically adding that script EML script into my pipeline what you can see there is some error so the error is because of the indentation we have to find out where this task is correctly created so under the steps wherever this hyphen sign script is mentioned under the same we have this task so now if we want to update some properties we can see the settings here just click on the settings we can find out here in the right side the whole definition and we can update the definition okay so we have this task added and in the task let me write down the name of this task which is display name B task and then save and run so here you can see we have this best task created and if I go inside best task we have here hello world 2 so this is how we can add more tasks into our pipeline this is the basic best task but we can add more advanced tasks into our pipeline let's start Understanding Variables in Pipelines I hope you already seen some parameters and some uh pipeline variables from here but let's write them down into our EML file so let's start with variables and once variables are here we need to provide the name of the variable so since I'm going to Define multiple variable names here so name will be like variable one and the value of the variable one is something like I am V one and then I'm going to Define one more value here it's a read only if you want we can make it read only but I don't want so here I think we have this make it another variable name here and the name will be variable two and the value I'm giving it as I am Val two okay so now I have defined these two variables and now if I want to use these two variables inside our pipeline let me remove it because we don't require so many things let me remove this also and this as well so now how to use these variables so this is stage a and now I want to EO my variable which is variable version two variable version three uh variable War one and War Two so it will be the Syntax for using we variables in your pipeline is dollar we have curly braces two curly braces and then we are defining variables dot then the name of the variable and same we can use it for the next one so it is a variable two and and in the ecoo let me just print sln so that it will be next line command and let me save it and try to print our variables so here you can see Eco stays a then I am variable 1 and then sln okay it's not making it next line that's fine and then it is variable two okay in this demo we will try to understand that how to use a variable which is defined in one job and now we want to use that variable value into another job or we we have defined some output variable we are getting we are running some job or some task and because we are running some task we are getting some output from the task and now we want to use that output task output of the task into another job or in another stage so I hope you're are seeing this that we already have our basic pipeline where we have defined some stages some jobs and now under this job we will need to define the outputs so we cannot use directly the variables we have to make those variables as the output variable then only we can use those variable into the different different tasks or different different steps and stages so let me try to add my first variable over here under this job so I have this step that in a Powershell I'm just equaling my variable and here if you see that this is a task. set variable where I'm setting the variable the name of the variable is my output variable and is it a output yes this is a output variable and this is the value of the variable so whatever the value is I we can put it here and now I'm putting the name of this variable is set War step so it's a step variable so I'm making is a set variable step and now I'm trying to eing the same variable over here now I want to use this set War step variable into the next next job so let me try to Define another job here hyphen job and let's put the name similar to like earlier job B and now since we are we are trying to use variable which is defined in the previous job so we will make it as it depends on that this job is depends on job a so so it's depend on job a and let me fill in the remaining parameters quickly so the remaining parameter is then I'm defining the pool that it this will run on2 latest then I'm defining a variable into job 2 and referencing this variable into the job a variable output so here you can see this is my variable from job a the name of the variable is my variable from job a and it is dependencies on job a output and the name of the output is set War step. my output variable so here you can see set War step do my output variable here you can see the Val uh variable name is my output variable so and this is the name of the step so now I have defined it over here as a variable and now we will try to print this as my variable over here in the Second Step so second yeah second job so let me save it quickly and try to run it okay so it run successfully let me try to see in job one let me see what Eco variable this is the value that's correct that is what the value is and let me see in the job V job V let me see the output and this is the value that is correct that means now we are able to use the variable which is output of job a and now using that output in the job B now let's go again and try to understand that if we want to use these kind of output in different different stages like we have four five stages and now we want to use those output from one stage to the another so let me try to remove this code from here and quickly fill in the new code code which is basic code I am defining one stage the stage name is a then I'm defining one job job name is A1 and then a step step and the step I using bash and just creating an output variable the name of the output variable is my stage output variable and the value is this is a stage output variable okay and now I'm putting this bash task name as print War okay and now I'm defining another stas B and now this is important it's depend on a stage and then defining a variable name my where from stage a and then referencing it to the output of stas a so in the Stage B I have defined this variable and referencing it to the output of stage a so how do how we do the reference I we are doing it like stage dependency then the stage name then we are defining the task name and the outputs and what is outputs we output uh task name first is the print war from here this is the task for this bash command and then the value the name of the variable which is my stage output variable and now we are going to print this output variable into our job which is called B1 now this is a uh this is scope for this variable is the stage scope so we define Job 1 job two job three we can use this variable my where from stage a in all those jobs so let me quickly save it and try to run it okay so upper PIP plan run successfully let me see the output of a stays and the output I'm not printing anything okay that's fine read the script and let's see the output of here and here we are eing this is a stage output variable so this is how we can use the output of a stage one to Output of the stage two in the Azo devop pipeline next let me introduce you to this new component in the pipeline called library in the library we have this variable groups and we have the secure files in the variable groups we can create variable groups by clicking here and we can write down okay okay okay and let's save it where we must have at least one variable of course so we need to add variables here like name and the value will be some random value and then let's save it and we want to add more variables here we can add it and make it as secret as well so that's totally fine and another thing over here is the secure files in my project personally I'm telling you these secure secure files are very important because we are saving all our certificates over here in the secure secure files which is required when we are trying to deploy our application so we are not using using any proper Secrets or any random strings over there we are using certificates to authenticate and authorize our service principles to the aure and when we are using certificate so we are saving our certificates over here and when we run our pipeline then we will use these certificate films from secure files and then authenticate to the aure it this is more advanced topic to discuss so that's why I'm not keeping it in this demo but if you want want just let me know we will uh I will create one video for you to use how to use certificate to authenticate and authorized to ago next we are going for releases so now till this time this pipeline these are build pipelines now let's discuss about the release pipelines so release pipelines are the one which is dependent on the build pipelines so once build pipeline will create some artifacts these release pipelines are getting used to release those artifacts to the Target host maybe it is development environment nonpr environment or production environment so let's click on new pipeline so let me try to create from empty so here in the left side you see this is the artifact and in the right side these are the stages so in the artifacts let's try to add some artifact so what are the type of artifacts here so Source will be either a build pipeline or some Azure repository where we can directly use some files as a artifact G GitHub or tfvc we are using build pipeline I'm using my project and in the drop- down build pipeline I'm checking our go API and then we can use our latest run as a output and then add it as our artifact so this is what which is the primary prerequisite for triggering our releases so once this will run then our release will also run now in the release we are going to add stage here if you want so we have stage one stage two or if we want we can update this stage just like adding it here then stage one will be run first then stage three will be running so it's kind of dependent on your prerequisite let me try to just click on on it and let's see this is a dab stage let me make it as a dab and let's save it and then if we have more da stages then we can add one more prepro and save and then let me try to make one more which is also empty and make it as a production and save so now how our deployment will look like that first our build artifact will run and then this build artifact will deploy its artifact to Da and da will use those artifact this release and deploy it into development environment then prepro will also use those artifact and deploy into pre-pro and once pre-o run prepro runs successful then it will deploy in the production these then just go here and delete go here and delete we don't want so many yeah I'm just showing you what are the features available in release so once we have this stage ready we have something called pre- deploy conditions so this pre- deoy condition if I click here it is having defined the trigger that will start the deployment so in this trigger I can have schedule here just like earlier I can schedule I can do some pull request for the dipl deployment or some artifact filter if I want to deploy or we can use it as a manual as well that I don't want to run on the any trigger I want to run it manually so this is kind of continuous integration and continuous deployment so if I make it like artifact filter and try to add some artifact filter I'm going to use go API include main branch and that's all and if I want to use schedule I can use schedule so similar like we have it in our build pipeline we can maintain the schedule here that when it want to run then we have pull request deployment then we can mention the pull request the release definition is correctly not configured to trigger pull request based releases okay I don't want do that then we have something called pre deployment approvals this is very important that I want that my my team lead or my project manager or my product owner should approve first before deploying my changes so I just mention my product owner name like okay before deploying to dab please take approval from such and such person and timeout of this is 30 days or we can make it like 10 days after 10 days this will be timed out approval policies we can apply the user requesting a release or deployment should not approve it for example I am requesting then it should be I should not approve it and Skip approval if the name approval approved the previous stage so we can have multiple things here now next one comes up here is the gates so if we enable the gates we can have this like if you want to delay my deployment for some time period we can delay by mentioning here that I want to delay for 5 hours I will approve it now but after that the deployment will happen after 5 hours so our build pipeline will run approvals will be done and after that 5 hours it will run for example I want to run my job in the known business hours so that it will not affect customers so that we can mention here if we want to add more Gates here we can add like check asure policy compliance or invoke some as your function if you have some rest API which is generating some kind of email to the customers or the stakeholders or some other things also we can have so we can add these Gates when we are going to deploy and deployment Q settings over here we have some more settings that we want to deploy all in one by one or we want to deploy only the latest one so it's depend on what kind of configuration you want and if you want to run parall two or three deployments that also you can mentioned over here I am not mentioning anything here or no pre-approval required so this is how you can set up your release pipeline which will try to release your artifact onto the target dab nonpr prod with the help of these predeployment approvals and the Kates next next thing I want to show you in pipelines this is called deployment groups the deployment groups is nothing is similar to self-hosted agent but it is different from self-hosted agent because in the self-hosted agent we are running our task we are selecting them as a pool but in deployment groups we are adding deployment groups to deploy our releases for example uh you have a project and you want to deploy on five or six Target machines so you can add those Target machines over here in deployment group and whenever you are saying that I want to deploy to one of the deployment group for example deployment deployment group one let me create it and then you you have this whole code here and you can use this code to to register your machine into this deployment group and once that is registered then you can easily deploy your project directly on that Target host so this is how you can use this deployment group to deploy your project to multiple hosts now last but not least least we are going to discuss the last topic of our course which is called pipeline reports so how to see those pipeline reports how the pipeline successful not successful so let's go to one of the pipeline here and in the pipeline you can see it's run sometimes it's un successful sometimes it's failed let's go to the analytics here and in the Analytics tricks we get to know the pipeline how many times the pipeline pass the rate which is 76.92% it's successful if you have defined some test plans into your pipeline it will tell you the test pass rate that how many times your test got passed and in total what is the duration of your pipeline on an average so it is 33 seconds for me and succeeded runs is 20 so so this is how you can you can see the whole report and if you want to click on this this is the pipeline failure report and the remaining things so for example past rate is 76 and then you can say failure Trend per sec per stage how many times it failed stage one most of the time our stage one got passed and stage two most of the time it failed so this we can see here failed runs for all the stages so we have some failed runs for all the stages information here and so and so forth so this is how you can see the reports of your pipelines and which can help you to understand that where your pipeline is working fine and on which stages it is it it is struggling to succeed so this is all about the demo of the pipeline and uh we learned that how to create a pipeline from the scratch then we learn how to how many types of triggers are there then then we have discussed about the templates that how to use the templates we have used how to use task jobs stages and then we also discuss about the libraries variables secure files and also I have showed you in the releases that how to use approvals checks and gates to deploy your uh deploy your artifact on the Target and in the last we discussed this aure pipeline reports as well I hope you have enjoyed this course same as I enjoyed it while creating it I would like to thank you everyone and wish you all the great future as a devops engineer if you are interested and eager to learn more about devops securing pipelines as your Technologies then tune in to my channel thank you so much see you in the next course
Info
Channel: Getting Started With Prashant
Views: 6,175
Rating: undefined out of 5
Keywords: devops, devsecops, azure devops, azure, cloud technology, azure pipeline, azure artifacts, azure devops tutorial, azure devops for bebinners, yaml pipeline, azure yaml pipeline
Id: EdZKyGyoCOQ
Channel Id: undefined
Length: 70min 25sec (4225 seconds)
Published: Mon Oct 09 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.