Skip to content

github

Trigger GitHub workflows via a repository_dispatch.

A repository_dispatch will trigger workflows in the default branch of the GitHub repository. By default, the experiment report will also be sent.

Usage Example

iter8 launch \
--set "tasks={http,assess,github}" \
--set http.url=http://127.0.0.1/get \
--set assess.SLOs.upper.http/latency-mean=50 \
--set assess.SLOs.upper.http/error-count=0 \
--set github.owner=<GitHub owner> \
--set github.repo=<GitHub repository> \
--set github.token=<GitHub token> \
--set runner=job

See here for a more in-depth tutorial.

Parameters

Name Type Required Default value Description
owner string Yes N/A Owner of the GitHub repository
repo string Yes N/A GitHub repository
token string Yes N/A Authorization token
payloadTemplateURL string No https://raw.githubusercontent.com/iter8-tools/hub/iter8-0.12.2/templates/notify/_payload-github.tpl URL to a payload template
softFailure bool No true Indicates the task and experiment should not fail if the task cannot successfully send the request
if string No N/A An if condition that can be control when the task is run in a multi-looped experiment. To learn more, see here.

Default payload

A repository_dispatch requires a payload that contains the type of the event.

The default payload template will set the event_type to iter8. In addition, it will also provide the experiment report in the client_payload, which means that this data will be accessible in the GitHub workflow via ${{ toJson(github.event.client_payload) }}.

However, if you would like to use a different payload template, simply set a payloadTemplateURL and Iter8 will not use the default.

if parameter

The if parameter is used to control when the task is run in a multi-looped experiment. For example, if you would like for the github task to only run at the 10th loop instead of every loop, you can do the following:

  iter8 launch \
  --set "tasks={http,assess,github}" \
  --set http.url=http://127.0.0.1/get \
  --set assess.SLOs.upper.http/latency-mean=50 \
  --set assess.SLOs.upper.http/error-count=0 \
  --set github.owner=<GitHub owner> \
  --set github.repo=<GitHub repository> \
  --set github.token=<GitHub token> \
+ --set github.if="Result.NumLoops == 10"
  --set runner=job

You may use any field in the Result object for your logic.

Back to top