pipe-cd/pipecd

Support multiple value updates in EventWatcher

Closed this issue · 3 comments

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.

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.

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

This issue was closed because it has been stalled for 7 days with no activity. Feel free to reopen if still applicable.