Skip to content

Draft: Add ProjectAutomationHook to run Automations reactively

Tao Guo requested to merge astao/automation/trigger_by_hooks into master

What does this MR do and why?

As discussed in gitlab-org/incubation-engineering/no-code-low-code/meta#26 (moved), this MR introduces the ProjectAutomationHook that piggybacks on the WebHook's event subscription for triggering Automations. The actual job execution is to be added in the subsequent MRs.

The current solution aims to reuse the existing capability to kick off the iteration of the Automation MVC (incubation project), with the longterm plan to migrate over to CI Workflow's event architecture when it's ready.

Pending tasks

  • Initial review by the SMEs to confirm the direction
  • Complete unit tests
  • Link todo to issues

How to set up and validate locally

  1. In Rails console, create a new automation hook for a given project, e.g.
    Project.first.automation_hooks.create!(url: "file://.gitlab/automations/issue_resolver.yml")
  2. tail the application log.
    tail -f log/application.log
  3. Create or update an issue on the project
  4. Check the log message similar to:
    2023-01-16T08:51:45.992Z: Placeholder message for upcoming automation job execution for issue_hooks

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tao Guo

Merge request reports