Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(recipe): refactor run-on-event recipe structure #835

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

donch1989
Copy link
Member

@donch1989 donch1989 commented Nov 12, 2024

Because

  • Previously, we used the following format to set up the run-on-event and run-on-schedule recipes. For certain application events, we'll use a polling method to capture the event, which overlaps with the run-on-schedule functionality.
    on:
      event:
        <event-id>:
          type: slack
          event: EVENT_NEW_MESSAGE
      schedule:
        <schedule-id>:
          cron:
    

This commit

  • merges run-on-event and run-on-schedule and refactors recipe structure to use the following new format
    on:
      <event-id>:
        type: slack
        event: EVENT_NEW_MESSAGE
        config:
          channel: xxx
        setup: ${connection.xxx}
    
      <schedule-id>:
        type: schedule
        event: EVENT_SCHEDULE
        config:
          schedule: 
            cron: 
              - '30 2 * * *' 
    

Copy link

linear bot commented Nov 12, 2024

@donch1989 donch1989 marked this pull request as draft November 12, 2024 15:32
Setup map[string]any `json:"setup,omitempty" yaml:"setup,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Event string `json:"event,omitempty" yaml:"event,omitempty"`
Config map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
Copy link
Member Author

@donch1989 donch1989 Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jvallesm,

I’d like to discuss an idea with you.

I’m currently refactoring the run-on-event recipe, which requires both an event-specific configuration and a connection setup. Here’s an example:

on:
  <event-id>:
    type: slack
    event: EVENT_NEW_MESSAGE
    config:
      channel: xxx
    setup: ${connection.my-slack}

Having both config and setup feels a bit confusing. Would it be clearer if we renamed setup to connection?

on:
  <event-id>:
    type: slack
    event: EVENT_NEW_MESSAGE
    config:
      channel: xxx
    connection: ${connection.my-slack}

If so, we’ll also need to update the setup field to connection in our component tasks for consistency. What do you think?

component:
  slack-0:
    type: slack
    task: TASK_XXX
    input: 
    connection: ${connection.my-slack}

@donch1989 donch1989 marked this pull request as ready for review November 12, 2024 15:41
@donch1989 donch1989 marked this pull request as draft November 12, 2024 15:41
@donch1989 donch1989 marked this pull request as ready for review November 12, 2024 15:42
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 20.12%. Comparing base (7e5d3de) to head (10d06f8).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
pkg/service/pipeline.go 0.00% 8 Missing ⚠️
pkg/service/convert.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #835      +/-   ##
==========================================
+ Coverage   20.01%   20.12%   +0.10%     
==========================================
  Files         354      355       +1     
  Lines       74750    75015     +265     
==========================================
+ Hits        14963    15095     +132     
- Misses      57571    57693     +122     
- Partials     2216     2227      +11     
Flag Coverage Δ
unittests 20.12% <0.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@donch1989 donch1989 merged commit 78ea418 into main Nov 13, 2024
15 checks passed
@donch1989 donch1989 deleted the huitang/ins-6835 branch November 13, 2024 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants