"DevOps is the union of people, process, and products to enable continuous delivery of value to our end users." - Donovan Brown, Microsoft
DevOps is a "culture" which have a set of practices that combines software development (Dev) and information-technology operations (Ops) which aims to shorten the systems development life cycle and provide continuous delivery with high software quality. DevOps culture develops "production-first mindset".
In terms of Alexa, DevOps can help us to quickly ship the highest quality of our Skill to the end customers.
This post contains materials from different resources that can be seen on Resources section.
Prerequisites
Here you have the technologies used in this project
The Alexa Skills Kit Command Line Interface (ASK CLI) is a tool for you to manage your Alexa skills and related resources, such as AWS Lambda functions.
With ASK CLI, you have access to the Skill Management API, which allows you to manage Alexa skills programmatically from the command line.
If you want how to create your Skill with the ASK CLI, please follow the first step explained in my Node.js Skill sample.
We are going to use this powerful tool to do some steps in our pipeline. Let's DevOps!
Pipeline
Let's explain job by job what is happening in our powerful pipeline.
First of all, each box on the left represented in the image above is a job and they will be defined below the jobs node in the GitHub Actions Workflow configuration file:
Checkout
The checkout job will execute the following tasks:
Checkout the code
Bring execution permission to be able to execute all the tests
checkout:runs-on:ubuntu-latestname:Checkoutsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|chmod +x -R ./test;ls -la
Build
The build job will execute the following tasks:
Checkout the code.
Run npm install in order to download all the Node.js dependencies, including dev dependencies.
build:runs-on:ubuntu-latestname:Buildneeds:checkoutsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|cd lambda;npm install
Pretests
The pretest job will execute the static code quality check. Check the full explanation here.
Test
The test job will execute the unit tests. Check the full explanation here.
Code Coverage
The codecov job will execute the code coverage report. Check the full explanation here.
Deploy
The deploy job will deploy the Alexa Skill to the Alexa cloud in the development stage. Check the full explanation here.
Testing the Voice User Interface
These jobs will check our interaction model. Check the full explanation here.
Integration tests
These jobs will check the interaction model and our backend as well. Check the full explanation here.
End to end tests
These jobs will check the full system using the voice as input. Check the full explanation here.
Validation tests
These jobs will validate your Alexa Skill before submitting it to certification. Check the full explanation here.
Submit
These jobs will submit your Alexa Skill to certification. Check the full explanation here.
Store-artifacts
The store-artifacts job will execute the following tasks:
Restore the code that we have used in the previous step in /home/node/project folder
Clean node_modules folder
Store the entire code of our Alexa Skill as an artifact. It will be accessible in GitHub Actions whenever we want to check it out.
store-artifacts:runs-on:ubuntu-latestname:Submitneeds:submitsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2}-name:Upload codeuses:actions/upload-artifact@v2with:name:codepath:${{ github.workspace }}
Workflow
The GitHub Actions Workflow which will execute the jobs explained above configuration file is located in .github/workflows/main.yml:
on:[push]jobs:checkout:runs-on:ubuntu-latestname:Checkoutsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|chmod +x -R ./test;ls -labuild:runs-on:ubuntu-latestname:Buildneeds:checkoutsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|cd lambda;npm installpretest:runs-on:ubuntu-latestname:Pre-testneeds:buildsteps:# To use this repository's private action,# you must check out the repository# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|cd lambda;npm install;npm run lint;npm run lint-html-name:Upload resultsuses:actions/upload-artifact@v2with:name:eslint-reportpath:lambda/reports/eslint/test:runs-on:ubuntu-latestname:Testneeds:preteststeps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|cd lambda;npm install;npm run test-name:Upload resultsuses:actions/upload-artifact@v2with:name:unit-tests-report-htmlpath:lambda/mochawesome-report/-name:Upload resultsuses:actions/upload-artifact@v2with:name:unit-tests-report-xmlpath:lambda/reports/mocha/codecov:runs-on:ubuntu-latestname:Code Coverageneeds:teststeps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|cd lambda;npm install;npm run codecovenv:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}deploy:runs-on:ubuntu-latestname:Deployneeds:codecovsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;sudo apt-get install -y jqcd lambda;npm install;npm run copy-package;cd src;npm run build-production-run:ls -la && ask deploy --ignore-hashenv:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}check-utterance-conflicts:runs-on:ubuntu-latestname:Check Utterance Conflictsneeds:deploysteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;chmod +x -R ./test;cd test/vui-test/;./interaction_model_checker.sh $SKILL_ID v2env:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}check-utterance-resolution:runs-on:ubuntu-latestname:Check Utterance Resolutionneeds:deploysteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;chmod +x -R ./test;cd test/vui-test/;./utterance_resolution_checker.sh $SKILL_ID v2env:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}check-utterance-evaluation:runs-on:ubuntu-latestname:Check Utterance Evaluationneeds:deploysteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;chmod +x -R ./test;cd test/vui-test/;./utterance_evaluation_checker.sh $SKILL_ID v2env:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}integration-test:runs-on:ubuntu-latestname:Integration testneeds:check-utterance-evaluationsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;chmod +x -R ./test;sudo apt-get install -y expectcd test/integration-test/;./simple-dialog-checker.sh $SKILL_IDenv:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}end-to-test:runs-on:ubuntu-latestname:End-to-end testneeds:integration-teststeps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;sudo npm install -g bespoken-tools;chmod +x -R ./test;bst test --config test/e2e-bespoken-test/testing.jsonenv:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}-name:Upload codeuses:actions/upload-artifact@v2with:name:bespoken-reportpath:test_output/validation-test:runs-on:ubuntu-latestname:Validation testneeds:end-to-teststeps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;chmod +x -R ./test;cd test/validation-test/;./skill_validation_checker.sh $SKILL_ID v2env:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}submit:runs-on:ubuntu-latestname:Submitneeds:validation-teststeps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-run:|sudo npm install -g ask-cli;chmod +x -R ./test;cd test/submit/;./submit.sh $SKILL_ID v2env:# Or as an environment variableCODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}ASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}store-artifacts:runs-on:ubuntu-latestname:Store Artifactsneeds:submitsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-name:Upload codeuses:actions/upload-artifact@v2with:name:codepath:${{ github.workspace }}
GitHub Action
After explain the pipeline, it is important to explain the GitHub Action which are using the Docker image that you can use in your pipelines.
With the above Docker image a GitHub Action has been created in order to run ASK CLI Commands:
You can use the following example as a way to start:
-name:Alexa ASK AWS CLI Actionuses:xavidop/alexa-ask-aws-cli-docker@v1.0.6id:commandwith:command:'ask--version'env:# Or as an environment variableASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}# Use the output from the `hello` step-name:Get the outputrun:echo "The result was ${{ steps.command.outputs.result }}"
Or for example using it in a workflow:
on:[push]jobs:test-action:runs-on:ubuntu-latestname:Test Actionsteps:# To use this repository's private action,# you must check out the repository-name:Checkoutuses:actions/checkout@v2-name:Test action stepuses:xavidop/alexa-ask-aws-cli-docker@v1.0.6id:askwith:command:'ask--version'env:# Or as an environment variableASK_ACCESS_TOKEN:${{ secrets.ASK_ACCESS_TOKEN }}ASK_REFRESH_TOKEN:${{ secrets.ASK_REFRESH_TOKEN }}ASK_VENDOR_ID:${{ secrets.ASK_VENDOR_ID }}AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }}AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }}SKILL_ID:${{ secrets.SKILL_ID }}# Use the output from the `hello` step-name:Get the outputrun:echo "The result was ${{ steps.ask.outputs.result }}"
It is important to add that the GiHub Action are using the latest version of the ASK CLI.
You can find all the explanation in this repo.
Docker container for ASK CLI and easy to use in devops pipelines
Docker image for ASK and AWS CLI
The purpose of this container is to be able to use the Amazon ASK CLI and Amazon AWS CLI in a Docker container in DevOps pipelines.
NOTE: This is a fork from martindsouza image with these changes:
Image base is the latest LTS version instead of the current version of Node.js.
Added ASK_CLI_VERSION build argument in order to be able to work with different ASK CLI versions.
Added git and zip packages that ASK CLI will use in its commands.
Added Bespoken.
Added jq and expect cli commands.
Remove volumes. I think it is not necessary in a simple docker image that I will use in my DevOps pipelines. In addition, you can use '-v' argument in docker run command whenever you want.
ASK Config
You have to take into account that you have to have an Alexa Developer account to be able…
This is the first step to know how to DevOps your Alexa Skills using GitHub Actions.
As you have seen in this example, the Alexa Tools like ASK CLI can help us a lot. We will update this readme while we are updating the pipeline.
I hope this example project is useful to you.
Alexa skills can be developed using Alexa Lambda functions or a REST API endpoint
Lambda function is Amazon's implementation of serverless functions available in AWS.
Amazon recommends using Lambda functions despite they are not easy to debug.
While you can log to a CloudWatch log, you can't hit a breakpoint and step into the code.
This makes live debugging of Alexa requests a very hard task
In this post, we will implement a custom skill for Amazon Alexa by using Node.js, npm and AWS Lambda Functions. This skill is basically a Hello World…