triggers: CLI tool for manual Trigger runs

Expected Behavior

I can easily test out their Trigger config e.g. does the CEL expression work, does my binding expression extract the right variable, does my trigger template replace the right variable etc.

Actual Behavior

I have to setup an EventListener, TriggerBinding, and TriggerTemplate. I have to port-forward to the Listener, and make a curl call, and then look into the Listener logs to figure out what happened.

Additional Info

Example CLI surface from discussing with @bigkevmcd :

triggers-run -H "X-GitHub-Event: testing" -d @testing.json -f triggers.yaml
  1. triggers.yaml is a file containing the trigger definitions
  2. The CLI supports curl like flags for sending headers and body
  3. The tool will prints out the trigger processing logs to stdout
  4. It will also print out the fully formed Tekton resource to be created once the trigger is processed instead of creating them

Out of scope for now:

  1. Testing Trigger level service account permissions

Can be added later:

  1. Actually create the resources instead of just printing them out
  2. Dry run against a already running listener instead of definitions from a file
  3. Make it part of the tkn surface e.g. tkn trigger run ....
  4. Account for the Trigger service account permissions

Related :

  1. TriggerTemplateRun #200
  2. Binding eval tool #314

/kind feature

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Any reason for not pushing for having this in tkn early ? 🤔

Reading this, it sounds like more of a proof of concept/basic requirements at this point and could potentially be added to tkn later on (e.g. tkn trigger run under Can be added later) if understanding correctly? Either as part of tkn itself or maybe could be added as some type of plugin to tkn if that would be a more preferred route.

But I would see no reason not to want something like this as part of tkn. Just would maybe need some thought on where it would best fit structurally.