Skip to content

Latest commit

 

History

History
 
 

mariobot

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Mario bot

Mario is an experimental bot that automates tasks in the plumbing repository.

It's intended to be used as a Tekton Webhook endpoint.

Usage

Mario responds to comments on issues received via GitHub hook events.

Triggering builds

Currently the only recognised command is build:

Adding a comment like this to an issue:

/mario build tekton/images/tkn tkn:mario

This will respond with a JSON body something like this:

{
  "buildUUID": "81799043-9591-4b1d-bb00-ca76e1ced916",
  "gitRepository": "github.com/tektoncd/plumbing",
  "gitRevision": "pull/20/head",
  "contextPath": "tekton/images/tkn",
  "targetImage": "gcr.io/tekton-releases/dogfooding/tkn:mario",
  "pullRequestID": "20"
}

These fields can be picked up in a template binding:

apiVersion: tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
  name: mario-trigger-binding
spec:
  params:
  - name: buildUUID
    value: $(body.buildUUID)
  - name: gitRepository
    value: $(body.gitRepository)
  - name: gitRevision
    value: $(body.gitRevision)
  - name: contextPath
    value: $(body.contextPath)
  - name: targetImage
    value: $(body.targetImage)
  - name: pullRequestID
    value: $(body.pullRequestID)

Triggering from an Event Listener

As this is a Webhook interceptor it needs to be configured in the list of interceptors for a trigger:

It does its own GitHub secret validation.

apiVersion: tekton.dev/v1alpha1
kind: EventListener
metadata:
  name: mario-image-builder
spec:
  serviceAccountName: mario-listener
  triggers:
    - name: trigger
      interceptors:
        - webhook:
            objectRef:
              kind: Service
              name: mario
              apiVersion: v1
              namespace: mario
      bindings:
        - ref: mario-trigger-binding
      template:
        ref: mario-trigger-template

Configuring the GitHub secret

The Mario Bot requires a GitHub Hook Secret in the environment variable token.

The bot uses secrets in the dogfooding cluster.