Setting up your first CI/CD pipeline with Azure Pipelines
so the demo i'm going to show you today is how do you use our servicenow ci cd extension published on visual studio to get started even faster by leveraging its pre-built tasks and pipeline templates we have three environments set up here firstly we have a dev environment or we're going to create an application and link to source control we have a test environment where we have atf tests suites pre-set up so that we can run it as a part of rci build and lastly we can validate that the application has been published once we complete the cd part of the pipeline so to start we're going to go to studio and create an application we're going to call it kcon test app 5 and it's going to be a global application and just to make sure that the application does something we have a script in it okay now our global app has global script in it we're going to link to source control here on azure devops we're going to create a new project so that we will have a repo to link to terrific i'm going to copy the link for the git repo come back to studio and plug it in since this is the first time we're creating the application i'm just going to go to branch master and i already have credentials set up from previous agreed now that i'm linked to source control we can come back and check to see if that branch has been published quick our master branch now has an app on it as far as setting up the build we can start with the pipeline here we're going to borrow from the pipeline template that we talked about earlier and we're going to save it before we save it let's make sure that we fill out the environment variables correctly so firstly we have a sys id for the application oops sorry coming back here i'm going to use the same test suite id representing a test suite that i've set up previously and we have three stages here firstly we have a build stage where we're going to apply changes for the branch that's triggering this pipeline and then we'll publish the application as a version we then have a test stage which will install the application run the test suite and then if that fails it will roll back the application so we can clean up the test environment and lastly assuming the build passes the pr is merged and we're going to deploy the production again then we have a final stage of deploying the production by installing that same app version for now we're going to just save it terrific so now we have a pipeline and we have the application there's a few other things that we have to do to set up the pipeline in order to have a run firstly our service connections this defines the credentials for the different endpoints that we have represented in different environments that we have so for example i'm going to create one for our dev environment i already have service accounts set up now i'm going to quickly do it for my test and production environments as well great one more thing that i have to do is set up a branch policy from a master branch this ensures that to merge to a master branch we have to use a port request and that pull request needs to trigger a ci build and have a passing so great now my setup is done we're going to go back to studio or restore on the master branch and check out feature branch so let's create a branch let's first apply remote changes since we've made some changes due to repo and make sure that we're all synced up terrific now let's create a new branch we'll call it a feature branch awesome as a part of this new feature branch we're going to do some development here by creating another script and because we're very creative we're going to call it click on test app 5 script 2. so great we see that we have two scripts here and we're also going to increment the version we'll call it 102. perfect so now we've incremented a version add a new script we are going to commit changes we see both the version as well as the new script include here we're going to commit comment descriptive version and copy the files perfect now let's head back over to azure devops and we'll see that a feature branch has just been committed and pushed and we're going to create a pull request descriptive version it was here that for this pull request there's a few things that are different firstly a build has just been killed and secondly we have an autocomplete feature to merge the pull request if the build completes its passing we're going to use it great so now let's check out the build you can see here that our build has three stages firstly is a build stage where we are applying the changes for this feature branch down to the dev instance and the publishing version of application for a second stage we're going to be installing the application to the test environment and running that atf test suite you'll now see that our build stage has passed once the application has been installed into the test environment and the test tree has run if it is passing then our pull requests can be considered to be complete if it's not passing then we also have a rollback call to clean up the test environment we'll see here that the test stage has completed and coming back to the pull requests we can see that the pull request has been completed as we said auto complete earlier and finally once the branch has emerged into master that triggers another build and deploy for the application into the production environment which we'll see that has just been completed as well so now we checked the production environment we should be able to see that a version of the application has been published for k-con that's that five so what you see here in deaf environment we have click on test app five one zero three and in the production environment we have okay contest contestable one zero three so that concludes our example for how quickly it is to set up a new cicd pipeline for a new application by leveraging our pre-built build steps via our extension and example pipeline template
https://www.youtube.com/watch?v=ncI0etU33P0