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

Support multiple value updates in EventWatcher #5088

Open
tom-256 opened this issue Jul 28, 2024 · 1 comment
Open

Support multiple value updates in EventWatcher #5088

tom-256 opened this issue Jul 28, 2024 · 1 comment
Labels
kind/enhancement New feature or request

Comments

@tom-256
Copy link

tom-256 commented Jul 28, 2024

What would you like to be added:

Enhance the event watcher feature to support multiple data updates in a single event registration, with the ability to associate specific data with specific file updates.

Example configuration:

eventWatcher:
  - matcher:
      name: multi-update
      labels:
        env: dev
        appName: helloworld
    handler:
      type: GIT_UPDATE
      config:
        replacements:
          - file: deployment.yaml
            yamlField: $.spec.template.spec.containers[0].image
            dataKey: image
          - file: config.yaml
            yamlField: $.data.version
            dataKey: version
          - file: ingress.yaml
            yamlField: $.spec.rules[0].host
            dataKey: hostname

Example command:

pipectl event register \
    --address=CONTROL_PLANE_API_ADDRESS \
    --api-key=API_KEY \
    --name=multi-update \
    --labels env=dev,appName=helloworld \
    --data image=gcr.io/pipecd/helloworld:v0.2.0 \
    --data version=1.2.3 \
    --data hostname=example.com

Why is this needed:

  • Flexibility: Users often need to update multiple related configurations simultaneously
    • For example:
      • Update the image tag version
      • Declare the current image tag version as an environment variable
  • Efficiency: Allowing multiple updates in a single event reduces the number of separate events that need to be registered and processed.
@tom-256 tom-256 added the kind/enhancement New feature or request label Jul 28, 2024
@t-kikuc
Copy link
Member

t-kikuc commented Jul 29, 2024

Thank you for your great suggestion.

The (only one?) difficulty seems to be how to keep the compatibility of Event.data.

Probably, we have two ways:

  • a. Add a new field (e.g. dataList []string)
  • b. Change the type of data to []string in some way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants