Implement CICD Pipeline For UiPath Project Using Azure DevOps Pipelines

How to implement CICD Pipeline for UiPath Project Using Azure DevOps Pipelines?

  1. Create a new project from the Studio or use an existing project from any version control. Currently using GitHub.
  2. With one “main.xaml“ file along with two test cases.

  1. If creating a new project from the Studio. Connect the project to the version control and push the code to it.

  1. After performing the above steps. My project is connected to GitHub. Start the configuration in Azure DevOps.
  2. Create an account at https://dev.azure.com/.
  3. Once the account is ready. The home page looks like below.

61.jpg


Prerequisites

  1. Enable the “Uipath integration” extension.
  2. Npm should be installed.
  3. Activate the agent.



Enable the “UiPath Integration” extension

  1. Click on “Organization settings” on the Azure DevOps home screen.
  2. Click on the “Extensions” options from the left side of the menu.
  3. Click on “Browse Market Place” from the right side of the panel.
  4. Search with the “UiPath” keyword you will get two products UiPath integration, UiPath test manager
  5. Install “UiPath integration extension”.
  6. After installation, see “UiPath integration extension” in installed tabs.

Npm Installation

  1. Download the latest version of the node setup based on the operating system.
  2. After the installation. Verify whether npm is installed or not by using the following command.

n.jpg

  1. If it displays the version number, installation is successful.

Activate the Agent

  1. Click on “Organization settings” on the Azure DevOps home screen.
  2. Click on “Agent pools” from the left-hand side menu.
  3. It will show two options on the right side “Azure Pipelines”,” Default”.
  4. Select the Default option.
  5. Click on the “New Agent” button
  6. Another window will pop up. Kindly please select the respective operating system.
  7. Download the agent by clicking on the download button.
  8. Perform the steps as mentioned in the popup.

  1. After performing the above steps. It will ask a set of questions.
  2. Server url: https://dev.azure.com/XXXXXXXXXX(Example)
  3. Enter authentication type (press enter for PAT) -> Get PAT from Azure DevOps home screen -> Click on user settings icons -> click on option “Personal access token”.
  4. Click on create a new token option-> Provide some name to and choose full access as the scope-> Hit on create button.
  5. Make note of the PAT key.
  6. Kindly provide PAT key in the power shell and hit enter.

  1. Creating an agent in the default pool. So, No need to provide any name just hit enter.
  2. It will ask “Agent name”. Just hit enter. So, It will create an agent name with your system name.
  3. It will ask “Work folder” path. I am hitting enter. So, the project files will save in “C:\agent\_work” by default.
  4. Choose “n” for the next two.
  5. Execute the “.\run” command
  6. Finally, agent is ready to execute the jobs and pipelines. To verify whether the agent is online or offline. Navigate to agent pools -> Default. There observe the status of the agent.

11.jpg

  1. Click on the new project button. Kindly please provide the azure project name and choose either private or public. In this scenario, public is chosen.
  2. See projects in the projects tab.

12.jpg

  1. Click on the newly created project. In this scenario, clicking “Azure_CICD_Example”.
  2. Navigate to the newly created project. Configure the Orchestrator connection with Azure DevOps.
  3. Find the “Project Settings” option at the bottom left
  4. Click on “Project settings” -> “Service Connections” -> “New service connection” -> Type “UiPath” -> Select “UiPath Orchestrator Connection”.
  5. Click on “Next”.
  6. See 3 options to configure orchestrator connection.” Basic Authentication”, “Token-based Authentication”, “ External Application”.
  7. In this scenario, “Token-based Authentication” is chosen
  8. To get that information, open “community version Orchestrator” -> Click on “More” -> select “Admin” -> Select “Tenants” option-> Choose on which tenant to create a project -> Expand the tenant. In this scenario, tenant name is “Expleo Solutions” -> Select more options at Orchestrator -> Click on “API Access”.

  1. A window gets pop up. It has all the information regarding token-based authentication.

  1. Orchestrator URL, Account logical name, API key(User Key),Tenant(Tenant name), Service connection name(You can provide any name ).
  2. Select the “Grant access permission to all pipelines” checkbox.
  3. Once completed, it will show as below. In this scenario, the service connection name is given as “UiPath_Testing”.

13.jpg

  1. Click on the new pipeline -> Select GitHub option.
13.jpg
  1. Provide the GitHub credentials to access GitHub and select the project which you have pushed.
  2. Select Starter.yaml option.
  3. It will automatically create a Yaml file.
  4. In that change pool to default. Because the agent is located at “Default”.
1.jpg
  1. Next, add the UiPath Pack task to the YAML file. To do that, click on Show assistant and search for UiPath Pack. Choose your personal preference for the Versioning Method and Trace Level. Then, select the Service Connection in the Orchestrator Connection dropdown. Under Project(s) Path, type $(Build.SourcesDirectory). Finally, under Output Path, type $(Build.ArtifactStagingDirectory)\Output
2.jpg
  1. Add the UiPath. Test task to execute an existing test set in Orchestrator. Similar to adding UiPath Pack task, search for the UiPath Test task in Show Assistant. There are two test execution methods. The Execute test set method will run a preexisting test set in Orchestrator, while the Execute tests in project method will run tests in the transient project. If you select the Execute test set method, you need to create a test set in Orchestrator first, then provide the test set name in the Test set field.
  2. In this scenario, choose the Execute tests in project method. Specify the service connection and Orchestrator folder, then click on Add.
3.jpg
  1. Finally, search for Publish Build Artifact task in Show Assistant, give the Artifact a name, then click on Add. Congrats, you completed the build pipeline for your automation project. Proceed with saving the YAML file. Run the pipeline to verify the result.

4.jpg

Step 7: Create a Release pipeline

Finally, learn how to create a release pipeline for the automation process. At this stage, automation process will be deployed to a production environment.

  1. First, go to the Releases tab under the Pipeline section and select New pipeline. It will ask to select a template. Close it for now.

  1. Click on the Add an artifact block, select the Source Type as Build, choose the project and the build pipeline configured in the previous step, and click Add.

  1. Then, move on to the Stages block and click on Add a Stage → select Empty job → click on 1 job, 0 task link.

  1. Notice Agent job under the Tasks tab. Click on it to open the Agent job page. On the Agent job page, under the Demands section, add "npm". Next, click on the "+" icon next to Agent job to add a new task to the agent job.

  1. Search for "UiPath Deploy" here, add it, and configure the Orchestrator connection, Orchestrator folder. Click on "…" to browse the package path and point it to the Output directory of your folder. Click on Save.

  1. Then, go to the Pipeline tab, click on the lightning icon under Artifacts, and enable the Continuous Deployment trigger and save it again. This meant that whenever a build was created a release pipeline would be triggered. After that, click on Save to save all changes.

  1. Finally, click on the Create Release button right next to the Save button. Select the stage you just created in the previous steps, and click Create.

  1. Both the build pipeline and release pipeline built now. To test whether the pipeline works, you can commit a code change in your automation process.

Then, you should be able to see the build pipeline is triggered, which will pack the automation process into a NuGet package and execute the test cases in Orchestrator. After the build pipeline runs successfully, the release pipeline will be triggered spontaneously to deploy the automation process to the destined folder in Orchestrator.

2 Likes