This tutorial is a guest post from our Developer A-lister Theertha K S, Technical Manager at Mindtree Limited.
If you have an idea for a blog post or tutorial that you think would benefit the Automation Anywhere developer community, let us know at firstname.lastname@example.org.
Automation Anywhere platform supports separate development, testing, acceptance, and production environments for bots—and their dependencies.
Bot Life Cycle Management (BLM) provides a framework for continuous testing and deployment of bots and dependencies in separate software development life cycle (SDLC) environments, allowing bots to seamlessly transition between lifecycle stages defined by the organization before they are released into production.
Bot code files and their dependencies can be exported as a single package from one Control Room and imported into another Control Room.
This export and import of files can be done in 2 possible ways:
Before we learn how to do it in both ways, let’s understand what can be exported from one CR to another.
What can be included?
– Bot files
– Dependent files
– Action Package and dependencies
– Bot insight dashboards
What can’t be included?
– Credentials and credential lockers
– Workload management queues
– Bot runner accounts and permissions
Now let’s explore both the modes in detail:
Steps to export bots are as shown below
– Login to Control Room from which you want to export the bots
– Navigate to the Automation tab
– Go to the Public tab
– Enter the name to export the package
– Expand the Bots folder and select your bot folder
– Select the bot files which you want to include in the package, move them to the Selected section and then click Next
– Review the dependencies tab, and ensure all the required dependent files are selected. If everything looks correct, then click Next.
– In the review packages tab, you can choose to add dependent action packages to be included in the export package. Either all / selected / none can be selected. Click ‘Export bots and files’ button as shown below
– Navigate to Activity > Historical tab
There you can see a record with the package name you entered previously with status as completed. Click on the package name.
– Now you can download the package as a zip file to your local computer’s file system.
Note: For your confirmation, you can review the downloaded zip folder once before you import the package into the target CR.
Steps to import the package are as shown below
– Login to the Control Room to which you want to import the bots
– Navigate to Automation
– Click on the Import Bots button as shown below. You can be in private or public tab, doesn’t matter.
– Browse and select the zip file from your local file system. Choose the options whether you want to import the bot to a Private tab or a public tab and also whether to skip the bot or overwrite the same if it already exists. Here, we will select the Private tab and Skip the bot if it already exists and click Import Bots button
The package will get imported successfully.
Today most software development practices follow automated ways to promote code from one environment to another. This process consists of raising a ticket in business process management tools that track bot promotion or the organizational approvals needed in the ticket tracking systems such as JIRA, Service Now etc.
In either case, a Continuous Integration and Continuous Delivery or CI-CD orchestration tool such as “Jenkins” is used to call the Control Room API, specifically, the Bot Lifecycle Management API, to export and import bots programmatically without the use of the user interface.
Below is the list of API’s to be used to automate the export and import of bots from one CR to another.
Let’s understand these API’s in detail:
The BLM API’s requires authentication token, hence we should get auth token first.
– Get Authentication Token
– The API to get Auth Token based on credentials is: /v1/authentication
– The request and response in Postman tool is as shown below.
Export the bot
– Open the bot and get the bot ID as shown in the URL. Alternatively, this can also be achieved using repository APIs
“fileIds” – if multiple files have to be exported, add them using a comma (,)
– Get the download file id to download it using requestId generated above.
– Download the package file using the downloadFileId. The response is encoded data, that can be decoded as a zip file.
Note: Generate an auth token for the target CR where the package needs to be imported.
Import the bot to target the control room
This part is a little different, so pay close attention to the details. Value for Content-Type in the header should be multipart/form-data. The request body should be of ‘form-data’ with keys as shown below.
– Get the status of import using requestId
Note: BLM API has limited functionality in community edition as Export functionality is disabled, however Importing of bots is allowed.
Automation 360 provides multiple ways to import and export the bots among different Control Rooms as discussed in this tutorial. Choose a method that suits your requirements and skillsets. You can perform a lot more using Control Room APIs.
Check out the following links to learn more about how to use Control Room APIs.
Developer A-Lister and Technical Manager at Mindtree Limited
Theertha is a passionate developer, motivator, mentor, and quick learner. He is a fun-loving and results-focused professional.