Setting up CI/CD
These docs are for version 1.x of Rasa Open Source.
Setting up CI/CD
Even though developing a contextual assistant is different from developing traditional software, you should still follow software development best practices. Setting up a Continuous Integration (CI) and Continuous Deployment (CD) pipeline ensures that incremental updates to your bot are improving it, not harming it.
Overview
Continuous Integration (CI) is the practice of merging in code changes frequently and automatically testing changes as they are committed. Continuous Deployment (CD) means automatically deploying integrated changes to a staging or production environment. Together, they allow you to make more frequent improvements to your assistant and efficiently test and deploy those changes.
This guide will cover what should go in a CI/CD pipeline, specific to a Rasa project. How you implement that pipeline is up to you.
Continuous Integration (CI)
The best way to improve an assistant is with frequent incremental updates. No matter how small a change is, you want to be sure that it doesn’t introduce new problems or negatively impact the performance of your assistant.
Validate Data and Stories
Data validation verifies that there are no mistakes or major inconsistencies in your domain file, NLU data, or story data.
rasa data validate --fail-on-warnings --max-history <max_history>
Train a Model
rasa train
Test the Assistant
Testing your trained model on test conversations is the best way to have confidence in how your assistant will act in certain situations.
rasa test --stories tests/conversation_tests.md --fail-on-prediction-errors
Compare NLU Performance
If you’ve made significant changes to your NLU training data, you should run a full NLU evaluation.
rasa test nlu --cross-validation
Test Action Code
The approach used to test your action code will depend on how it is implemented.
Continuous Deployment (CD)
To get improvements out to your users frequently, you will want to automate as much of the deployment process as possible.
Deploy your Rasa Model
If you ran end-to-end tests in your CI pipeline, you’ll already have a trained model. You can set up your CD pipeline to upload the trained model to your Rasa server if the CI results are satisfactory.
curl -k -F "model=@models/my_model.tar.gz" "https://example.rasa.com/api/projects/default/models?api_token={your_api_token}"
Deploy your Action Server
You can automate building and uploading a new image for your action server, to an image repository for each update to your action code.
Example CI/CD pipelines
As examples, see the CI/CD pipelines for Sara and Carbon Bot. Both use Github Actions as a CI/CD tool.
👋 I can help you get started with Rasa and answer your technical questions.