Friday, July 19, 2019

Azure DevOps – New Era – Create New Build Pipeline

Ref :

In my Previous article I shared about “how to start with AzureDevOps and how to create new organization”. AZURE DEVOPS – A NEW ERA Here in this we will proceed further where we left and will create New Build pipeline with the impressive User interface.
Here I have a small application which has the following structure shown below as screen shot app-structure

I have already placed in Azure GitHub , To push your code from VS code you can refer this url :
I’m assume so far you would have pushed your code there and we are ready to go.
Create a new project and follow the following steps
Step1: Refer image create-project-first ,create-project-two and create-project-success

Go to pipeline -> Builds-> New Pipeline and click . refer an image new-pipeline

As soon as you create new pipeline it reaches to the windows from there you would be able to select the classic editor as shown below in screen shot:
So choose Use the classic editor to create a pipeline without YAML.

After completing this you will reach on the page where you will have to select code repository
These repository are as follows:
  1. ·         Azure Repose Git
  2. ·         GitHub
  3. ·         GitHub Enterprise Server
  4. ·         Subversion
  5. ·         Bitbucket Cloud
  6. ·         Other Git

For my purpose I’ve selected Azure Repos Git , which we have already created above.
Kindly refer a screen shot for reference and click on Continue. Refer image Azure-repose-git


As soon as you go with above steps it takes you on the page where you have to choose one of the templates which you can consider as ‘Configuration as Code’. For my purpose I will select Empty job as shown top right of screen. Refer image Empty-job

After selecting Empty Job you will be redirecting to next level ,where you should be able to see the Pipeline details as well as Agent Job details on the right side of screen. The entire screen will be divided into two parts.

Kindly fill the desire details like Display Name and AgentPools . Agent Pools is defined as follows
When you queue a build, it executes on an agent from the selected pool. You can select a Microsoft-hosted pool, or a self-hosted pool that you manage.

To reach up to this level you have to click on the (+) icon right to the Agent Job 1 and you will get the screen just on the right side.

Step 1: Firstly, click on the (+) icon to proceed , As soon as you click on the + icon you will have a window appears on the right side . Search for “Copy Files” from and fill the required details. Please follow the screen shots Copy-Files.jpg

Once you select this please fill the essentials details in the page appears. Kindly follow the upcoming screen shots copy-files and target-folder

Target folder is the place where we keep our code base at pipeline level and further we will use this for publishing it.
NOTE: You can understand this in such a way that the local path on the agent where any artifacts(e.g. layman) are copied to before being pushed to their destination. For example: c:\agent_work\1\a 

A typical way to use this folder is to publish your build artifacts with the 
Copy files and Publish build artifacts tasks. Reference Microsoft

Note: This directory is purged before each new build, so you don't have to clean it up yourself.
Click on the (+) button next to  Agent Job 1  and choose the publish build artifact. At this level we have to give the path of the folder which we want to publish. As we remember in last step we copied the artifacts in : $(Build.ArtifactStagingDirectory). The same folder  or file path to publish. This can be a fully-qualified path or a path relative to the root of the repository. Wildcards are not supported. Variables  are supported. Example: $(Build.ArtifactStagingDirectory).

There are 4 properties which we will consider in our scenario .

1.     1. Display name :  Name can be anything as per your choice like Publish Artifact: drop
2. Path to publish : The folder or file path to publish. This can be a fully-qualified path or a path relative to the root of the        repository
3.  Artifact name: The name of the artifact to create in the publish location.
4.  Artifact publish location : Choose whether to store the artifact in Azure Pipelines, or to copy it to a file share that must be accessible from the build agent.

Refer and image publish-artifact as shown below:

Step3: Click on the (+) button next to  Agent Job 1  and choose the publish build artifact. Here we will be managing ARM templates for CI-CD pipeline because we are creating resources with help of ARM templates or azure automation . Fill the required details on the page .Please refer an image arm-templates-publish-build-artifacts as shown below:

If you notice, Templates folder is there  in “path to publish”  property. You can get that after clicking on the “…” button right to this. Once you click on this it prompts you a pop-up to choose the path for templates from azure repos as shown in image arm-templates-files. This is mush needed to create our resources on the fly, we will be utilizing this in azure release pipeline further.

Note: I’ll write a separate article on Azure templates also.

Once you are done with all above required steps than choose save & queue option from dropdown 

appears top in the tabs section , as you save , it triggers the build .Kindly find one of the screeb=n shot as 
depicted in image save-and-queue .

You can also trigger it manually from the user interface from the Build pipeline once you have saved your pipeline .There should be a QUEUE button on top right corner , click on Queue button window should appear to run the pipeline . Choose Hosted VS 2017 and choose branch we desire to build against. Once it is completed you should be able to see the green tick mark on the right side.
 Refer build-pipeline image show below:


Post a Comment