Triggering Dispatch pipelines using ChatOps
Prerequisites
This tutorial assumes that you followed the steps on following pages:
- Dispatch Installation
- Setting up a Repository in Dispatch
- Checked out the “hello-world” repository on your laptop
- Configured the “hello-world” application for Dispatch CI (via
dispatch ci repository create
)
Introduction
In this tutorial, a task test will be triggered by defining and using a ChatOps command "/test
Configure ChatOps Trigger in Dispatchfile
To use the ChatOps feature, you must include a ChatOps action to trigger when a chat event occurs. As an example, we will examine a task written in Starlark from the pipeline configuration docs
The following action:
action(tasks = ["test"], on = pullRequest(chatops = ["test"]))
runs the task test
when there is a pull request when commented with /test
. However, you can trigger the task with any word trailing a slash (/
) for more details refer the configuration reference.
- Configure the tests to run in verbose mode, to enable viewing logs as the tests execute. Start by creating a new branch on the hello-world repo:
- Make the change to the
test
task by changing thecommand
to the following:
- Add, commit, and push the changes to the git repository.
- Open a Pull Request on GitHub. If you are unfamiliar, refer to the following documentation on GitHub
- Trigger a test by commenting
/test
on our Pull Request. To view the run, navigate to your Dispatch dashboard.