Talk to your Bamboo Server Using Amazon Echo/Alexa

Addteq’s Development Team recently took part in Amazon’s Hackathon on DevPost.com called, Amazon Alexa Skills Challenge. For the competition we decided to create a skill that allowed users to interact with their Atlassian Bamboo server via Alexa. We created four main interactions, that can be triggered by the following phrases:

  • “Alexa, ask Build Meister, what is the last build status?”
  • “Alexa, ask Build Meister, what was the last successful build?”
  • “Alexa, ask Build Meister, what was the last failed build?”
  • “Alexa, ask Build Meister, to trigger a new build”

The overall architecture of the skill can be seen through the Gliffy diagram below. This involved the user to link their Alexa account to their Bamboo server via a proxy node service. The node service was used to provide clients ease of mind as they are in full control of where the node service sits, thus allowing them complete security with their Bamboo credentials. From the diagram below, we see that development of the skill would involve five main components: The lambda code for the Alexa skill, Account Linking Form, Proxy Node Server, API Gateway paths, and the Lambda functions that served as endpoints for the API paths.

Alexa Skill 

The Alexa skill was designed to be very generic, since we are not storing any information regarding the user’s CI tool. The skill makes requests to nodeproxyservice in order to retrieve information from the CI tool. All requests are secured by using an authorized token shared during the skill and proxy service setup.  The skill serves two different responses. If the response from the proxy service consists of more than one object, the skill announces the list of options available and requests a choice from the user. If the response consists of one object, then the skill announces the results from the proxy service.

The different intents supported by the skill so far are

  • Last Build status
  • Last Successful Build
  • Last Failed Build
  • Trigger a New Build

Each of these intents have dedicated REST end points in the node proxy service. Users can customize the node proxy service to extend the integration to other build tools and control responses to the Alexa Skill

Account Linking Form

When connecting Alexa skills with software that requires the user to login to an external service, the user needs to be authenticated. This authentication is handled by the Amazon structure called account link. The process for this account linking is:

  1. The user is presented with a form that allows them to enter their credentials for the connecting service.
  2. This form is then sent to the backend for authentication.
  3. Once authentication is completed, the user is redirected to a confirmation page that shows if their account is now linked to Alexa or not.

The account linking form for the Build Meister skill is being hosted on Google Firebase’s Hosting platform, using a simple HTML/CSS web form. The account link form requires a user to enter the url of their proxy server as well as the authorization key of the same server. The proxy server contains the Bamboo credentials which would be requested from the lambda function that handled the account linking process. 

Proxy Node Server

One of the security concerns involved in the Skill was, users had to provide the username and password to their CI tool so that the skill can query the tool for information. There might also be scenarios where the CI tool is hosted internally as a result of the Alexa skill not being able to reach the tool. In order to overcome these issues, we create a proxy service that can hold the credentials to the CI tool and be hosted by the user within their network. The user can expose port 3000 by using any webserver of their choice.  The proxy service listens for requests from the Alexa Skill using Authorized keys, which are setup as part of the account linking and responds with information after querying the CI tool.

Currently the proxy service contains modules which query the Atlassian Bamboo server for build information. But users can customize the service to create new modules that can query other CI tools like Jenkins.

API Gateway Paths and Lambda Endpoints

We used the Amazon Web Service as the main API server and cloud code repository. All intents made by Alexa required a call to the /query/{account-id} endpoint hosted on the AWS API Gateway. This REST endpoint forwards all requests to a lambda function which searches DynamoDB for the specific account and returns the proxy server url and authorization key. Thus allowing Alexa to make requests to Bamboo through the proxy server. 

The other endpoint hosted on the AWS API Gateway was used for account linking. This endpoint forwards its requests to another lambda function which verifies that the provided proxy server url was an actual server endpoint and that the server contains a valid SSL certificate. Once these checks come back successfully a new user account is created within the DYnamoDB database.

At the time of writing this blog, the Build Meister skill was in the ‘Judges Review’ stage of the Amazon Alexa Skills Challenge. Anyone can help the skill along by going to the link below and clicking the ‘Like’ button on the page. The Build Meister skill is currently on the Alexa Skills Store for public use, go to the Alexa Skills Store and give it a try. 

See More blogs by Adisa

Related Content
work from anywhere
Embracing the Freedom: Work from anywhere
If our products can be used from anywhere, we should also be able to work from anywhere. This blog shows...
Be_Unstoppable
Jira Accessibility: Best Practices for enhancing collaboration
Jira is a powerful tool to streamline workflows and enhance productivity. This blog explores four best...
addteq_fb_collab4b
The Perfect Match: Confluence & Excellentable
Discover the perfect match for your team's collaboration needs this Valentine's Day. Learn how to seamlessly...

Leave a Reply

Your email address will not be published. Required fields are marked *